Welcome to Forex-TSD!, one of the largest Forex forums worldwide, where you will be able to find the most complete and reliable Forex information imaginable.
From the list below, select the forum that you want to visit and register to post, as many times you want. It’s absolutely free. Click here for registering on Forex-TSD.
Exclusive Forum
The Exclusive Forum is the only paid section. Once you subscribe, you will get free access to real cutting-edge Trading Systems (automated and not), Indicators, Signals, Articles, etc., that will help and guide you, in ways that you could only imagine, with your Forex trading.
Elite Section
Get access to private discussions, specialized support, indicators and trading systems reported every week.
Advanced Elite Section
For professional traders, trading system developers and any other member who may need to use and/or convert, the most cutting-edge exclusive indicators and trading systems for MT4 and MT5.
HOW to Open an order at the beginning of a bar only ??
Hi,
I'm implementing an EA in which I want to open an order only if a cross of some level by an indicator has occured between the second previous bar and the previous one.
For example, on the daily chart, If there is a cross between the 18th of January and the 19th of January, I want to open an order on the 20th of January.
I did something like this:
When I open an order, I record the order open time.
Then I do the following test: Is (CurrentTime() - LastOrderOpenTime) < Period() ??
If yes, it means that the current bar is not finished, yet, and I shouldn't open a new order. And also, when this condition becomes false, I should be on the next bar of the chart, and the cross happened before the last bar and no order should be opened until the next signal.
The problem is that when attaching it to a chart, it keeps on creating new orders until the bar is finished. Anybody can tell me what I did wrong?
I'm implementing an EA in which I want to open an order only if a cross of some level by an indicator has occured between the second previous bar and the previous one.
For example, on the daily chart, If there is a cross between the 18th of January and the 19th of January, I want to open an order on the 20th of January.
I did something like this:
When I open an order, I record the order open time.
Then I do the following test: Is (CurrentTime() - LastOrderOpenTime) < Period() ??
If yes, it means that the current bar is not finished, yet, and I shouldn't open a new order. And also, when this condition becomes false, I should be on the next bar of the chart, and the cross happened before the last bar and no order should be opened until the next signal.
The problem is that when attaching it to a chart, it keeps on creating new orders until the bar is finished. Anybody can tell me what I did wrong?
Not sure but here is what somone jotted done for me sometime ago. I'd have to google it to give proper props to the original writer.
It helps determine whether or not your on the opening of a new bar.
Code:
int newbar()
{
double g;
int m,s,k;
m=Time[0]+Period()*60-TimeCurrent();
g=m/60.0;
s=m%60;
m=(m-m%60)/60;
return(m);
}
I'm implementing an EA in which I want to open an order only if a cross of some level by an indicator has occured between the second previous bar and the previous one.
For example, on the daily chart, If there is a cross between the 18th of January and the 19th of January, I want to open an order on the 20th of January.
I did something like this:
When I open an order, I record the order open time.
Then I do the following test: Is (CurrentTime() - LastOrderOpenTime) < Period() ??
If yes, it means that the current bar is not finished, yet, and I shouldn't open a new order. And also, when this condition becomes false, I should be on the next bar of the chart, and the cross happened before the last bar and no order should be opened until the next signal.
The problem is that when attaching it to a chart, it keeps on creating new orders until the bar is finished. Anybody can tell me what I did wrong?
Then I do the following test: Is (CurrentTime() - LastOrderOpenTime) < Period() ??
you can add // return (0);
I'm implementing an EA in which I want to open an order only if a cross of some level by an indicator has occured between the second previous bar and the previous one.
For example, on the daily chart, If there is a cross between the 18th of January and the 19th of January, I want to open an order on the 20th of January.
I did something like this:
When I open an order, I record the order open time.
Then I do the following test: Is (CurrentTime() - LastOrderOpenTime) < Period() ??
If yes, it means that the current bar is not finished, yet, and I shouldn't open a new order. And also, when this condition becomes false, I should be on the next bar of the chart, and the cross happened before the last bar and no order should be opened until the next signal.
The problem is that when attaching it to a chart, it keeps on creating new orders until the bar is finished. Anybody can tell me what I did wrong?
Ummm...
PHP Code:
if(iOpen(Symbol(),0,0)==iClose(Symbol(),0,0)&&iLow(Symbol(),0,0)==iHigh(Symbol(),0,0))
{
//A new bar has happend.
}
__________________
God Bless Everyone, and their trading logic.
How do I know the profit of the previous trade? And the lots, and the side?
Use OrdersHistoryTotal() instead of OrdersTotal(). Then use OrderProfit(), OrderLots() etc. You must make sure that historical quotes for the timeperiod you are interested in are loaded though, and I think you can only do this manually - right-click on the 'Orders History' tab and select 'All History'.
Should have added that you need to use 'MODE_HISTORY' with OrderSelect()...
Use OrdersHistoryTotal() instead of OrdersTotal(). Then use OrderProfit(), OrderLots() etc. You must make sure that historical quotes for the timeperiod you are interested in are loaded though, and I think you can only do this manually - right-click on the 'Orders History' tab and select 'All History'.
Should have added that you need to use 'MODE_HISTORY' with OrderSelect()...
Hi Omelette,
Do you know that BT have a problem looking in the history: it looks on the real history, not the one of the BT. I asked Metaquote few months ago about this bug but they didn't have any answer.... Maybe now it's fixed...
I don't understand why the result is not the same. It is not a spécific problem about the HMA just i'd like to ompute my indicator in a spécific function where the array is passed in argument.
I've attached source code of an indicator which display the two curves, it's seems that it is the second call to iMAOnArray which done different results.