Next I change period by calling SetSymbolPeriod() method.
If the change is for example from PERIOD_M1 to PERIOD_H1 and
back to PERIOD_M1 there is no problem.
But if the change is for example from PERIOD_H4 to PERIOD_MN1
and back to PERIOD_H4 indicator stops firing events. Method OnChartEvent() is
not called. When I by hand open from Indicator List properties for that custom
indicator and only click on OK – indicator starts firing events again (method OnChartEvent()
is called).
So the first solution I think would by refresh that
indicator. But I don’t know how to do it from code.
Or am I missing something?
Any help will be welcome!
bool CJFSnifferCore::InitViewCharts(void)
{
for(int i=0;i<PERIODS_IN_VIEW;i++)
{
if(m_view_charts[i].Open(SymbolName(0,true),v_viewOnePeriods[i])==0)
{
LOG(LOG_LEVEL_FATAL,"View chart not created");
return(false);
}
if((m_hViewIndis[i]=iCustom(SymbolName(0,true),v_viewOnePeriods[i],"joeef\\JFSniffer\\JFView",m_container_chart.ChartId()))==INVALID_HANDLE)
{
LOG(LOG_LEVEL_FATAL,"Error initializing JFView object");
return(false);
}
if(!m_view_charts[i].IndicatorAdd(0,m_hViewIndis[i]))
{
LOG(LOG_LEVEL_FATAL,"Add an indicator with the specified handle into a specified chart window fails");
return(false);
}
m_view_charts[i].Redraw();
}
//--- okreturn(true);
}
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
I open chart, add custom indicator.
Next I change period by calling SetSymbolPeriod() method.
If the change is for example from PERIOD_M1 to PERIOD_H1 and back to PERIOD_M1 there is no problem.
But if the change is for example from PERIOD_H4 to PERIOD_MN1 and back to PERIOD_H4 indicator stops firing events. Method OnChartEvent() is not called. When I by hand open from Indicator List properties for that custom indicator and only click on OK – indicator starts firing events again (method OnChartEvent() is called).
So the first solution I think would by refresh that indicator. But I don’t know how to do it from code.
Or am I missing something?
Any help will be welcome!