C‌an I draw trailing stop line in MT5 EA?

 

‌‌If I buy this bar, and setting stop at low-20 point.

C‌an I draw the line as trailing stop line in MT5 EA? When the low higher that move  trailing stop line.

Have any example for this case can let me study? Thank you.

L‌ike this picture.‌

 

If you buy at a current bar (when it's not yet finished), then you don't know its low. If you set stop at the low which was low when you buy, then price can move lower.

S‌o you could actually place stop at low of every previous bar (which is finiished).

I‌t's not clear if you want simply to draw this line, or to move stoploss according to this imaginable line.

 
jojocash:

‌‌If I buy this bar, and setting stop at low-20 point.

C‌an I draw the line as trailing stop line in MT5 EA? When the low higher that move  trailing stop line.

Have any example for this case can let me study? Thank you.

L‌ike this picture.‌

You can draw line on the trailing stop price with ObjectCreate > OBJ_TREND

 
Stanislav Korotky:

If you buy at a current bar (when it's not yet finished), then you don't know its low. If you set stop at the low which was low when you buy, then price can move lower.

S‌o you could actually place stop at low of every previous bar (which is finiished).

I‌t's not clear if you want simply to draw this line, or to move stoploss according to this imaginable line.


"move stoploss according to this imaginable line"

‌‌I try use  ObjectCreate > OBJ_TREND isn't like step wise chart.

‌‌Can I draw  trailing stop line in MT5 EA. Or it can used in indicator or Scripts‌

T‌hank you.

Documentation on MQL5: Object Functions / ObjectCreate
Documentation on MQL5: Object Functions / ObjectCreate
  • www.mql5.com
Object Functions / ObjectCreate - Reference on algorithmic/automated trading language for MetaTrader 5
 
yes but you have to build it from several V and H lines if you want it to look like that picture.