MQL4 Trailing Stop from Given Stoploss

To add comments, please log in or register
Alexander Whipp
30
Alexander Whipp  

Hey all,

I execute my orders in my EA as such.

         stopLoss = low*0.9975;

         OrderSend(Symbol(),OP_BUY,0.1,Ask,Slippage,stopLoss,NULL);


All the trailing stop examples I find online deal in fixed pips where as I am dealing in a dynamic price. Is there anyway to enable trailing stop-like behavior given this parameter?

Thanks.

William Roeder
19170
William Roeder  
Alexander Whipp: Is there anyway to enable trailing stop-like behavior given this parameter?
Of course, code it to trail.
lippmaje
810
lippmaje  
Search the codebase for some stoploss manager, like auto stoploss or auto sl. Then understand the code and adapt it to your needs.
Alexander Whipp
30
Alexander Whipp  
Thanks for the responses. I was overthinking it last night. Just needed to keep track of my active trade's stop loss and calculate the pips between entry and SL. Then I use that as the trailing stop.
William Roeder
19170
William Roeder  
Alexander Whipp: calculate the pips between entry and SL. Then I use that as the trailing stop.

"Between entry and SL" is a constant.

To add comments, please log in or register