Problem - Modify Stop to break even based on ATR
-
https://fxdreema.com/shared/nM92DEEVd
Hi everyone. This has me a little stumped. The goal is that once the price has reached 1x the ATR in profit that the stop is modified to break even (which at that point in time would be 1x ATR away from the current price). It seems to work sometimes and not work sometimes. For example, last night I had 4 open trades and it only (so far) malfunctioned on one of them.
What happened is that it did the modify stop action (to break even) even though, looking at the chart, the price never even got close to 1x ATR from the opening price. I was thinking about putting another pips away block in front of the current one with the condition that it has to be at least 50 pips in favorable direction before it passes to the current block. But I'd prefer to just make it work correctly. Thoughts?
Thanks in advance for any help you can offer.
-
I see you configured the 'For each trade' block for all trades (manual and automatic). Can you confirm which one was the wrong one? I guess the manually opened.
-
Hi. Actually when it malfunctioned I had that block set to the default (Group#). I changed it to manual and automatic as there are other manually placed trades that need to exhibit this behavior as well.
It almost seems like there is a hiccough where it thinks the price has reached the 1x ATR distance and then modified the stop loss accordingly (and to the correct level). It is just that the price never even came close to reaching the 1x ATR distance so the trade never had a chance to get to my take profit.
Plus I noted in the terminal Journal after I posted this question the EA tried to modify trades on a few pairs that I didn't even have any trades in. This caused no harm but seemed really strange.
If this helps here is how each "trade" is set up. Each trade is actually 2 trades...
Trade 1 (automatically entered by EA) - TP of 1x ATR and SL of 1.5x ATR. So this trade should hit TP more or less at the same time as the 1x modify stop loss would trigger (or may not even trigger at all because it already TP)
Trade 2 (manually entered because it is identical trade to Trade 1 except no TP. Have to do this to get around LIFO restrictions using MT4 & Oanda. I am forward testing this way for now but will eventually set this trade to auto trigger in second terminal). This trade is meant to run until exit criteria are met. The initial SL modification is this 1x ATR which would bring it to my break even level. From there I have it modifying the SL daily for a trailing stop which seems to be working fine as far as I an tell in my back testing (haven't had the pleasure of this being forward tested yet :)).
I don't know if that helps any. Thanks for taking a peek!
-
That pips away block always gives problems lol

Here's how to do it without the troublemaker:
https://fxdreema.com/shared/lmSgKgfhbThis also looks a bit like trailing stop, that block could be 3rd option..
-
@roar Thank you! That logic makes sense. I haven't tried using variables yet. Well...let me say I looked at it and got a little confused so my mind didn't go that direction. But this makes sense. Thank you! I will try to incorporate this into my full algo. Much appreciated.
-
@roar Really? Didn't know that. What problems have you found?
-
@l-andorrà just the settings in that block, direction and parent trade, its not very cleary stated what each setup will finally do.
I'm sure the block works ok if you take the time to test and learn it carefully.
-
@roar Ok. Thanks.