Indicator not updating with new candles


Hello everyone,

I found an MQL5 indicator however it has an issue, it doesn't update the values in the data window with new candles. I have a feeling this has to do with the for loop in OnCalculate() and I tried replacing it with

int from2=MathMax(0,prev_calculated-1);

for(int i=from2;i<rates_total;i++)

but it didn't fix the problem. I'm unsure what to do to amend this and therefore I would immensely appreciate guidance and help! I have attached the indicator file.

Many thanks!