Regarding moving average deviation Indicator

I want to understand how the moving average deviation Indicator is calculated.
it says the bar is green when asset price is rising and red when asset price is falling,
But when i look into the charts it doesn’t match.

Could you please share the formula how red and green bars are calculated or decided, as the above explanation is not matching with what i am seeing the in the charts where a red candle is also shown as green bar and vice versa.

Appreciate help on this as it is very confusing.
Complete formulas will be appreciated.