1Copy the scriptPress Copy script above, or the copy button on the code below.
2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
3Paste over the templateCreate a new indicator, select all of the template text and paste. Press Save and give it a name.
4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.
Source Code
382 lines of Pine Script v4 from pivots.pine, published under MIT. Keep the author's credit and licence lines when you reuse it.
pivots.pine
//@version=4
study("Camarilla Pivots + CPR [AIO]", overlay = true)
showlast = input(title = "[Camarilla] Hide Previous", defval = true)
showlabels = input(title = "[Camarilla] Show Labels", defval = true)
lstyle = input(title = "Line Style", options = ['Solid', 'Circles', 'Cross'], defval ='Solid')
showMonthly = input(title="[Camarilla] Show Monthly", defval=true)
showMonthlyMinors = input(title="[Camarilla] Show Monthly L1H1-L2H2", defval=false)
monthlyWidth = input(title="[Camarilla] Monthly Width", defval=1)
showYearly = input(title="[Camarilla] Show Yearly", defval=true)
showYearlyMinors = input(title="[Camarilla] Show Yearly L1H1-L2H2", defval=false)
yearlyWidth = input(title="[Camarilla] Yearly Width", defval=1)
showWeekly = input(title="[Camarilla] Show Weekly", defval=true)
showWeeklyMinors = input(title="[Camarilla] Show Weekly L1H1-L2H2", defval=false)
weeklyWidth = input(title="[Camarilla] Weekly Width", defval=1)
showDaily = input(title="[Camarilla] Show Daily", defval=true)
dailyWidth = input(title="[Camarilla] Daily Width", defval=1)
// Line Style
camLineStyle = lstyle == 'Solid' ? plot.style_line :
lstyle == 'Circles' ? plot.style_circles : plot.style_cross
label_offset = time - time[1]
label_offset := change(label_offset) > 0 ? label_offset[1] : label_offset
// Main Camarilla function
getData(t) =>
highhtf = security(syminfo.tickerid, t, high[1], lookahead = barmerge.lookahead_on)
lowhtf = security(syminfo.tickerid, t, low[1], lookahead = barmerge.lookahead_on)
closehtf = security(syminfo.tickerid, t, close[1], lookahead = barmerge.lookahead_on)
range = highhtf - lowhtf
islast = showlast ? security(syminfo.tickerid, t, barstate.islast, lookahead = true) : true
H4 = closehtf + range * 1.1/2
H3 = closehtf + range * 1.1/4
H2 = closehtf + range * 1.1/6
H1 = closehtf + range * 1.1/12
L1 = closehtf - range * 1.1/12
L2 = closehtf - range * 1.1/6
L3 = closehtf - range * 1.1/4
L4 = closehtf - range * 1.1/2
H6 = (highhtf/lowhtf) * closehtf
H5 = H4 + 1.168 * (H4 - H3)
L5 = L4 - 1.168 * (L3 - L4)
L6 = closehtf - (H6 - closehtf)
[islast, H6, H5, H4, H3, H2, H1, L1, L2, L3, L4, L5, L6]
// Monthly Pivots
[mIsLast, mH6, mH5, mH4, mH3, mH2, mH1, mL1, mL2, mL3, mL4, mL5, mL6] = getData("M")
//color.red
plot(showMonthly and mIsLast ? mH6 : na, title = "Monthly H6", color = color.red, linewidth = monthlyWidth, style = camLineStyle, transp = 0)
plot(showMonthly and mIsLast ? mH5 : na, title = "Monthly H5", color = color.red, linewidth = monthlyWidth, style = camLineStyle, transp = 0)
plot(showMonthly and mIsLast ? mH4 : na, title = "Monthly H4", color = color.red, linewidth = monthlyWidth, style = camLineStyle, transp = 0)
plot(showMonthly and mIsLast ? mH3 : na, title = "Monthly H3", color = color.red, linewidth = monthlyWidth, style = camLineStyle, transp = 0)
plot(showMonthly and mIsLast ? mL3 : na, title = "Monthly L3", color = color.red, linewidth = monthlyWidth, style = camLineStyle, transp = 0)
plot(showMonthly and mIsLast ? mL4 : na, title = "Monthly L4", color = color.red, linewidth = monthlyWidth, style = camLineStyle, transp = 0)
plot(showMonthly and mIsLast ? mL5 : na, title = "Monthly L5", color = color.red, linewidth = monthlyWidth, style = camLineStyle, transp = 0)
plot(showMonthly and mIsLast ? mL6 : na, title = "Monthly L6", color = color.red, linewidth = monthlyWidth, style = camLineStyle, transp = 0)
plot(showMonthly and showMonthlyMinors and mIsLast ? mL1 : na, title = "Monthly L1", color = color.red, linewidth = monthlyWidth, style = camLineStyle, transp = 60)
plot(showMonthly and showMonthlyMinors and mIsLast ? mL2 : na, title = "Monthly L2", color = color.red, linewidth = monthlyWidth, style = camLineStyle, transp = 60)
plot(showMonthly and showMonthlyMinors and mIsLast ? mH1 : na, title = "Monthly H1", color = color.red, linewidth = monthlyWidth, style = camLineStyle, transp = 60)
plot(showMonthly and showMonthlyMinors and mIsLast ? mH2 : na, title = "Monthly H2", color = color.red, linewidth = monthlyWidth, style = camLineStyle, transp = 60)
// Weekly Pivots
[ wIsLast, wH6, wH5, wH4, wH3, wH2, wH1, wL1, wL2, wL3, wL4, wL5, wL6] = getData("W")
plot(showWeekly and wIsLast ? wH6 : na, title = "Weekly H6", color = #873dff, linewidth = weeklyWidth, style = camLineStyle, transp = 0)
plot(showWeekly and wIsLast ? wH5 : na, title = "Weekly H5", color = #873dff, linewidth = weeklyWidth, style = camLineStyle, transp = 0)
plot(showWeekly and wIsLast ? wH4 : na, title = "Weekly H4", color = #873dff, linewidth = weeklyWidth, style = camLineStyle, transp = 0)
plot(showWeekly and wIsLast ? wH3 : na, title = "Weekly H3", color = #873dff, linewidth = weeklyWidth, style = camLineStyle, transp = 0)
plot(showWeekly and wIsLast ? wL3 : na, title = "Weekly L3", color = #873dff, linewidth = weeklyWidth, style = camLineStyle, transp = 0)
plot(showWeekly and wIsLast ? wL4 : na, title = "Weekly L4", color = #873dff, linewidth = weeklyWidth, style = camLineStyle, transp = 0)
plot(showWeekly and wIsLast ? wL5 : na, title = "Weekly L5", color = #873dff, linewidth = weeklyWidth, style = camLineStyle, transp = 0)
plot(showWeekly and wIsLast ? wL6 : na, title = "Weekly L6", color = #873dff, linewidth = weeklyWidth, style = camLineStyle, transp = 0)
plot(showWeekly and showWeeklyMinors and wIsLast ? wL1 : na, title = "Weekly L1", color = #873dff, linewidth = weeklyWidth, style = camLineStyle, transp = 60)
plot(showWeekly and showWeeklyMinors and wIsLast ? wL2 : na, title = "Weekly L2", color = #873dff, linewidth = weeklyWidth, style = camLineStyle, transp = 60)
plot(showWeekly and showWeeklyMinors and wIsLast ? wH1 : na, title = "Weekly H1", color = #873dff, linewidth = weeklyWidth, style = camLineStyle, transp = 60)
plot(showWeekly and showWeeklyMinors and wIsLast ? wH2 : na, title = "Weekly H2", color = #873dff, linewidth = weeklyWidth, style = camLineStyle, transp = 60)
// Yearly Pivots
[yIsLast, yH6, yH5, yH4, yH3, yH2, yH1, yL1, yL2, yL3, yL4, yL5, yL6] = getData("12M")
plot(showYearly and yIsLast ? yH6 : na, title = "Yearly H6", color = color.orange, linewidth = yearlyWidth, style = camLineStyle, transp = 0)
plot(showYearly and yIsLast ? yH5 : na, title = "Yearly H5", color = color.orange, linewidth = yearlyWidth, style = camLineStyle, transp = 0)
plot(showYearly and yIsLast ? yH4 : na, title = "Yearly H4", color = color.orange, linewidth = yearlyWidth, style = camLineStyle, transp = 0)
plot(showYearly and yIsLast ? yH3 : na, title = "Yearly H3", color = color.orange, linewidth = yearlyWidth, style = camLineStyle, transp = 0)
plot(showYearly and yIsLast ? yL3 : na, title = "Yearly L3", color = color.orange, linewidth = yearlyWidth, style = camLineStyle, transp = 0)
plot(showYearly and yIsLast ? yL4 : na, title = "Yearly L4", color = color.orange, linewidth = yearlyWidth, style = camLineStyle, transp = 0)
plot(showYearly and yIsLast ? yL5 : na, title = "Yearly L5", color = color.orange, linewidth = yearlyWidth, style = camLineStyle, transp = 0)
plot(showYearly and yIsLast ? yL6 : na, title = "Yearly L6", color = color.orange, linewidth = yearlyWidth, style = camLineStyle, transp = 0)
plot(showYearly and showYearlyMinors and yIsLast ? yL1 : na, title = "Yearly L1", color = color.orange, linewidth = yearlyWidth, style = camLineStyle, transp = 60)
plot(showYearly and showYearlyMinors and yIsLast ? yL2 : na, title = "Yearly L2", color = color.orange, linewidth = yearlyWidth, style = camLineStyle, transp = 60)
plot(showYearly and showYearlyMinors and yIsLast ? yH1 : na, title = "Yearly H1", color = color.orange, linewidth = yearlyWidth, style = camLineStyle, transp = 60)
plot(showYearly and showYearlyMinors and yIsLast ? yH2 : na, title = "Yearly H2", color = color.orange, linewidth = yearlyWidth, style = camLineStyle, transp = 60)
// Daily Pivots
[dIsLast, dH6, dH5, dH4, dH3, dH2, dH1, dL1, dL2, dL3, dL4, dL5, dL6] = getData("D")
plot(showDaily and dIsLast ? dH6 : na, title = "Daily H6", color = color.silver, linewidth = dailyWidth, style = camLineStyle, transp = 0)
plot(showDaily and dIsLast ? dH5 : na, title = "Daily H5", color = color.silver, linewidth = dailyWidth, style = camLineStyle, transp = 0)
plot(showDaily and dIsLast ? dH4 : na, title = "Daily H4", color = color.silver, linewidth = dailyWidth, style = camLineStyle, transp = 0)
plot(showDaily and dIsLast ? dH3 : na, title = "Daily H3", color = color.silver, linewidth = dailyWidth, style = camLineStyle, transp = 0)
plot(showDaily and dIsLast ? dL3 : na, title = "Daily L3", color = color.silver, linewidth = dailyWidth, style = camLineStyle, transp = 0)
plot(showDaily and dIsLast ? dL4 : na, title = "Daily L4", color = color.silver, linewidth = dailyWidth, style = camLineStyle, transp = 0)
plot(showDaily and dIsLast ? dL5 : na, title = "Daily L5", color = color.silver, linewidth = dailyWidth, style = camLineStyle, transp = 0)
plot(showDaily and dIsLast ? dL6 : na, title = "Daily L6", color = color.silver, linewidth = dailyWidth, style = camLineStyle, transp = 0)
if showlabels
// Monthly Labels
if (showMonthly)
var label ms3label = na, var label ms4label = na, var label ms5label = na
var label mr3label = na, var label mr4label = na, var label mr5label = na
var label mr1label = na, var label mr2label = na, var label ms1label = na, var label ms2label = na, var label ms6label = na, var label mr6label = na
label.delete(ms3label), label.delete(ms4label), label.delete(ms5label), label.delete(ms6label)
label.delete(mr3label), label.delete(mr4label), label.delete(mr5label), label.delete(mr6label)
label.delete(ms1label), label.delete(ms2label), label.delete(mr1label), label.delete(mr2label)
ms6label := label.new(x = time + label_offset * 30, y = mL6, text = "L6 " + tostring(round(mL6)),size=size.small,textcolor=color.red, style=label.style_none, xloc = xloc.bar_time, yloc=yloc.price)
ms3label := label.new(x = time + label_offset * 30, y = mL3, text = "L3 " + tostring(round(mL3)),size=size.small,textcolor=color.red, style=label.style_none, xloc = xloc.bar_time, yloc=yloc.price)
ms4label := label.new(x = time + label_offset * 30, y = mL4, text = "L4 " + tostring(round(mL4)), size=size.small,textcolor=color.red, style=label.style_none, xloc = xloc.bar_time, yloc=yloc.price)
ms5label := label.new(x = time + label_offset * 30, y = mL5, text = "L5 " + tostring(round(mL5)), size=size.small,textcolor=color.red, style=label.style_none, xloc = xloc.bar_time, yloc=yloc.price)
mr3label := label.new(x = time + label_offset * 30, y = mH3, text = "H3 " + tostring(round(mH3)), size=size.small,textcolor=color.red, style=label.style_none, xloc = xloc.bar_time, yloc=yloc.price)
mr4label := label.new(x = time + label_offset * 30, y = mH4, text = "H4 " + tostring(round(mH4)), size=size.small,textcolor=color.red, style=label.style_none, xloc = xloc.bar_time, yloc=yloc.price)
mr5label := label.new(x = time + label_offset * 30, y = mH5, text = "H5 " + tostring(round(mH5)), size=size.small,textcolor=color.red, style=label.style_none, xloc = xloc.bar_time, yloc=yloc.price)
mr6label := label.new(x = time + label_offset * 30, y = mH6, text = "H6 " + tostring(round(mH6)), size=size.small,textcolor=color.red, style=label.style_none, xloc = xloc.bar_time, yloc=yloc.price)
if (showMonthlyMinors)
mr1label := label.new(x = time + label_offset * 30, y = mH1, text = "H1 " + tostring(round(mH1)), size=size.small,textcolor=color.red, style=label.style_none, xloc = xloc.bar_time, yloc=yloc.price)
mr2label := label.new(x = time + label_offset * 30, y = mH2, text = "H2 " + tostring(round(mH2)), size=size.small,textcolor=color.red, style=label.style_none, xloc = xloc.bar_time, yloc=yloc.price)
ms1label := label.new(x = time + label_offset * 30, y = mL1, text = "L1 " + tostring(round(mL1)), size=size.small,textcolor=color.red, style=label.style_none, xloc = xloc.bar_time, yloc=yloc.price)
ms2label := label.new(x = time + label_offset * 30, y = mL2, text = "L2 " + tostring(round(mL2)), size=size.small,textcolor=color.red, style=label.style_none, xloc = xloc.bar_time, yloc=yloc.price)
// Weekly Labels
if (showWeekly)
var label ws3label = na, var label ws4label = na, var label ws5label = na
var label wr3label = na, var label wr4label = na, var label wr5label = na, var label ws6label = na, var label wr6label = na
var label wr1label = na, var label wr2label = na, var label ws1label = na, var label ws2label = na
label.delete(ws3label), label.delete(ws4label), label.delete(ws5label)
label.delete(wr3label), label.delete(wr4label), label.delete(wr5label), label.delete(wr6label), label.delete(ws6label)
label.delete(ws1label), label.delete(ws2label), label.delete(wr1label), label.delete(wr2label)
ws3label := label.new(x = time + label_offset * 40, y = wL3, text = "L3 " + tostring(round(wL3)),size=size.small,textcolor=#873dff, style=label.style_none, xloc = xloc.bar_time, yloc=yloc.price)
ws4label := label.new(x = time + label_offset * 40, y = wL4, text = "L4 " + tostring(round(wL4)), size=size.small,textcolor=#873dff, style=label.style_none, xloc = xloc.bar_time, yloc=yloc.price)
ws5label := label.new(x = time + label_offset * 40, y = wL5, text = "L5 " + tostring(round(wL5)), size=size.small,textcolor=#873dff, style=label.style_none, xloc = xloc.bar_time, yloc=yloc.price)
wr3label := label.new(x = time + label_offset * 40, y = wH3, text = "H3 " + tostring(round(wH3)), size=size.small,textcolor=#873dff, style=label.style_none, xloc = xloc.bar_time, yloc=yloc.price)
wr4label := label.new(x = time + label_offset * 40, y = wH4, text = "H4 " + tostring(round(wH4)), size=size.small,textcolor=#873dff, style=label.style_none, xloc = xloc.bar_time, yloc=yloc.price)
wr5label := label.new(x = time + label_offset * 40, y = wH5, text = "H5 " + tostring(round(wH5)), size=size.small,textcolor=#873dff, style=label.style_none, xloc = xloc.bar_time, yloc=yloc.price)
ws6label := label.new(x = time + label_offset * 40, y = wL6, text = "L6 " + tostring(round(wL6)), size=size.small,textcolor=#873dff, style=label.style_none, xloc = xloc.bar_time, yloc=yloc.price)
wr6label := label.new(x = time + label_offset * 40, y = wH6, text = "H6 " + tostring(round(wH6)), size=size.small,textcolor=#873dff, style=label.style_none, xloc = xloc.bar_time, yloc=yloc.price)
if (showWeeklyMinors)
wr1label := label.new(x = time + label_offset * 40, y = wH1, text = "H1 " + tostring(round(wH1)), size=size.small,textcolor=#873dff, style=label.style_none, xloc = xloc.bar_time, yloc=yloc.price)
wr2label := label.new(x = time + label_offset * 40, y = wH2, text = "H2 " + tostring(round(wH2)), size=size.small,textcolor=#873dff, style=label.style_none, xloc = xloc.bar_time, yloc=yloc.price)
ws1label := label.new(x = time + label_offset * 40, y = wL1, text = "L1 " + tostring(round(wL1)), size=size.small,textcolor=#873dff, style=label.style_none, xloc = xloc.bar_time, yloc=yloc.price)
ws2label := label.new(x = time + label_offset * 40, y = wL2, text = "L2 " + tostring(round(wL2)), size=size.small,textcolor=#873dff, style=label.style_none, xloc = xloc.bar_time, yloc=yloc.price)
// Yearly Labels
if (showYearly)
var label ys3label = na, var label ys4label = na, var label ys5label = na
var label yr3label = na, var label yr4label = na, var label yr5label = na, var label ys6label = na, var label yr6label = na
var label yr1label = na, var label yr2label = na, var label ys1label = na, var label ys2label = na
label.delete(ys3label), label.delete(ys4label), label.delete(ys5label)
label.delete(yr3label), label.delete(yr4label), label.delete(yr5label)
label.delete(ys1label), label.delete(ys2label), label.delete(yr1label), label.delete(yr2label), label.delete(ys6label), label.delete(yr6label)
ys3label := label.new(x = time + label_offset * 50, y = yL3, text = "L3 " + tostring(round(yL3)),size=size.small,textcolor=color.orange, style=label.style_none, xloc = xloc.bar_time, yloc=yloc.price)
ys4label := label.new(x = time + label_offset * 50, y = yL4, text = "L4 " + tostring(round(yL4)), size=size.small,textcolor=color.orange, style=label.style_none, xloc = xloc.bar_time, yloc=yloc.price)
ys5label := label.new(x = time + label_offset * 50, y = yL5, text = "L5 " + tostring(round(yL5)), size=size.small,textcolor=color.orange, style=label.style_none, xloc = xloc.bar_time, yloc=yloc.price)
yr3label := label.new(x = time + label_offset * 50, y = yH3, text = "H3 " + tostring(round(yH3)), size=size.small,textcolor=color.orange, style=label.style_none, xloc = xloc.bar_time, yloc=yloc.price)
yr4label := label.new(x = time + label_offset * 50, y = yH4, text = "H4 " + tostring(round(yH4)), size=size.small,textcolor=color.orange, style=label.style_none, xloc = xloc.bar_time, yloc=yloc.price)
yr5label := label.new(x = time + label_offset * 50, y = yH5, text = "H5 " + tostring(round(yH5)), size=size.small,textcolor=color.orange, style=label.style_none, xloc = xloc.bar_time, yloc=yloc.price)
yr6label := label.new(x = time + label_offset * 50, y = yH6, text = "H6 " + tostring(round(yH6)), size=size.small,textcolor=color.orange, style=label.style_none, xloc = xloc.bar_time, yloc=yloc.price)
ys6label := label.new(x = time + label_offset * 50, y = yL6, text = "L6 " + tostring(round(yL6)), size=size.small,textcolor=color.orange, style=label.style_none, xloc = xloc.bar_time, yloc=yloc.price)
if (showYearlyMinors)
yr1label := label.new(x = time + label_offset * 50, y = yH1, text = "H1 " + tostring(round(yH1)), size=size.small,textcolor=color.orange, style=label.style_none, xloc = xloc.bar_time, yloc=yloc.price)
yr2label := label.new(x = time + label_offset * 50, y = yH2, text = "H2 " + tostring(round(yH2)), size=size.small,textcolor=color.orange, style=label.style_none, xloc = xloc.bar_time, yloc=yloc.price)
ys1label := label.new(x = time + label_offset * 50, y = yL1, text = "L1 " + tostring(round(yL1)), size=size.small,textcolor=color.orange, style=label.style_none, xloc = xloc.bar_time, yloc=yloc.price)
ys2label := label.new(x = time + label_offset * 50, y = yL2, text = "L2 " + tostring(round(yL2)), size=size.small,textcolor=color.orange, style=label.style_none, xloc = xloc.bar_time, yloc=yloc.price)
// Daily Labels
if (showDaily)
var label ds3label = na, var label ds4label = na, var label ds5label = na
var label dr3label = na, var label dr4label = na, var label dr5label = na
var label dr1label = na, var label dr2label = na, var label ds1label = na, var label ds2label = na, var label ds6label = na, var label dr6label = na
label.delete(ds3label), label.delete(ds4label), label.delete(ds5label)
label.delete(dr3label), label.delete(dr4label), label.delete(dr5label)
label.delete(ds1label), label.delete(ds2label), label.delete(dr1label), label.delete(dr2label), label.delete(dr6label), label.delete(ds6label)
ds3label := label.new(x = time + label_offset * 60, y = dL3, text = "L3 " + tostring(round(dL3)),size=size.small,textcolor=color.silver, style=label.style_none, xloc = xloc.bar_time, yloc=yloc.price)
ds4label := label.new(x = time + label_offset * 60, y = dL4, text = "L4 " + tostring(round(dL4)), size=size.small,textcolor=color.silver, style=label.style_none, xloc = xloc.bar_time, yloc=yloc.price)
ds5label := label.new(x = time + label_offset * 60, y = dL5, text = "L5 " + tostring(round(dL5)), size=size.small,textcolor=color.silver, style=label.style_none, xloc = xloc.bar_time, yloc=yloc.price)
dr3label := label.new(x = time + label_offset * 60, y = dH3, text = "H3 " + tostring(round(dH3)), size=size.small,textcolor=color.silver, style=label.style_none, xloc = xloc.bar_time, yloc=yloc.price)
dr4label := label.new(x = time + label_offset * 60, y = dH4, text = "H4 " + tostring(round(dH4)), size=size.small,textcolor=color.silver, style=label.style_none, xloc = xloc.bar_time, yloc=yloc.price)
dr5label := label.new(x = time + label_offset * 60, y = dH5, text = "H5 " + tostring(round(dH5)), size=size.small,textcolor=color.silver, style=label.style_none, xloc = xloc.bar_time, yloc=yloc.price)
dr6label := label.new(x = time + label_offset * 60, y = dH6, text = "H6 " + tostring(round(dH6)), size=size.small,textcolor=color.silver, style=label.style_none, xloc = xloc.bar_time, yloc=yloc.price)
ds6label := label.new(x = time + label_offset * 60, y = dL6, text = "L6 " + tostring(round(dL6)), size=size.small,textcolor=color.silver, style=label.style_none, xloc = xloc.bar_time, yloc=yloc.price)
//////////
// CPR //
//////////
// Daily CPR Config
dDummy21 = input(title="==============================", defval=true)
dDummy = input(title="====== DAILY PIVOTS CPR ======", defval=true)
dDummy24 = input(title="==============================", defval=true)
bEnableDailyPivots = input(title="Show Daily CPR", defval=true)
dailyShowPrevious = input(title="Show Previous", defval=false)
bEnableDailyHighLow = input(title="Show High and Low", defval=true)
bEnableDailyLabels = input(title="Show Label", defval=true)
dailyPivotsWidth = input(title="Width", defval=1, minval=1, step=1)
// Weekly CPR Config
wDummy21 = input(title="==============================", defval=true)
wDummy = input(title="====== WEEKLY CPR ======", defval=true)
wDummy24 = input(title="==============================", defval=true)
bEnableWeeklyPivots = input(title="Show Weekly CPR", defval=true)
weeklyShowPrevious = input(title="Show Previous", defval=false)
bEnableWeeklyHighLow = input(title="Show High and Low", defval=true)
bEnableWeeklyLabels = input(title="Show Label", defval=true)
weeklyPivotsWidth = input(title="Width", defval=1, minval=1, step=1)
// Monthly Config
mDummy21 = input(title="==============================", defval=true)
mDummy = input(title="====== MONTHLY CPR ======", defval=true)
mDummy24 = input(title="==============================", defval=true)
bEnableMonthlyPivots = input(title="Show CPR", defval=true)
monthlyShowPrevious = input(title="Show Previous", defval=false)
bEnableMonthlyHighLow = input(title="Show High and Low", defval=true)
bEnableMonthlyLabels = input(title="Show Label", defval=true)
monthlyPivotsWidth = input(title="Width", defval=1, minval=1, step=1)
// Yearly Config
yDummy21 = input(title="==============================", defval=true)
yDummy = input(title="====== YEARLY CPR ======", defval=true)
yDummy24 = input(title="==============================", defval=true)
bEnableYearlyPivots = input(title="Show CPR", defval=true)
yearlyShowPrevious = input(title="Show Previous", defval=false)
bEnableYearlyHighLow = input(title="Show High and Low", defval=true)
bEnableYearlyLabels = input(title="Show Label", defval=true)
yearlyPivotsWidth = input(title="Pivots Width", defval=1, minval=1, step=1)
// Functions
getSeries(e, timeFrame) => security(syminfo.tickerid, timeFrame, e, lookahead=barmerge.lookahead_on)
getHLC(timeFrame) =>
H = getSeries(high[1], timeFrame)
L = getSeries(low[1], timeFrame)
C = getSeries(close[1], timeFrame)
[H, L, C]
getPivot(H,L,C) =>
P = (H + L + C) / 3
BC = (H + L) / 2
TC = P - BC + P
[P, BC, TC]
getCPRData(timeFrame, showPrevious) =>
[H, L, C] = getHLC(timeFrame)
[P, BC, TC] = getPivot(H,L,C)
isLast = not(showPrevious) ? security(syminfo.tickerid, timeFrame, barstate.islast, lookahead = true) : true
[H, L, C, P, BC, TC, isLast]
//
// DAILY PIVOTS
//
[dH, dL, dC, dP, dBC, dTC, disLast] = getCPRData('D', dailyShowPrevious)
dpColor = color.fuchsia
dhlColor = #00bcd4
dPivotStyle = plot.style_circles
// Daily CPR
plot(bEnableDailyPivots and disLast and timeframe.isintraday ? dP : na, title="Daily P", color=dpColor, linewidth=dailyPivotsWidth, style=dPivotStyle)
plot(bEnableDailyPivots and disLast and timeframe.isintraday ? dBC : na, title="Daily BC", color=dpColor, linewidth=dailyPivotsWidth, style=dPivotStyle)
plot(bEnableDailyPivots and disLast and timeframe.isintraday ? dTC : na, title="Daily TC", color=dpColor, linewidth=dailyPivotsWidth, style=dPivotStyle)
// Daily High/Low
plot(bEnableDailyHighLow and disLast and timeframe.isintraday ? dH : na, title="Daily High", color=dhlColor, linewidth=1, style=plot.style_circles)
plot(bEnableDailyHighLow and disLast and timeframe.isintraday ? dL : na, title="Daily Low", color=dhlColor, linewidth=1, style=plot.style_circles)
// Daily Labels
if disLast and bEnableDailyLabels
if bEnableDailyPivots
a1 = label.new(x = time + label_offset * 5, y = dP, text="D-CPR", style= label.style_none, textcolor=dpColor, size=size.normal, xloc = xloc.bar_time, yloc=yloc.price)
label.delete(a1[1])
if bEnableDailyHighLow
a10 = label.new(x = time + label_offset * 5, y = dH, text="DH", style= label.style_none, textcolor=dhlColor, size=size.normal, xloc = xloc.bar_time, yloc=yloc.price)
label.delete(a10[1])
a11 = label.new(x = time + label_offset * 5, y = dL, text="DL", style= label.style_none, textcolor=dhlColor, size=size.normal, xloc = xloc.bar_time, yloc=yloc.price)
label.delete(a11[1])
//
// WEEKLY PIVOTS
//
[wH, wL, wC, wP, wBC, wTC, wisLast] = getCPRData('W', weeklyShowPrevious)
wpColor = #8a2be2
whlColor = #00bcd4
wPivotStyle = plot.style_circles
// Weekly CPR
plot(bEnableWeeklyPivots and wisLast ? wP : na, title="Weekly P", color=wpColor, linewidth=weeklyPivotsWidth, style=wPivotStyle)
plot(bEnableWeeklyPivots and wisLast ? wBC : na, title="Weekly BC", color=wpColor, linewidth=weeklyPivotsWidth, style=wPivotStyle)
plot(bEnableWeeklyPivots and wisLast ? wTC : na, title="Weekly TC", color=wpColor, linewidth=weeklyPivotsWidth, style=wPivotStyle)
// Weekly High/Low
plot(bEnableWeeklyHighLow and wisLast ? wH : na, title="Weekly High", color=whlColor, linewidth=1, style=wPivotStyle)
plot(bEnableWeeklyHighLow and wisLast ? wL : na, title="Weekly Low", color=whlColor, linewidth=1, style=wPivotStyle)
// Weekly Labels
if wisLast and bEnableWeeklyLabels
if bEnableWeeklyPivots
b1 = label.new(x = time + label_offset * 5, y = wP, text="W-CPR", style= label.style_none, textcolor=wpColor, size=size.normal, xloc = xloc.bar_time, yloc=yloc.price)
label.delete(b1[1])
if (bEnableWeeklyHighLow)
b10 = label.new(x = time + label_offset * 5, y = wH, text="WH", style= label.style_none, textcolor=whlColor, size=size.normal, xloc = xloc.bar_time, yloc=yloc.price)
label.delete(b10[1])
b11 = label.new(x = time + label_offset * 5, y = wL, text="WL", style= label.style_none, textcolor=whlColor, size=size.normal, xloc = xloc.bar_time, yloc=yloc.price)
label.delete(b11[1])
//
// MONTHLY PIVOTS
//
[mH, mL, mC, mP, mBC, mTC, misLast] = getCPRData('M', monthlyShowPrevious)
mpColor = #ff1100
mhlColor = #00bcd4
mPivotStyle = plot.style_circles
// Monthly CPR
plot(bEnableMonthlyPivots and misLast ? mP : na, title="Monthly P", color=mpColor, linewidth=monthlyPivotsWidth, style=mPivotStyle)
plot(bEnableMonthlyPivots and misLast ? mBC : na, title="Monthly BC", color=mpColor, linewidth=monthlyPivotsWidth, style=mPivotStyle)
plot(bEnableMonthlyPivots and misLast ? mTC : na, title="Monthly TC", color=mpColor, linewidth=monthlyPivotsWidth, style=mPivotStyle)
// Monthly High/Low
plot(bEnableMonthlyHighLow and misLast ? mH : na, title="Monthly High", color=mhlColor, linewidth=1, style=mPivotStyle)
plot(bEnableMonthlyHighLow and misLast ? mL : na, title="Monthly Low", color=mhlColor, linewidth=1, style=mPivotStyle)
// Monthly Labels
if misLast and bEnableMonthlyLabels
if bEnableMonthlyPivots
c1 = label.new(x = time + label_offset * 15, y = mP, text="M-CPR", style= label.style_none, textcolor=mpColor, size=size.normal, xloc = xloc.bar_time, yloc=yloc.price)
label.delete(c1[1])
if (bEnableMonthlyHighLow)
c10 = label.new(x = time + label_offset * 5, y = mH, text="MH", style= label.style_none, textcolor=mhlColor, size=size.normal, xloc = xloc.bar_time, yloc=yloc.price)
label.delete(c10[1])
c11 = label.new(x = time + label_offset * 5, y = mL, text="ML", style= label.style_none, textcolor=mhlColor, size=size.normal, xloc = xloc.bar_time, yloc=yloc.price)
label.delete(c11[1])
//
// YEARLY PIVOTS
//
[yH, yL, yC, yP, yBC, yTC, yisLast] = getCPRData('12M', yearlyShowPrevious)
ypColor = color.orange
yhlColor = #00bcd4
yPivotStyle = plot.style_circles
// Yearly CPR
plot(bEnableYearlyPivots and yisLast ? yP : na, title="Yearly P", color=ypColor, linewidth=yearlyPivotsWidth, style=yPivotStyle)
plot(bEnableYearlyPivots and yisLast ? yBC : na, title="Yearly BC", color=ypColor, linewidth=yearlyPivotsWidth, style=yPivotStyle)
plot(bEnableYearlyPivots and yisLast ? yTC : na, title="Yearly TC", color=ypColor, linewidth=yearlyPivotsWidth, style=yPivotStyle)
// Yearly High/Low
plot(bEnableYearlyHighLow and yisLast ? yH : na, title="Yearly High", color=yhlColor, linewidth=1, style=yPivotStyle)
plot(bEnableYearlyHighLow and yisLast ? yL : na, title="Yearly Low", color=yhlColor, linewidth=1, style=yPivotStyle)
// Yearly Labels
if yisLast and bEnableYearlyLabels
if bEnableYearlyPivots
d1 = label.new(x = time + label_offset * 15, y = yP, text="Y-CPR", style= label.style_none, textcolor=ypColor, size=size.normal, xloc = xloc.bar_time, yloc=yloc.price)
label.delete(d1[1])
if (bEnableYearlyHighLow)
d10 = label.new(x = time + label_offset * 13, y = yH, text="YH", style= label.style_none, textcolor=yhlColor, size=size.normal, xloc = xloc.bar_time, yloc=yloc.price)
label.delete(d10[1])
d11 = label.new(x = time + label_offset * 13, y = yL, text="YL", style= label.style_none, textcolor=yhlColor, size=size.normal, xloc = xloc.bar_time, yloc=yloc.price)
label.delete(d11[1])
Overview
Camarilla Pivots + CPR [AIO] fetches higher timeframe market data for daily, weekly, monthly, and yearly timeframes, including previous session highs and lows. Users can customize line styles, line widths, minor pivot visibility, and toggle historical levels. The script uses higher timeframe security calls with lookahead enabled.
Camarilla pivot levels from H1-H6 and L1-L6
Central Pivot Range calculation
Multi-timeframe support for Daily, Weekly, Monthly, and Yearly
The inputs you can change from the gear icon on the chart. Defaults are the author's.
Setting
Type
Default
Variable
[Camarilla] Hide Previous
bool
true
showlast
[Camarilla] Show Labels
bool
true
showlabels
Line Style
string
Solid
lstyle
[Camarilla] Show Monthly
bool
true
showMonthly
[Camarilla] Show Monthly L1H1-L2H2
bool
false
showMonthlyMinors
[Camarilla] Monthly Width
int
1
monthlyWidth
[Camarilla] Show Yearly
bool
true
showYearly
[Camarilla] Show Yearly L1H1-L2H2
bool
false
showYearlyMinors
[Camarilla] Yearly Width
int
1
yearlyWidth
[Camarilla] Show Weekly
bool
true
showWeekly
[Camarilla] Show Weekly L1H1-L2H2
bool
false
showWeeklyMinors
[Camarilla] Weekly Width
int
1
weeklyWidth
Show all 40 settings
Setting
Type
Default
Variable
[Camarilla] Show Daily
bool
true
showDaily
[Camarilla] Daily Width
int
1
dailyWidth
==============================
bool
true
dDummy21
====== DAILY PIVOTS CPR ======
bool
true
dDummy
==============================
bool
true
dDummy24
Show Daily CPR
bool
true
bEnableDailyPivots
Show Previous
bool
false
dailyShowPrevious
Show High and Low
bool
true
bEnableDailyHighLow
Show Label
bool
true
bEnableDailyLabels
Width
int
1
dailyPivotsWidth
==============================
bool
true
wDummy21
====== WEEKLY CPR ======
bool
true
wDummy
==============================
bool
true
wDummy24
Show Weekly CPR
bool
true
bEnableWeeklyPivots
Show Previous
bool
false
weeklyShowPrevious
Show High and Low
bool
true
bEnableWeeklyHighLow
Show Label
bool
true
bEnableWeeklyLabels
Width
int
1
weeklyPivotsWidth
==============================
bool
true
mDummy21
====== MONTHLY CPR ======
bool
true
mDummy
==============================
bool
true
mDummy24
Show CPR
bool
true
bEnableMonthlyPivots
Show Previous
bool
false
monthlyShowPrevious
Show High and Low
bool
true
bEnableMonthlyHighLow
Show Label
bool
true
bEnableMonthlyLabels
Width
int
1
monthlyPivotsWidth
==============================
bool
true
yDummy21
====== YEARLY CPR ======
bool
true
yDummy
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.
Moving Average Channel plots separate simple moving averages for upper and lower bands on the price chart. It fills the space between bands with semi-transparent color and colors bars green above the upper band, red below the lower band, or gray in between. Us
This overlay indicator finds pivot highs and lows on the price chart and compares the last two highs and the last two lows. When the percentage difference between a pair is below the Equal HL threshold, it treats them as equal levels and draws a box. Left and
This indicator monitors multiple cryptocurrency symbols for trading signals. It calculates and plots entry prices, take profit, and stop loss levels for each symbol including BTCUSDT, ETHUSDT, BNBUSDT and others. Price crossovers trigger buy, sell or close ale
This overlay indicator draws a fixed-range volume profile on the price chart, splitting traded activity into up and down volume at each price level. It also plots a sentiment profile, a developing point of control, and value-area high and low around a configur
The BZ-tracker indicator marks ARK Invest buy and sell transactions on stock charts with labels. It plots green labels for purchases and red labels for sales, each annotated with a multiplier such as X1 or X2 to show the number of ARK ETFs trading the stock on
This indicator fits a linear regression through stored pivot highs and lows and draws the resulting channel on the price chart. A function returns predicted values, maximum and minimum deviations, and the average absolute deviation. Confirmed two-bar pivots up