CPR with SMA, EMA, VWAP & Super Trend by GuruprasadMeduri

This script will allow to add CPR with Standard Pivots and 4 Indicators.

Standard Pivot has 9 levels of support and 9 levels of resistance lines. It has CPR , 3 levels of Day-wise pivots , 3 levels of Weekly pivots and 3 Levels of Monthly Pivots .
In Addition to the CPR and Pivot , this script will allow user to Add 4 more Indicators - SMA , EMA , VWAP and SuperTrend as well.

All the Support and resistance levels can be enabled / disabled from settings. It will allow to select multiple combinations of support and resistance levels across 3 levels at any of the 3 time-frames individually and combined.
All 4 Indicators can be can be enabled / disabled from settings. This will allow the indicators to be plotted individually and combined along with any combination of CPR & Pivots .

These number of combinations will allow user to visualize the charts with desired indicators, pivot support & resistance levels on all or any of the 3 time frames.

For Ease of access, listed few points on how the script works..

- CPR and day-wise level 1 & 2 (S1 & R1) enabled by default and can be changed from settings
- Day-wise Level 2 & 3 (S2, R2, S3 & L3) can be enabled from settings
- Weekly 3 levels and Monthly 3 levels can be enabled from settings
- CPR & pivot levels colored in blue lines
- All support levels colored in Green
- All resistance levels Colored in Red
- Day-wise pivot , support & resistance are straight lines
- Weekly pivot , support & resistance are cross (+) lines
- Weekly pivot , support & resistance are circle (o) lines
- SMA , EMA , VWAP and SuperTrend Enabled by Default
- SMA Colored in Orange
- EMA Colored in Red
- EMA Colored in Teal
- SuperTrend Colored in standard Red & Green with triangle arrows
- Any combinations can be selected from settings-> Inputs & style
Release Notes: Corrected EMA
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?


Nice Work
Can you also add day high low & previous (D/W/M) low high to this ??
+21 Reply
rcp4989 dotradingwithtrend
@dotradingwithtrend, yes its also better to understand previous day activity on same day chart.
if you add PDL, PDH, WL and WH then it is complete script
+13 Reply
Its great combination Guru ! I am using this CPR for long and was looking at the CPR+VWAP+ST+At least 2 MA. Its good. Just a suggestion, with CPR , along with current/today's
1. Can you also inject previous (D/W/M) levels - its missing but is important
2. Similarly, if you can also inject for RSI and Volume with MA (configurable) at the bottom ribbon , then all these would be a lethal combo ..

Thanks for understanding. regards.
+8 Reply
Guru prasad garu
Thank you for indicator if Low & High of Day are added which be of great help
+3 Reply
Hi Sir,

Thanks for the wonderful script. Few issues observed. Can you please look into and update?
1. EMA is not respecting the length input given and picking the SMA length. May be due to "EMAvg = ema (SMASource, SMALength)". I do not know to code but able to read and take some understandings.

PlotEMA = input(title = "Plot EMA?", type=input.bool, defval=true)
EMALength = input(title="EMA Length", type=input.integer, defval=50)
EMASource = input(title="EMA Source", type=input.source, defval=close)
EMAvg = ema (SMASource, SMALength)

2. CPR calculation is giving difference when I do manual calculation to test. Observed the difference in all stocks (NIFTY) checked. Can you please look into? As per my understanding on CPR Pivot, it should be same through out based on last trading day's High, Low and Close. Not sure whether your script picking current day instead of keeping it fixed based on previous day. Kindly check it.

Thank you.
+3 Reply
@IdeasSJ, Thank you very much for your feedback.

1. EAM - that was a mistake and you pointed out the exact mistake. Corrected now. Thank you very much!
2. CPR is based on Last trading day HLC. I tried to plot over the CPRs developed by other Script developers on a static chart and it exactly matched. I will try to check this in a live session. There should not be a difference!

+3 Reply
IdeasSJ GuruprasadMeduri
@GuruprasadMeduri, Thank you. I may be wrong on CPR as I am not regular in stock market or TradingView. Out of curiosity when I looked into the CPR formulas manually and also validated by cross checking through another developer script named "CPR by KGS - GOMATHI SANKAR", I could find the real difference and notified you. So please check the values. If right, I am sorry and it may be due to my inexperience.
+10 Reply
Can you please updated one code in supertrend for indicator time Frame?

So we can use any time frame supertrend on any time frame like on 5min we can use 15 min time frame.
Fantastic Guru Sir you have put lot of efforts and time it is highly appreciable this is wonderful indicator badly required by day traders, can I humbly request you to add ORB (5/15 Mnts) it would become a very remarkable indicator and a strategy needed in Indian Market against these Algo players.
Thankyou Sir God Bless you with Good wealth, Health and Happiness in life
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