Moving Stop Loss/Target on chart while EA is active (Solved)
-
Does anyone know how to modify stop losses and target profits from the chart while the EA is running?
I have an EA that places stop loss based on a horizontal line that is named "Stop" and the same thing for target profit.
What I need to do is to drag these horizontal lines to change the stop loss/target profit.
What I know so far is once the EA is applied to the chart then that's it; there is no way to modify it later on.
I believe it will be a long process and not a straightforward one and may involve loops; perhaps? I just can not figure where to start from.
Can someone put me on the first few steps to achieve this?
Thanks,
@jstap @l-andorrà and others of course, how would the structural concept should look like?
-
@mohamed80 fxdreema.com/shared/fUFTaK2yd
like this perhaps
-
Hi @max-c
The thing is that I have horizontal lines on the chart representing SL, TP. Do not see the how the EA in your example would react to dragging these lines up and down.
-
can you share your ea. the thing is horizontal line are just a visual representation of the stop and target.
-

Trade will close when the price is >= Horizontal Line price level named "Target" or will close when the price is <= Horizontal Line level named "Stop".
https://fxdreema.com/shared/xQorUbdmb
What I need to do is to drag/move these lines on the chart while the EA is running.
-
@mohamed80 Then you need a loop search9ing for that horizontal line and pick up the price there via variable. Like this:

-
Thanks a lot. It worked..
-
@mohamed80 You're welcome.