if(OrdersTotal()>0){ for(int i=1; i<=OrdersTotal(); i++) // Cycle searching in orders
int i initial value should be 0
if ((TradeHour==Hour())&&(TradeMinutes==Minute())&&(TradeSeconds==Seconds())&&(TradeYear==Year())&&(TradeMonth==Month())&&(TradeDay==Day()))
If you don't get a tick at that exact second, the code will not be executed
GumRai,
Thank you for your reply. I will try to change int i initial value to 0.
If it fails, I will try to delete TradeSeconds parameter. Then, if I understand it correctly, there need to be a tick in this exact minute to execute a trade. It is not a problem if we are talking about currencies but when we are talking about shares, there also could be a minute without a tick.
Is it possible to make EA independent from getting a tick to execute a trade?
gooly,
Thank you also for your reply.
I don`t know if I understand it correctly but I have backtested EA using MT4 dedicated for FxPro (downloaded from broker site). Broker time zone is GMT+2. Historical data is also downloaded from FxPro servers so I think there is no time shift change between backtest data and broker data. Please correct me if I`m wrong.
I understand.
I have made changes that you advised previosly and CFD trades are opening correctly now.
I still assume it must be a tick through the whole minute to execute a trade. I think it is a rare situation to have no tick for the whole minute on US stocks however it happens.
If I face with significant percentage of lack of trade execution then I will experiment with OnTimer() function.
Thank you for you help!
I appreciate it.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi All,
I have an EA that opens trade at a specified time.
It is working well on currencies.
However I have a problem with CFDs.
Curious is that if I use Strategy Tester, EA works perfectly.
But when I set EA on my demo account to forward test it, it is not opening trades.
No errors and no warnings in the code. It is not about stop level - tried 100 tp/sl to be sure. Money is also not a problem. 4% margin, min 10 shares, AT&T shares, 900$ demo account.
Could you please advise what should I check and what can be the root cause of such issue?
I tried to forward test it on AT&T shares.
Please find below code: