The timer function is not getting executed

 

I am trying to call the indicator inside itself with different parameter and Chart symbols. See what I did:  

#define count_symbol 3
string Symbols[count_symbol]={"CADCHF","GBPAUD","EURUSD"};
int OnInit()
{
if(draw_charts){
   for(int i=0; i < count_symbol; i++) 
   {
  
   SymbolSelect(Symbols[i],true);
   chart_id[i] = ChartOpen(Symbols[i],0);
   int indicator = iCustom(Symbols[i],0,"Real Time Testing\\Trade_Real_Test",0,false,false,false);
   ChartIndicatorAdd(chart_id[i],1,indicator);
   
   }
   }
   
   EventSetMillisecondTimer(100);

return(INIT_SUCCEEDED);
  }
void OnTimer()
  {
   showSymbol();
   
  }
void showSymbol()
{
Print("The Symbol is: ", _Symbol);
}

I see when I apply the indicator on the chart, the other charts start getting appeared on screen with the indicator applied on it. But I could not see the output of the OnTimer(). I only see the output of the timer for the symbol on which is was primarily applied and no output for the rest charts which I drew using the program. I could not understand what is the reason for it. Please help me in running the Timer function for the rest charts too.

 
You will need a separate instance of OnTImer() on each of the charts,or you have to continuously cycle through all chart ID's which can get more complex to manage. 
 
Marco vd Heijden:
You will need a separate instance of OnTImer() on each of the charts,or you have to continuously cycle through all chart ID's which can get more complex to manage. 

But I didn't understood why the Timer function is not working. I am calling the same indicator and the indicator itself has the Event Timer which has to get executed, am I not right, sir?

Please explain this to me. If possible can you give a demo code that would help a lot.

 
Marco vd Heijden:
You will need a separate instance of OnTImer() on each of the charts,or you have to continuously cycle through all chart ID's which can get more complex to manage. 

Sir, can you explain how I can create  separate instance of OnTImer() on each of the charts, please?

 

You have to attach the same indicator to multiple charts each running their own timer event.

Meaning the indicator that you add has to have it's own timer function.

 
Marco vd Heijden:

You have to attach the same indicator to multiple charts each running their own timer event.

Meaning the indicator that you add has to have it's own timer function.

If I am adding the indicator to a chart within that indicator itself, then I guess the Timer function is already there. Check my code. If that is the scenario then the timer should get executed, am I right sir?

 
jaffer wilson:

If I am adding the indicator to a chart within that indicator itself, then I guess the Timer function is already there. Check my code. If that is the scenario then the timer should get executed, am I right sir?

You did not attach the indicators to a chart, but you rather executed iCustom() command. Only OnInit() and OnCalculate() are triggered. Some commands (e.g. graphic ones) are ignored within iCustom() as well.

 
Ex Ovo Omnia:

You did not attach the indicators to a chart, but you rather executed iCustom() command. Only OnInit() and OnCalculate() are triggered. Some commands (e.g. graphic ones) are ignored within iCustom() as well.

Sir, only if the OnInit() is triggered then I have Event Timer included inside the OnInit(), then why it is not happening?

 

The OnInit() and

EventSetMillisecondTimer(100);

Is only for the current chart, not for the charts that you are calling via iCustom.

We know nothing about the existence of any timer in 

"Real Time Testing\\Trade_Real_Test"

Since you are not showing any of the code involved.

You say you call the indicator inside of itself this would cause an endless loop of opening charts and calling indicators within indicator.

That part is not clear, as are many.

If you call iCustom or any other indicator there is no need to open a chart or add the indicator, all you need is the handle to copy data directly.
 
Marco vd Heijden:

The OnInit() and

Is only for the current chart, not for the charts that you are calling via iCustom.

We know nothing about the existence of any timer in 

Since you are not showing any of the code involved.

You say you call the indicator inside of itself this would cause an endless loop of opening charts and calling indicators within indicator.

That part is not clear, as are many.

If you call iCustom or any other indicator there is no need to open a chart or add the indicator, all you need is the handle to copy data directly.

Sir I have shared the code above. Is that not the code you were expecting? What else should I say? I am just experimenting with the function of MQL5. Hence the above code is what I tried. Above code means what I have mentioned in the question of mine.

 
jaffer wilson:

Sir, only if the OnInit() is triggered then I have Event Timer included inside the OnInit(), then why it is not happening?

Probably because "Only OnInit() and OnCalculate() are triggered." and " Some commands are ignored within iCustom()..."

If I translate it for you, no OnTimer(), OnChartEvent(), OnTester() are ever invoked within iCustom().