How to Force Run OnChartEvent.

 

good day. I have an indicator set on my Templates 
so I open another Chart using my EA, and I run 

      long chart_id = ChartOpen(_symbol, _period);
      if(chart_id == 0)
         return(ERR_CHART_NOT_FOUND);
      ChartSetInteger(ChartID(), CHART_BRING_TO_TOP, true);

so now my default template has my indicator attached. 
however, I want to run Onchart on my chart_id chart (recently opened chart

how can I make the Recently opened chart Run the OnChart code

 
Your topic has been moved to the section: Technical Indicators
Please consider which section is most appropriate — https://www.mql5.com/en/forum/172166/page6#comment_49114893
 
Fernando Carreiro #:
Your topic has been moved to the section: Technical Indicators
Please consider which section is most appropriate — https://www.mql5.com/en/forum/172166/page6#comment_49114893
Sorry bout that its thatci didnt know where to place it as I need the code inside EA,  but affects an indicator in another chart.where the EA is not placed.
 
Jefferson Judge Metha #Sorry bout that its thatci didnt know where to place it as I need the code inside EA,  but affects an indicator in another chart.where the EA is not placed.
Ok, I have moved into the section: Expert Advisors and Automated Trading
 
Jefferson Judge Metha:

good day. I have an indicator set on my Templates 
so I open another Chart using my EA, and I run 

so now my default template has my indicator attached. 
however, I want to run Onchart on my chart_id chart (recently opened chart

how can I make the Recently opened chart Run the OnChart code


Any OnChartEvent handling code will always run on the current chart on which the program was launched. You can't have it run on another chart.

For that, you will have to launch another program on that chart with its own OnChartEvent handler.

If you have an Indicator set as a template, then have that Indicator handle the OnChartEvent.