int TimeDayOfYear( | datetime date) |
In the strategy tester, I run this:
if (DayOfYear()>=88) {StartHour=StartHour+1;EndHour=EndHour+1;}
However, it is always adding 1 hour even before March. Is it picking up the current server time? Do I have to use candle time instead? I can't see how I can backtest it any other way.
Seems working fine when I tested. I suggest you use the code this way for example:
if (DayOfYear()>=88) {StartHour=10;EndHour=21;}
Use numbers because otherwise your StartHour and EndHour variables will be incremented on every tick.
Use Print(DayOfYear()); to view what is the day when you run the test.
Interesting point..
Documentation says
Returns the current day of the year (1 means 1 January,..,365(6) does 31 December), i.e., the day of year of the last known server time. .. as with
|
Seems working fine when I tested. I suggest you use the code this way for example:
if (DayOfYear()>=88) {StartHour=10;EndHour=21;}
Use numbers because otherwise your StartHour and EndHour variables will be incremented on every tick.
Use Print(DayOfYear()); to view what is the day when you run the test.
Yes, it works correctly now but when I backtest to before March 29th, ie Jan, Feb, and March it still uses the current server time in the strategy tester.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
In the strategy tester, I run this:
if (DayOfYear()>=88) {StartHour=StartHour+1;EndHour=EndHour+1;}
However, it is always adding 1 hour even before March. Is it picking up the current server time? Do I have to use candle time instead? I can't see how I can backtest it any other way.