TradingView – Daily and Weekly Moving Averages on Daily Chart

Trading

For quick and clean charting I mainly use TradingView. I use multiple moving averages to see how a stock behaves and to find potential buy and sell areas.

But I find it a hassle to manage 6 different indicators on my chart.

Also if you are on the free plan you are limited to using 3 indicators simultanously. And you probably are using at least one of them for the trading volume.

So I looked into combining my moving averages into one indicator.

This helps me to quickly change my chart layout by hiding only one indicator and cleaning all the moving averages at once.

 

Here is an example of how it looks plotted on a daily chart from GOOGL.

On the left top side you can see that there are ony two indicators active.

And on the daily chart you see daily and weekly moving averages.

 

The moving averages I use on my charts

For the long term trend I use the 200 and 150 daily moving averages. The 200-day MA will be plotted as a black line. It is a no-go zone to buy anything trading below that.

The 150-day, or 30-week like Stan Weinstein uses, is plotted in orange.

Than I use the 50 day moving average but also the 10 week moving average. While those look similar there is a small difference which sometimes impacts the choice for selling a stock or holding on to it.

That slight difference is useful in different situations that’s why I want to have them both on my chart.

Both the 50-day and the 10-week are plotted as red lines on the chart. Since there’s only a small difference the same color gives a nicer view.

For shorter term trend I like to use the 20 and 10 day exponential moving averages. I tested these but also the commonly used 21, 9 and some other variations. But came to the conclusion that for me the 20EMA and 10EMA works best.

Both EMA’s are plotted in blue, where the 20EMA has a thicker line to easily see the difference.

 

The Daily and Weekly Moving Averages on Daily Chart script:

// Shows combined daily and weekly moving averages
// This will include the 200 day SMA, 150 day SMA, 50 day SMA, 10 Week SMA, 21 day EMA and 9 day EMA automatically on the charts.
// Moving Average time periods can be adjusted in the settings.

//@version=4
study("Daily and Weekly Moving Averages on Daily Chart", shorttitle="MA's", overlay=true)

// Take input for which daily SMAs to use
longSMAInput200 = input(title="Long Term Daily SMA", type=input.integer, minval=1, step=1, defval=200)
longSMAInput150 = input(title="Long Term Daily SMA", type=input.integer, minval=1, step=1, defval=150)
mediumSMAInput = input(title="Medium Term Daily SMA", type=input.integer, minval=1, step=1, defval=50)
mediumSMAInputW = input(title="Medium Term Weekly SMA", type=input.integer, minval=1, step=1, defval=10)
shortEMAInput20 = input(title="Short Term Daily EMA", type=input.integer, minval=1, step=1, defval=20)
shortEMAInput10 = input(title="Short Term Daily EMA", type=input.integer, minval=1, step=1, defval=10)

// Evaluate SMAs
longSMA200 = sma(close, longSMAInput200)
longSMA150 = sma(close, longSMAInput150)
mediumSMA = sma(close, mediumSMAInput)
mediumSMAW = sma(close, mediumSMAInputW)
shortEMA20 = ema(close, shortEMAInput20)
shortEMA10 = ema(close, shortEMAInput10)

// Grab the Daily SMAs for the ticker
plotLongSMA200 = security(syminfo.tickerid, 'D', longSMA200)
plotLongSMA150 = security(syminfo.tickerid, 'D', longSMA150)
plotMediumSMA = security(syminfo.tickerid, 'D', mediumSMA)
plotMediumSMAW = security(syminfo.tickerid, 'W', mediumSMAW)
plotShortEMA20 = security(syminfo.tickerid, 'D', shortEMA20)
plotShortEMA10 = security(syminfo.tickerid, 'D', shortEMA10)
// Plot the SMAs
plot(plotLongSMA200, linewidth=1, color=color.black, transp=25)
plot(plotLongSMA150, linewidth=1, color=color.orange, transp=25)
plot(plotMediumSMA, linewidth=1, color=color.red, transp=25)
plot(plotMediumSMAW, linewidth=2, color=color.red, transp=25)
plot(plotShortEMA20, linewidth=2, color=color.blue, transp=25)
plot(plotShortEMA10, linewidth=1, color=color.blue, transp=25)

 

How to manually add a script on Tradingview using Pine Editor

There a several option for adding a custom script to your chart layout.

Personally I prefer using the Pine Editor. Simply because that directly gives me the option to make any changes to the script that I want.

At the bottom of the chart you see the menu bar as shown here. Click on Pine Editor.

 

Now all you have to do is copy the script from this page and paste in the Pine Editor.

That will look like this:

 

On the right side of the top bar from the Pine Editor you see several options to do with your custom script.

Choose Add to chart for your script to be plotted on your chart and see how it looks like.

 

You can also choose to Save changes you made to the script for the current plot on the chart.

Maybe you want to change the colors of the Moving Averages for example. Than you can easily do that by just entering your preferred color and save the changes.

You can also change the Moving Average intervals if you prefer that. Or if you don’t want to use them all you can simply delete the ones you don’t need.

Just make sure you Save the changes once your happy with your script.

 

The last option is to pick Publish Script if you want make it available for yourself later on or share it publicly with others.

That is what I did off course to be able to share it easily with you.

 

Read below on how to add my published custom script to your chart.

 

How to add a script on Tradingview

I’ve published my script on Tradingview so you can easily add it to your charts.

You can find it here:
https://www.tradingview.com/script/kpFLxkxo-Daily-and-Weekly-Moving-Averages-on-Daily-Chart/

On that page you see the complete script again and how it is plotted on a chart as an example.

Scroll down and look for the blue block to add it to your favorite Tradingview indicators.

That option looks like this:

 

Click on the blue button Add to favorite indicators.

After clicking the button will change from adding the script to your favorite indicators to removing it from your favorite indicators.

For now you don’t want to do that off course.

 

The next step is adding the new favorite indicator to your charts.

First step is going to your advanced chart view.

Have a look at the top menu bar and look for the “Indicators” item. Click that.

 

It opens the pop up with all Indicators and Strategies that are available in Tradingview.

Here you can find all your favorites. These can be custom indicators like this multiple Moving Averages on a daily chart one.

But the favorite option also works for the built-in indicators offered by Tradingview. You can favorite those by clicking the star and those will show up in this pop-up as well for easy reference.

Now you can select the custom indicator and all the scripted moving averages will be shown on your chart.

This is also very useful if you’re on the free plan where you are limited to using a few indicators at a time. Now you have 6 moving averages on your chart using only one indicator spot.

 

Let’s have a look at your new chart layout with daily and weekly moving averages on the daily chart of Tesla.

 

Download the
CANSLIM Chart Book

Download the

CANSLIM Chart Book

Downloads

You have Successfully Subscribed!

Pin It on Pinterest

Share This