TradingView
drshoe
11. Okt. 2016 18:25

Multi Time Frame Compatible Simple Moving Average 

SPDR S&P 500 ETF TRUSTArca

Beschreibung

Displays 5, 20, 50, and 200 days moving averages on any chart regardless of the chart's resolution.It makes sure you see the same moving average regardless the resolution of your chart or your timeframe

Versionshinweise

added options in settings where you can turn on and turn off moving averages

Versionshinweise

Fixed miscalculation of the 5day MA

Versionshinweise

fixed 5 day MA miscalculation
Kommentare
csamsojo
Could someone please explain how to change the script if I'd like to hide all MAs on an intraday chart? Thank you,
TraderAJL
Do you know of a way to only show certain moving averages by time frame. For instance if I am in the daily I want to see , 10, 20, 50 etc., but if I am in the weekly timeframe, only the 50 day and 200 day .... ? Thank you in advance
drshoe
@TraderAJL, I just updated my code. there was an updated version i forgot to publish.
TraderAJL
Thanks, how would I change it if I would like the 8MA displayed versus the 5MA?
drshoe
to use exponential average. simply change "sma" into "ema"
TraderAJL
@drshoe, Thank you. how would I have to recalculate res5 to display 8 instead of a 5 day average? I have difficulties understanding this part. Thank you
drshoe
@TraderAJL, good catch!, the MA5 is actually NOT correct, it should be 390/30*5 = 65. so for 8 day MA it should be 390/30*8 = 104. I've updated the code
Mehr