Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 544

 

I have encountered a strange thing - OnTimer does not work in the Expert Advisor as EventSetTimer does not work (we get the message "Failed to set timer, error 4051"). MT4, build 604.

int OnInit()
{
//--- create timer
        if (EventSetTimer(10) == false)
        {
                Print(StringConcatenate("Не удается установить таймер, ошибка ", IntegerToString(GetLastError()) ));
        }
      
        Print("Эксперт запущен");

        return(INIT_SUCCEEDED);
}
 
artmedia70:
Yes.

Got it! I have created a double of the indicator and I will optimise the second AMA from it.
 
Forexman77:
I have an idea! I have created a double of the indicator and use it to optimise the second AMA.

What kind of take? You can call the same indicator with completely different parameters

extern int periodAMA_1= 8; 
extern int periodAMA_2=13; 

double ama9       =iCustom(NULL,0,"AMA",periodAMA_1,0,0); // АМА с периодом 8  на текущем баре
double ama9_prev  =iCustom(NULL,0,"AMA",periodAMA_1,0,1); // АМА с периодом 8  предыдущем баре
double ama13      =iCustom(NULL,0,"AMA",periodAMA_2,0,0); // АМА с периодом 13 на текущем баре
double ama13_prev =iCustom(NULL,0,"AMA",periodAMA_2,0,1); // АМА с периодом 13 предыдущем баре
 
artmedia70:
Do not compile it in builds older than 509... Simply put the file compiled in the 509th build into the appropriate folder in the new build.


... and be prepared that it won't make it to the end of the year.
 
tara:

... and be prepared that he won't make it to the end of the year.
Yeah... The second wave will come...
 
artmedia70:
Yeah... The second wave is coming...


And there's the "ninth wave"
 
Vinin:

And there's the "ninth shaft"
... that's going to flood the wave of outrage
 
A programmer is needed to write an indicator. Please contact me with any questions.
 
Suddenly a hunter runs out, shoots the programmer straight...
 
GSB:

What kind of take? You can call the same indicator with completely different parameters



If in the indicator itself
extern int       periodAMA=10;
in the EA
extern int periodAMA_1= 8; 
extern int periodAMA_2=13; 

how does the indicator code recognize the transmitted parameters and their names are different?

But everything is as you said. I checked it with the script again)

Reason: