[Backtesting] A question about the difference between "Control points ..." and "Open prices only ...)
I notice if I use the Daily period, I got this problem. If I use the H4 period or less, it will be OK. I guess maybe the daily OPEN price is open outside the time period I defined. But I do want to trade just inside the time period I define. How to solve?
- It's not "the daily OPEN price" but daily bar time. The daily bar time is always midnight broker time.
- If you control trading time, stop using open or control points.
- Simplify your code
bool TradingHours() { return in_range(OpenHour*3600 + OpenMin*60, CloseHour*3600 + CloseMin*60); } #define SECONDS uint bool in_range(SECONDS beg, SECONDS end, datetime when=0){ SECONDS tod = time(when); return beg < end ? beg <= tod && tod < end : !in_range(end, beg, when); }
Find bar of the same time one day ago - Simple Trading Strategies - MQL4 and MetaTrader 4 - MQL4 programming forum
- It's not "the daily OPEN price" but daily bar time. The daily bar time is always midnight broker time.
- If you control trading time, stop using open or control points.
- Simplify your code Find bar of the same time one day ago - Simple Trading Strategies - MQL4 and MetaTrader 4 - MQL4 programming forum
Thanks for the answer first.
>> If you control trading time, stop using open or control points.
I will do optimization backtesting. If I stop using the open only or control points and use the Every tick, it will take very very very long time. Any alternative? Maybe I ignore or comment out the control trading time, so I can use the open only or control pint to do the optimization backtesting. Then I choose a optimized parameter set and do the single backtesting by using the Every Tick. Is this OK?

- 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,
My tes EA looks as follow. I just want to trade in the defined time interval since in different interval the spead is different.
By backtesting if I select the "Open prices only ...", I can see in the Journal following:
...
One can see the TradingHours() returns FALSE
But if I use the "Control points ..." I can see more as follow:
...
One can see in this case the TradingHours() will return TRUE.
What could be the reason?