Q:
I would like to code an EA to close a trade if the price closes below the opening candle Low when each trade was taken.
Also, how can I tell the difference between two open trades.
I would like to code an EA to close a trade if the price closes below the opening candle Low when each trade was taken.
Also, how can I tell the difference between two open trades.
A:
You can set the stoploss to the Low of the opening candle by setting the stoploss value to Low[0] and choosing “Absolute value (price):
You can set the stoploss to the Low of the opening candle by setting the stoploss value to Low[0] and choosing “Absolute value (price):

On the advanced tab, you can set the MagicNumber to a special value to distinguish between trades:

There is more info about the MQL MagicNumber here:
To get notified about the latest questions and answers, follow us!
Follow @iExpertAdvisor