bool NeedReinit=false; int OnInit() { ReInit(); return(INIT_SUCCEEDED); } void ReInit() { //reinit code } int OnCalculate(const int rates_total, const int prev_calculated, const datetime &time[], const double &open[], const double &high[], const double &low[], const double &close[], const long &tick_volume[], const long &volume[], const int &spread[]) { if(NeedReinit) ReInit(); //indicator code return(0); }
Hi friends
sometimes my indicator get stuck and need to reinit it to show new arrows, how can i reinit my indicator automatically in sertain amount of peridos? is it possible using system32 dll? or any alternative approach?
https://www.mql5.com/en/docs/chart_operations/chartsetsymbolperiod
Note
The symbol/period change leads to the re-initialization of the Expert Advisor attached to a chart.
The call of ChartSetSymbolPeriod with the same symbol and timeframe can be used to update the chart (similar to the terminal's Refresh command). In its turn, the chart update triggers re-calculation of the indicators attached to it. Thus, you are able to calculate an indicator on the chart even if there are no ticks (e.g., on weekends).

- www.mql5.com
But the best way, if you have the code, is to fix your broken indicator. Are you really going to rely on a broken one for trading?
indicator is mine and coded by myself, when i use iMA with negative shift
iMA(NULL, PERIOD_CURRENT, (int)floor(period/2), -3, MODE_LWMA, 6, i)
like above example, is it repaint?
-
Why did you post your MT4 question in the MT5 General section instead of the MQL4 section, (bottom of the Root page?)
General rules and best pratices of the Forum. - General - MQL5 programming forum?
Next time post in the correct place. The moderators will likely move this thread there soon. - iMA doesn't repaint, it doesn't "get stuck."
- It is your i loop that is the problem. Post all relevant code if you want help.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi friends
sometimes my indicator get stuck and need to reinit it to show new arrows, how can i reinit my indicator automatically in sertain amount of peridos? is it possible using system32 dll? or any alternative approach?