EA not closing trades
-
Hi Everyone
I was hoping someone could help with an issue I have. I've put together an EA and when I back test it in MT4 it works fine. But when I deploy it live it won't close trades as programmed. Is it because of a setting in MT4 or is my EA not designed correctly?
Attached is a snippet of the close trade action. It basically says, if its Tuesday, Wednesday or Thursday close all profitable trades at 8pm GMT. If a Friday close all profitable trades every hour or close all trades at 8pm GMT.
The EA only opens trades on Tuesday, Wednesday and Thursday so I'm asking it to close anything that's not hit SL or TP and is profitable that day. If not run the trade over to the following day, but make sure it's closed in a Friday before the weekend.

-
Can you please share the link to the project?
-
My first time sharing a project link so hope it works!
-
Happy Sunday everyone! I was wondering if anyone had any ideas about this yet?
-
Your current structure is supposed to close any open trade on the first tick every day. Is that the way you want it?
-
Hiya, thank you for your reply.
I want to close any profitable trades at 8pm GMT on Tuesday, Wednesday and Thursdays, any profitable trades hourly on a Friday and then close all trades on Friday at 8pm GMT.
-
Then I recommend to create 3 completely separate structures doing that. Combining all of them can be an interesting programming exercise but IMHO the most important thing is making it works as requested instead.
-
OK, thank you for your insight. So all I have to do is make three different 'If Trade' structures for each different senario?
-
Yes. Try it and share the result here.
-
I've mad the changes and it still doesn't close trades! I'm wondering if the issue is with MT4 setting rather than the EA itself. It works find during backtesting but not when live.
-
Can you please share the link to the latest version?
-
This is the latest version: https://fxdreema.com/shared/CJLmx0g9c
-
Blosck 91 and 93 are using the same sign. Should they be opposite? Additionally, I'm not sure that crossing option applied on different timeframes will work correctly. Never tried it that way before.
-
Good spot! 93 should have been X> not X<. I'm sure that my logic for closing the trades is correct.
It seems to work when applying it in back testing mode on MT4 but doesn't when I apply it to real life it opens the trades OK but doesn't close them.
-
Also not sure why the time frames are different, they're supposed to be both M15 so I've updated those now.
-
If the bot is working normally on backtest but not on demo/real with the same broker, the problem is on the broker conditions for trading. You should ask them if some restrictions are applied to bots or market conditions in general.
-
OK, thanks for the advice. I'll ping them a message.
-
You're welcome.