Please help with glitch in trend following EA
-
So trying to place a buy or sell when market moves 10 pips either way. s/l is 10 pips with no t/p. EA moves all trades to BE when they profit 10 pips.
So idea is that as market moves up there's a new buy every 10 pips with only the last trade having risk. If price moves the other way then a sell is placed. I've got the EA looking at the last trade to see if it's moved 10 pips. Works great on one direction. But when market reverses it doesn't take opposite trade.I believe it's because as the market reverses it takes out the last trade (a buy in this case) and so it can't grab that open price as the baseline for the 10 pip move down. So it reverts to the next open trade (which is 10 pips lower). And so from it's perspective, it never gets 10 pips below the "last" trade.
How would I have the EA select the open price for the last position opened., whether it's closed now or not.Here's the blocks and thank you so much: https://fxdreema.com/shared/TfLAy6w0e
-
You should definitely use a variable to store the value of the last open trade. That way the bot can 'remember' it regardless it's closed or not as you said.
-
Okay, thanks. That makes sense. I've tried to do that before and can't seem to figure out the variable thing. I'll have to look for some tutorials.
-
@l-andorrà Thanks again for the help. I think I got it working. May not be the prettiest but seems to work in back tester as I wanted. Now will try on demo account.
-
Those pink blocks should be separate from its current position and be on a completely separate block tree.