Need MT4 Indicator Programming Help

Hi, I’m not at all sure this is the right place for this, would be grateful if someone could help me out or point me in the right direction.

I’ve 99% completed a MT4 version of Mogalef Bands, but I’ve got problems with it updating incorrectly after a new candle is created. If anyone has development experience & would be able to help I’d greatly appreciate it - I’m sure it won’t take long and I intend to make the indicator freely available once working.

thanks in advance :slight_smile:

MQL4 has a function called IndicatorCounted() which tells you the number of bars on the chart not changed since the last tick (backwards as is common in MQL4). If you subtract that from the Bars variable, you know the number of bars to recalculate. For loading the indicator, this will be every bar. For a new bar, this will be 1 and if MT4 was shut down, it will be n bars. There is documentation that explains its use.

Actually I think I’ve nailed the problem - it was an error in the calculation of linear regression values.

The indicator is attached for anyone who might be interested. I’ve certainly found it a great help putting price action in context, but perhaps it just suits my trading style.

MogalefBands 4.zip (1.32 KB)