Questions from Beginners MQL5 MT5 MetaTrader 5 - page 1027

 
Tango_X:

I want to get MACD indicator handles from three timeframes in the OnInit() block. On the chart - it works, but in the tester it doesn't work, and the terminal hangs tight! So I want to get the data that doesn't exist? Please, advise how to deal with it?

ENUM_TIMEFRAMES Periods[NUMBER_OF_PERIODS]={PERIOD_M1,PERIOD_M2,PERIOD_M3};
ENUM_TIMEFRAMES Periods[]={PERIOD_M1,PERIOD_M2,PERIOD_M3};

Maybe I should do it this way?

if(handles[p]==INVALID_HANDLE)  Print("Не удалось получить хэндл индикатора для символа !");

if(handles[p]==INVALID_HANDLE)
{
   Print("Не удалось получить хэндл индикатора для символа !");
   retern(INIT_FAILD);
}

Is it like this?

 
Сергей Таболин:

Maybe that's the way to do it?

What difference does it make? It doesn't work either anyway)

 
Tango_X:

What difference does it make? It doesn't work either anyway)

Why do you use a custom MACD? Have you tried it with the standard one?
 
Artyom Trishkin:
Why do you use a custom MACD? Have you tried it with the standard one?

I need the custom one because I use it... The MACD is just an example

 
Tango_X:

I need the custom one because that's what I use... MACD is just an example

Are the handles created? Have their values been checked?
 
Tango_X:

I need a custom one, because I use it... MACD is just an example

Don't you need to pass parameters for the MACD?

 
Artyom Trishkin:
Are the handles created? Have you checked their values?

When I put an EA on a chart - handles are created .... When I run the Expert Advisor in the Strategy Tester - everything hangs

 
Сергей Таболин:

Don't you have to pass parameters to the MACD?

parameters are passed by default... they are not important in this case.

 
Сергей Таболин:

Don't you have to pass parameters to the MACD?

If using the default values, it is not necessary to pass parameters.
 
Tango_X:

When I put an EA on a chart - handles are created .... When I run this EA in the tester - everything hangs

I can't check it - I'm using my mobile phone. Try to start with consciousness of just one. No loops or arrays of timeframes. Just directly create one handle. If it's OK, add a second, third...
When everything is working, start creating in a loop with the mass. You can do it one at a time. That way, you will understand the cause or the hiccup more quickly.
Reason: