Professional Documents
Culture Documents
0 at
https://mozilla.org/MPL/2.0/
// © KaranVeer
//@version=4
//***************GUIDE***********************************
//CPR - Applicable only for daily pivots
//CPR - All 3 lines display enabled by default
//CPR - Central Pivot line display cannot changed
//CPR - Central Pivot is a blue line by default and can be changed from settings
//CPR - Top Range & Bottom Ranage display can be changed from settings
//CPR - Top Range & Bottom Ranage are Yellow lines by default and can be chaned
from settings
//Daily pivots - Pivot line and CPR Central line are same
//Daily pivots - level 1 & 2 (S1, R1, S2 R2) display enabled by default and can be
changed from settings
//Daily pivots - level 3 (S3 & R3) is availale and can be seleted from settings
//Daily pivots - Resistance(R) lines are Red lines and can be changed from settings
//Daily pivots - Support(S) lines are Green lines and can be changed from settings
//Weekly pivots - Pivot is a blue line by default and can be changed from settings
//Weekly pivots - 3 levels (S1, R1, S2, R2, S3 & R3) availale and can be seleted
from settings
//Weekly pivots - Resistance(R) lines are crossed (+) Red lines and can be changed
from settings
//Weekly pivots - Support(S) lines are crossed (+) Green lines and can be changed
from settings
//Monthly pivots - Pivot is a blue line by default and can be changed from settings
//Monthly pivots - 3 levels (S1, R1, S2, R2, S3 & R3) availale and can be seleted
from settings
//Monthly pivots - Resistance(R) lines are circled (o) Red lines and can be changed
from settings
//Monthly pivots - Support(S) lines are circled (o) Green lines and can be changed
from settings
//******************LOGICS**************************
//cenral pivot range
pivot = (high + low + close) /3 //Central Povit
BC = (high + low) / 2 //Below Central povit
TC = (pivot - BC) + pivot //Top Central povot
//3 highlows
PH = high
PL= low
DOPEN= open
dpclose= close
dprange= high - low
h1=dpclose + dprange*(1.1/12)
h2=dpclose + dprange*(1.1/6)
h3=dpclose + dprange*(1.1/4)
h4=dpclose + dprange*(1.1/2)
h5=(high/low)*dpclose
l1=dpclose - dprange*(1.1/12)
l2=dpclose - dprange*(1.1/6)
l3=dpclose - dprange*(1.1/4)
l4=dpclose - dprange*(1.1/2)
l5=dpclose - (h5-dpclose)
//Checkbox inputs
CPRPlot = input(title = "Plot CPR?", type=input.bool, defval=true)
DayS1R1 = input(title = "Plot Daiy S1/R1?", type=input.bool, defval=true)
DayS2R2 = input(title = "Plot Daiy S2/R2?", type=input.bool, defval=false)
DayS3R3 = input(title = "Plot Daiy S3/R3?", type=input.bool, defval=false)
WeeklyPivotInclude = input(title = "Plot Weekly Pivot?", type=input.bool,
defval=false)
WeeklyS1R1 = input(title = "Plot weekly S1/R1?", type=input.bool, defval=false)
WeeklyS2R2 = input(title = "Plot weekly S2/R2?", type=input.bool, defval=false)
WeeklyS3R3 = input(title = "Plot weekly S3/R3?", type=input.bool, defval=false)
MonthlyPivotInclude = input(title = "Plot Monthly Pivot?", type=input.bool,
defval=false)
MonthlyS1R1 = input(title = "Plot Monthly S1/R1?", type=input.bool, defval=false)
DayPHPL = input(title = "Plot Daily PH/PL?", type=input.bool, defval=false)
WeeklyPHPL = input(title = "Plot weekly PH/PL?", type=input.bool, defval=true)
MonthlyPHPL = input(title = "Plot Monthly PH/PL?", type=input.bool, defval=false)
CamarillaS3R3 = input(title= "Plot Camarilla S3/R3?", type=input.bool,
defval=false)
//******************WEEKLY PIVOTS**************************
//******************MONTHLY PIVOTS**************************
//*****************************INDICATORs**************************
//SMA
PlotSMA = input(title = "Plot SMA?", type=input.bool, defval=true)
SMALength = input(title="SMA Length", type=input.integer, defval=20)
SMASource = input(title="SMA Source", type=input.source, defval=close)
SMAAvg = sma (SMASource, SMALength)
plot(PlotSMA ? SMAAvg : na, color= color.aqua,linewidth = 2, title="SMA")
//SMA
PlotSMA2 = input(title = "Plot SMA2?", type=input.bool, defval=true)
SMA2Length = input(title="SMA2 Length", type=input.integer, defval=50)
SMA2Source = input(title="SMA2 Source", type=input.source, defval=close)
SMA2Avg = sma (SMA2Source, SMA2Length)
plot(PlotSMA2 ? SMA2Avg : na, color= color.orange,linewidth = 2, title="SMA2")
//EMA
PlotEMA = input(title = "Plot EMA?", type=input.bool, defval=true)
EMALength = input(title="EMA Length", type=input.integer, defval=20)
EMASource = input(title="EMA Source", type=input.source, defval=close)
EMAvg = ema (EMASource, EMALength)
plot(PlotEMA ? EMAvg : na, color= color.black, linewidth = 2, title="EMA")
//SuperTrend
PlotSTrend = input(title = "Plot Super Trend?", type=input.bool, defval=true)
InputFactor=input(3, minval=1,maxval = 100, title="Factor")
InputLength=input(7, minval=1,maxval = 100, title="Lenght")
BasicUpperBand=hl2-(InputFactor*atr(InputLength))
BasicLowerBand=hl2+(InputFactor*atr(InputLength))
FinalUpperBand=1.0
FinalLowerBand=1.0
FinalUpperBand:=close[1]>FinalUpperBand[1]? max(BasicUpperBand,FinalUpperBand[1]) :
BasicUpperBand
FinalLowerBand:=close[1]<FinalLowerBand[1]? min(BasicLowerBand,FinalLowerBand[1]) :
BasicLowerBand
IsTrend=0.0
IsTrend:= close > FinalLowerBand[1] ? 1: close< FinalUpperBand[1]? -1:
nz(IsTrend[1],1)
STrendline = IsTrend==1? FinalUpperBand: FinalLowerBand
linecolor = IsTrend == 1 ? color.green : color.red
Plotline = (PlotSTrend? STrendline: na)
plot(Plotline, color = linecolor , style = plot.style_line , linewidth = 2,title =
"SuperTrend")
PlotShapeUp = cross(close,STrendline) and close>STrendline
PlotShapeDown = cross(STrendline,close) and close<STrendline
plotshape(PlotSTrend? PlotShapeUp: na, "Up Arrow",
shape.triangleup,location.belowbar,color.green,0,0)
plotshape(PlotSTrend? PlotShapeDown: na , "Down Arrow", shape.triangledown ,
location.abovebar, color.red,0,0)