2 Time Frame EA

 
Hi everyone,

do you have any idea why I get this error when backtesting?

Best Reguards,
ZeroCafeine.
int OnInit()
{
    Handle_MACD_D1 = iMACD(_Symbol, PERIOD_D1, FastEMA_D1, SlowEMA_D1, SignalSMA_D1, PRICE_CLOSE);
    Handle_MACD_H4 = iMACD(_Symbol, PERIOD_H4, FastEMA_H4, SlowEMA_H4, SignalSMA_H4, PRICE_CLOSE);
 

Suppose you set strategy tester period to PERIOD_M15 and you choose "open price only".

In this case you are only allowed to read data from PERIOD_M15. Accessing any other time frame causes the above error.

To resolve this you should use "Every Tick" or "one minute OHLC".

 
Thank you very much, I had looked before asking the question and I more or less found the same answer, your answer is so logical but it didn't work straight away, 

I had to delete all the installation directories and reinstall a new one, 

If anyone knows exactly which files to delete to avoid deleting everything, that would be interesting to know.
 
ZeroCafeine #:
Thank you very much, I had looked before asking the question and I more or less found the same answer, your answer is so logical but it didn't work straight away, 

I had to delete all the installation directories and reinstall a new one, 

If anyone knows exactly which files to delete to avoid deleting everything, that would be interesting to know.

Thanks for explanation.

 
Hi  Yashar Seyyedin 

I was away for a few days, I did some tests this morning and I have the impression that sometimes you have to delete the log files but not always, it's random with Metatrader 5, 

I've tried several versions of MT5 with different brokers, I don't know what the problem is but it works randomly,

so for the moment the solution is to fall back on the bare MT5 version, which bothers me a bit because I have to change my whole working environment as I program with VS Code and not with the official IDE.

Best Reguards,
ZeroCafeine
Yashar Seyyedin
Yashar Seyyedin
  • 2024.05.02
  • www.mql5.com
Trader's profile
Reason: