Multi Time Frame Compatible Simple Moving Average

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
Release Notes: added options in settings where you can turn on and turn off moving averages
Release Notes: Fixed miscalculation of the 5day MA
Release Notes: fixed 5 day MA miscalculation
Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.

Want to use this script on a chart?


Could someone please explain how to change the script if I'd like to hide all MAs on an intraday chart? Thank you,
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
@TraderAJL, I just updated my code. there was an updated version i forgot to publish.
+1 Reply
Thanks, how would I change it if I would like the 8MA displayed versus the 5MA?
to use exponential average. simply change "sma" into "ema"
@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
@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
Home Stock Screener Forex Screener Crypto Screener Economic Calendar About Chart Features Pricing Refer a friend House Rules Help Center Website & Broker Solutions Widgets Charting Solutions Lightweight Charting Library Blog & News Twitter
Profile Profile Settings Account and Billing Referred friends Coins My Support Tickets Help Center Private Messages Chat Sign Out