Hi! I am trying to calculate the SMA (simple moving average) of a Indicator.
Simple Moving Average is the sum of the closing prices divided by the period number.
Example SMA for 5 periods: (1.0399 + 1.0394 + 1.0387+ 1.09375 + 1.09382) / 5 = 1.0387
This is calculated automaticaly by the indicator.
I want to have a Simple Moving Avarage for a Indicator, for example Momentum. The calculus would be same same, but using Momentum data instead of price, so I can compare them.
Example SMA for 5 periods of Momentum Indicator: (100.2094 + 99.9420 + 99.0634 + 99.2944 + 99.4350) / 5 = 99.8884 - This would be the SMA that I wanted.
This way I can compare the SMA of the Indicator with the Indicator data itself.
What I currently have is:
Have 5 Variables (M1 to M5), each with a Candle ID (0, 1, 2, 3, 4) of the Momentum Indicator. Then use Formulas blocks to sum all variables and put on secondary variables so I can sum all of them:
M1 + M2 = T1
M3 + T1 = T2
M4 + T2 = T3
M5 + T3 = T4 (here I have all candles summed up)
Now divide T4 by 5 = SMA. This is the Simple Moving Average of the Indicator.
Now imagine I want a SMA of 9, 14 or 21 periods... it would be too much to do this way. Is there a better and simpler way to achieve this?
Thanks.