I am currently building an EA to automate part of my trading system. However, I am unsure how to program one of the criteria.
I only want the EA to place trades when all current open orders for the currency pair are all in profit. These could be both manual trades and EA placed trades. I believe I need to use an If function and the OrderSelect command but am unsure how to set the profit criteria.
Could someone please point me in the direction of a snippet of code that would give me some hints?
if(OrderSelect(x,SELECT_BY_POS) && OrderSymbol()==Symbol() && OrderProfit()<=0)
//Check conditions to place trades
To add comments, please log in or register