A mistake in my SL moving EA
-
Hi,
This is my project: https://fxdreema.com/shared/RM20FS7S
It opens trades and creates a green Line right above/below entry price. Once in profit and price closes above the 15MA (in a short setup) and then makes a new low, the SL should move to the last swing high that was above the 15MA.
In my backtest on GbpJpy, you can see that it worked here. That's the way it should be:

Now, somehow when the trade goes longer, the EA seems to not work properly. I can not find out why the EA doesn't move the stop in this case:

Can anybody see the mistake in the part of the EA that moves the stops? Really greatful for the support!
-
Also to note: On the pullback like in the second picture, price has to always stay beneath the green line. I don't want to move stops if price hit my entry level again.
-
Like here, I don't understand why my stop is not moved below the pullback in the red circle, when price later makes a new high! -
The problem as I see it is how the bot is defining what you call 'the last swing high'. The Ea is moving the SL to what those blocks are telling it to do. That is not a trivial thing to do.
-
Lets just look at the "Stopp Loss mover long setups" part of my EA: https://fxdreema.com/shared/nIhcYABLd
The string starting with block 52 looks for a close of candle 1 below the 15EMA but in profit, meaning above the buy line. This closes the string and starts the string starting with block 62. This looks for a new candle high while making sure, price always stays above the buy line...and then activates the modify stops. The barcounter_long variable counts the bars since that break below the 15EMA and so SL should be below the lows since then.
I just don't see where I made the mistake...
-
Maybe @jstap sees the mistake? I tested it with GbpJpy from 01.01.2023 till today. It works fine with the first trade...then from the second one on it doesn't work. Would that suggest a probleme with the counters?
-
What counters? To me any blocks under 1 that's switched off won't work? I may be wrong but would stay away from doing so.
-
@jstap did you look at the project? https://fxdreema.com/shared/nIhcYABLd
Only the two areas I created. (The turn on boxes after the sell or stop start the process). The upper one is for moving stops in a buy trade, the lower one for a sell trade. Why is it not working?
-
I did the best thing to do is create a simple project just doing what you want, once working you can add others, this is how I do it, use process of elimination. from what I see the only blocks turning blocks off are under red blocks. In your journal you will see what blocks turn on and off.
-
@SirLuk Hola, me gusta tu proyecto, crees que se pueda adaptar este EA tuyo para operar solo en rangos de horarios de Killzone?