Quote:
Originally Posted by dxtrade
I have a small problem here:
In my EA I have a BuyCondition and Sell Condition and a close order for inversed signals. To prevent opening and closing trades inside the same bar I have the following code:
if(OneEntryPerBar==true)
{
if(CheckEntryTime==iTime(NULL,PERIOD_H1,0)) return(0); else CheckEntryTime = iTime(NULL,PERIOD_H1,0);
}
All fine. But now if he finds a sell condition during an open buy trade, he closes the buy, which is OK. But he doesn't open the sell as the above code is preventing this.
Any idea on how to make him close and open inside 1 bar... but only once per bar?
I hope I make myself understood.
Thanks
|
it won't open cause of the code you use above.. until the next hour..
you can try this..
Quote:
if (OrderOpenTime() >= iTime(NULL, PERIOD_H1, 0)) order++;
if (order < 1)
{
order conditions
}
|
hope that helps.. not an expert.. but this code won't stop from doing it more than once..