Hello FF community.
I am having one hellova time trying to code a good, consistently working Trailing Stop loss on my EA. Below is the code that I use. I have had some indications that seem contradictory so I am starting this thread to help me and everyone else find the last word from the MQL4 writers about how is the best way to code a trailing stop.
I have seen the code below work at some points and not work at some other points for no apparent reason.
I am having one hellova time trying to code a good, consistently working Trailing Stop loss on my EA. Below is the code that I use. I have had some indications that seem contradictory so I am starting this thread to help me and everyone else find the last word from the MQL4 writers about how is the best way to code a trailing stop.
I have seen the code below work at some points and not work at some other points for no apparent reason.
Inserted Code
if (OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)) { if (OrderType()<=OP_SELL && OrderSymbol()==Symbol()) { if (OrderType()==OP_SELL) { if(TrailingStop>0) { if((OrderOpenPrice()-Ask)>(Point*TrailingStop)) { if(OrderStopLoss()>(Ask+Point*TrailingStop)) { OrderModify(OrderTicket(),OrderOpenPrice(),Ask+Point*TrailingStop,OrderTakeProfit(),0,Green); return(0); } } } } } }