the problem was due to putting TimeTradeServer() function on the top of my code and storing the result in a global variable whence it runs only a single time storing a fixed value in the global variable, I cut the line and paste it to OnTick() function therefore the problem is fixed now.
void OnTick(){ // some code here ... datetime buystop_exp_time=TimeTradeServer()+PeriodSeconds(PERIOD_H1)*5; // some code here as well ... }
still I wonder how it worked on a demo account...!?
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
I'm trying to open a BuyStop position while expiration parameter points to the next 5 hours.
trying to calculate the time using (TimeTradeServer()+PeriodSeconds(PERIOD_H1)*5) function but in strategy tester it returns a fixed time all the time which is (2020.01.01 05:00:00).
I wonder why when I attach my EA to a demo account the returned time is what I expected to be but it does not work properly in strategy tester.