I'm coding an EA that opens orders with TP and SL when a price is hit.
I don't want the EA to reopen any other orders if the same price is hit a second time.
how can i control that ?
Thanks for ur replay,
can you give me an example of code ? i'm a newer in mql community :-)
How may of these entry price levels do you have?
An easier way would just be to use a boolean variable to check if that level has been traded or not
double level = 0.7867; // or whatever price you want to enter
bool levelTraded = false;
if (!levelTraded && Bid == level)
levelTraded = true;
It will only trade at that level once, until you restart the EA.
Because of slippage, an order may not have been opened at the exact price.
Doubles are rarely equal.
Of course it's mandatory to declare an amount of tolerance points because also 2 pending orders
placed at the same price can be executed with some points of difference.
True, but MT5 it is possible to check with requested price in history.
Thanks, I didn't realise that. I'm still not so hot with MQL5
Bid >= Level
Would be better for a Sell limit.
Bid <= Level
For a Sell Stop