// This source code is subject to the terms of the Mozilla Public License 2.
0 at
[Link]
// © Jxmodi
// [Link]
//@version=4
study("No Brain Breakout Strategy", overlay = true, shorttitle="NB",precision=1)
//******************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 support levels
S1 = (pivot * 2) - high
S2 = pivot - (high - low)
S3 = low - 2 * (high - pivot)
//3 resistance levels
R1 = (pivot * 2) - low
R2 = pivot + (high - low)
R3 = high + 2 * (pivot-low)
//Checkbox inputs
CPRPlot = input(title = "Plot CPR?", type=[Link], defval=false)
DayS1R1 = input(title = "Plot Daiy S1/R1?", type=[Link], defval=false)
DayS2R2 = input(title = "Plot Daiy S2/R2?", type=[Link], defval=false)
DayS3R3 = input(title = "Plot Daiy S3/R3?", type=[Link], defval=false)
WeeklyPivotInclude = input(title = "Plot Weekly Pivot?", type=[Link],
defval=false)
WeeklyS1R1 = input(title = "Plot weekly S1/R1?", type=[Link], defval=false)
WeeklyS2R2 = input(title = "Plot weekly S2/R2?", type=[Link], defval=false)
WeeklyS3R3 = input(title = "Plot weekly S3/R3?", type=[Link], defval=false)
MonthlyPivotInclude = input(title = "Plot Montly Pivot?", type=[Link],
defval=false)
MonthlyS1R1 = input(title = "Plot Monthly S1/R1?", type=[Link], defval=true)
MonthlyS2R2 = input(title = "Plot Monthly S2/R2?", type=[Link], defval=false)
MonthlyS3R3 = input(title = "Plot Montly S3/R3?", type=[Link], defval=false)
//******************DAYWISE CPR & PIVOTS**************************
// Getting daywise CPR
DayPivot = security([Link], "D", pivot[1], barmerge.gaps_off,
barmerge.lookahead_on)
DayBC = security([Link], "D", BC[1], barmerge.gaps_off,
barmerge.lookahead_on)
DayTC = security([Link], "D", TC[1], barmerge.gaps_off,
barmerge.lookahead_on)
//Adding linebreaks daywse for CPR
CPColour = DayPivot != DayPivot[1] ? na : [Link]
BCColour = DayBC != DayBC[1] ? na : [Link]
TCColour = DayTC != DayTC[1] ? na : [Link]
//Plotting daywise CPR
plot(DayPivot, title = "CP" , color = CPColour, style = plot.style_linebr,
linewidth =2)
plot(CPRPlot ? DayBC : na , title = "BC" , color = BCColour, style =
plot.style_line, linewidth =1)
plot(CPRPlot ? DayTC : na , title = "TC" , color = TCColour, style =
plot.style_line, linewidth =1)
// Getting daywise Support levels
DayS1 = security([Link], "D", S1[1], barmerge.gaps_off,
barmerge.lookahead_on)
DayS2 = security([Link], "D", S2[1], barmerge.gaps_off,
barmerge.lookahead_on)
DayS3 = security([Link], "D", S3[1], barmerge.gaps_off,
barmerge.lookahead_on)
//Adding linebreaks for daywise Support levels
DayS1Color =DayS1 != DayS1[1] ? na : [Link]
DayS2Color =DayS2 != DayS2[1] ? na : [Link]
DayS3Color =DayS3 != DayS3[1] ? na : [Link]
//Plotting daywise Support levels
plot(DayS1R1 ? DayS1 : na, title = "D-S1" , color = DayS1Color, style =
plot.style_line, linewidth =1)
plot(DayS2R2 ? DayS2 : na, title = "D-S2" , color = DayS2Color, style =
plot.style_line, linewidth =1)
plot(DayS3R3 ? DayS3 : na, title = "D-S3" , color = DayS3Color, style =
plot.style_line, linewidth =1)
// Getting daywise Resistance levels
DayR1 = security([Link], "D", R1[1], barmerge.gaps_off,
barmerge.lookahead_on)
DayR2 = security([Link], "D", R2[1], barmerge.gaps_off,
barmerge.lookahead_on)
DayR3 = security([Link], "D", R3[1], barmerge.gaps_off,
barmerge.lookahead_on)
//Adding linebreaks for daywise Support levels
DayR1Color =DayR1 != DayR1[1] ? na : [Link]
DayR2Color =DayR2 != DayR2[1] ? na : [Link]
DayR3Color =DayR3 != DayR3[1] ? na : [Link]
//Plotting daywise Resistance levels
plot(DayS1R1 ? DayR1 : na, title = "D-R1" , color = DayR1Color, style =
plot.style_line, linewidth =1)
plot(DayS2R2 ? DayR2 : na, title = "D-R2" , color = DayR2Color, style =
plot.style_line, linewidth =1)
plot(DayS3R3 ? DayR3 : na, title = "D-R3" , color = DayR3Color, style =
plot.style_line, linewidth =1)
//******************WEEKLY PIVOTS**************************
// Getting Weely Pivot
WPivot = security([Link], "W", pivot[1], barmerge.gaps_off,
barmerge.lookahead_on)
//Adding linebreaks for Weely Pivot
WeeklyPivotColor =WPivot != WPivot[1] ? na : [Link]
//Plotting Weely Pivot
plot(WeeklyPivotInclude ? WPivot:na, title = "W-P" , color = WeeklyPivotColor,
style = plot.style_circles, linewidth =1)
// Getting Weely Support levels
WS1 = security([Link], "W", S1[1],barmerge.gaps_off,
barmerge.lookahead_on)
WS2 = security([Link], "W", S2[1],barmerge.gaps_off,
barmerge.lookahead_on)
WS3 = security([Link], "W", S3[1],barmerge.gaps_off,
barmerge.lookahead_on)
//Adding linebreaks for weekly Support levels
WS1Color =WS1 != WS1[1] ? na : [Link]
WS2Color =WS2 != WS2[1] ? na : [Link]
WS3Color =WS3 != WS3[1] ? na : [Link]
//Plotting Weely Support levels
plot(WeeklyS1R1 ? WS1 : na, title = "W-S1" , color = WS1Color, style =
plot.style_cross, linewidth =1)
plot(WeeklyS2R2 ? WS2 : na, title = "W-S2" , color = WS2Color, style =
plot.style_cross, linewidth =1)
plot(WeeklyS3R3 ? WS3 : na, title = "W-S3" , color = WS3Color, style =
plot.style_cross, linewidth =1)
// Getting Weely Resistance levels
WR1 = security([Link], "W", R1[1], barmerge.gaps_off,
barmerge.lookahead_on)
WR2 = security([Link], "W", R2[1], barmerge.gaps_off,
barmerge.lookahead_on)
WR3 = security([Link], "W", R3[1], barmerge.gaps_off,
barmerge.lookahead_on)
//Adding linebreaks for weekly Resistance levels
WR1Color = WR1 != WR1[1] ? na : [Link]
WR2Color = WR2 != WR2[1] ? na : [Link]
WR3Color = WR3 != WR3[1] ? na : [Link]
//Plotting Weely Resistance levels
plot(WeeklyS1R1 ? WR1 : na , title = "W-R1" , color = WR1Color, style =
plot.style_cross, linewidth =1)
plot(WeeklyS2R2 ? WR2 : na , title = "W-R2" , color = WR2Color, style =
plot.style_cross, linewidth =1)
plot(WeeklyS3R3 ? WR3 : na , title = "W-R3" , color = WR3Color, style =
plot.style_cross, linewidth =1)
//******************MONTHLY PIVOTS**************************
// Getting Monhly Pivot
MPivot = security([Link], "M", pivot[1],barmerge.gaps_off,
barmerge.lookahead_on)
//Adding linebreaks for Monthly Support levels
MonthlyPivotColor =MPivot != MPivot[1] ? na : [Link]
//Plotting Monhly Pivot
plot(MonthlyPivotInclude? MPivot:na, title = " M-P" , color = MonthlyPivotColor,
style = plot.style_line, linewidth =1)
// Getting Monhly Support levels
MS1 = security([Link], "M", S1[1],barmerge.gaps_off,
barmerge.lookahead_on)
MS2 = security([Link], "M", S2[1],barmerge.gaps_off,
barmerge.lookahead_on)
MS3 = security([Link], "M", S3[1],barmerge.gaps_off,
barmerge.lookahead_on)
//Adding linebreaks for Montly Support levels
MS1Color =MS1 != MS1[1] ? na : [Link]
MS2Color =MS2 != MS2[1] ? na : [Link]
MS3Color =MS3 != MS3[1] ? na : [Link]
//Plotting Monhly Support levels
plot(MonthlyS1R1 ? MS1 : na, title = "M-S1" , color = MS1Color, style =
plot.style_stepline, linewidth =2)
plot(MonthlyS2R2 ? MS2 : na, title = "M-S2" , color = MS2Color, style =
plot.style_circles, linewidth =1)
plot(MonthlyS3R3 ? MS3 : na, title = "M-S3" , color = MS3Color, style =
plot.style_circles, linewidth =1)
// Getting Monhly Resistance levels
MR1 = security([Link], "M", R1[1],barmerge.gaps_off,
barmerge.lookahead_on)
MR2 = security([Link], "M", R2[1],barmerge.gaps_off,
barmerge.lookahead_on)
MR3 = security([Link], "M", R3[1],barmerge.gaps_off,
barmerge.lookahead_on)
MR1Color =MR1 != MR1[1] ? na : [Link]
MR2Color =MR2 != MR2[1] ? na : [Link]
MR3Color =MR3 != MR3[1] ? na : [Link]
//Plotting Monhly Resistance levels
plot(MonthlyS1R1 ? MR1 : na , title = "M-R1", color = MR1Color, style =
plot.style_stepline , linewidth =2)
plot(MonthlyS2R2 ? MR2 : na , title = "M-R2" , color = MR2Color, style =
plot.style_circles, linewidth =1)
plot(MonthlyS3R3 ? MR3 : na, title = "M-R3" , color = MR3Color, style =
plot.style_circles, linewidth =1)
//*****************************INDICATORs**************************
//SMA
PlotSMA = input(title = "Plot SMA?", type=[Link], defval=false)
SMALength = input(title="SMA Length", type=[Link], defval=44)
SMASource = input(title="SMA Source", type=[Link], defval=close)
SMAvg = sma (SMASource, SMALength)
plot(PlotSMA ? SMAvg : na, color= [Link], title="SMA")
//EMA
PlotEMA = input(title = "Plot EMA?", type=[Link], defval=false)
EMALength = input(title="EMA Length", type=[Link], defval=48)
EMASource = input(title="EMA Source", type=[Link], defval=close)
EMAvg = ema (EMASource, EMALength)
plot(PlotEMA ? EMAvg : na, color= [Link], title="EMA")
//VWAP
PlotVWAP = input(title = "Plot VWAP?", type=[Link], defval=false)
VWAPSource = input(title="VWAP Source", type=[Link], defval=close)
VWAPrice = vwap (VWAPSource)
plot(PlotVWAP ? VWAPrice : na, color= [Link], title="VWAP")
//SuperTrend
PlotSTrend = input(title = "Plot Super Trend?", type=[Link], defval=true)
InputFactor=input(2.7, minval=1,maxval = 100, title="Factor")
InputLength=input(13, minval=1,maxval = 100, title="Lenght")
BasicUpperBand=hl2-(InputFactor*atr(InputLength))
BasicLowerBand=hl2+(InputFactor*atr(InputLength))
FinalUpperBand=0.0
FinalLowerBand=0.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 ? [Link] : [Link]
Plotline = (PlotSTrend? STrendline: na)
plot(Plotline, color = linecolor , style = plot.style_linebr , linewidth = 1,title
= "SuperTrend")
PlotShapeUp = cross(close,STrendline) and close>STrendline
PlotShapeDown = cross(STrendline,close) and close<STrendline
plotshape(PlotSTrend? PlotShapeUp: na, "Up Arrow",
[Link],[Link],[Link],0,0)
plotshape(PlotSTrend? PlotShapeDown: na , "Down Arrow", [Link] ,
[Link], [Link],0,0)
//Pivot Points Standard", "Pivots", overlay=true, max_lines_count=500,
max_labels_count=500
AUTO = "Auto"
DAILY = "Daily"
WEEKLY = "Weekly"
MONTHLY = "Monthly"
QUARTERLY = "Quarterly"
YEARLY = "Yearly"
BIYEARLY = "Biyearly"
TRIYEARLY = "Triyearly"
QUINQUENNIALLY = "Quinquennially"
DECENNIALLY = "Decennially"
TRADITIONAL = "Traditional"
FIBONACCI = "Fibonacci"
WOODIE = "Woodie"
CLASSIC = "Classic"
DEMARK = "DM"
CAMARILLA = "Camarilla"
kind = input(title="Pivots Type", defval="Camarilla", options=[TRADITIONAL,
FIBONACCI, WOODIE, CLASSIC, DEMARK, CAMARILLA])
pivot_time_frame = input(title="Pivots Timeframe", defval=AUTO, options=[AUTO,
DAILY, WEEKLY, MONTHLY, QUARTERLY, YEARLY, BIYEARLY, TRIYEARLY, QUINQUENNIALLY,
DECENNIALLY])
look_back = input(title="Number of Pivots Back", type=[Link], defval=15,
minval=1, maxval=5000)
is_daily_based = input(title="Use Daily-based Values", type=[Link],
defval=true, tooltip = "When this option is unchecked, Pivot Points will use
intraday data while calculating on intraday charts. If Extended Hours are displayed
on the chart, they will be taken into account during the pivot level calculation.
If intraday OHLC values are different from daily-based values (normal for stocks),
the pivot levels will also differ.")
show_labels = input(title="Show Labels", type=[Link], defval=true, inline =
"labels")
position_labels = input("Left", "", options = ["Left", "Right"], inline = "labels")
var DEF_COLOR = #FB8C00
var arr_time = array.new_int()
var p = array.new_float()
p_show = input(false, "P ", inline = "P")
p_color = input(DEF_COLOR, "", inline = "P")
var r1 = array.new_float()
var s1 = array.new_float()
s1r1_show = input(false, "S1/R1", inline = "S1/R1")
s1r1_color = input(DEF_COLOR, "", inline = "S1/R1")
var r2 = array.new_float()
var s2 = array.new_float()
s2r2_show = input(false, "S2/R2", inline = "S2/R2")
s2r2_color = input(DEF_COLOR, "", inline = "S2/R2")
var r3 = array.new_float()
var s3 = array.new_float()
s3r3_show = input(false, "S3/R3", inline = "S3/R3")
s3r3_color = input(DEF_COLOR, "", inline = "S3/R3")
var r4 = array.new_float()
var s4 = array.new_float()
s4r4_show = input(true, "S4/R4", inline = "S4/R4")
s4r4_color = input(DEF_COLOR, "", inline = "S4/R4")
var r5 = array.new_float()
var s5 = array.new_float()
s5r5_show = input(false, "S5/R5", inline = "S5/R5")
s5r5_color = input(DEF_COLOR, "", inline = "S5/R5")
pivotX_open = float(na)
pivotX_open := nz(pivotX_open[1],open)
pivotX_high = float(na)
pivotX_high := nz(pivotX_high[1],high)
pivotX_low = float(na)
pivotX_low := nz(pivotX_low[1],low)
pivotX_prev_open = float(na)
pivotX_prev_open := nz(pivotX_prev_open[1])
pivotX_prev_high = float(na)
pivotX_prev_high := nz(pivotX_prev_high[1])
pivotX_prev_low = float(na)
pivotX_prev_low := nz(pivotX_prev_low[1])
pivotX_prev_close = float(na)
pivotX_prev_close := nz(pivotX_prev_close[1])
get_pivot_resolution() =>
resolution = "M"
if pivot_time_frame == AUTO
if [Link]
resolution := [Link] <= 15 ? "D" : "W"
else if [Link] or [Link]
resolution := "12M"
else if pivot_time_frame == DAILY
resolution := "D"
else if pivot_time_frame == WEEKLY
resolution := "W"
else if pivot_time_frame == MONTHLY
resolution := "M"
else if pivot_time_frame == QUARTERLY
resolution := "3M"
else if pivot_time_frame == YEARLY or pivot_time_frame == BIYEARLY or
pivot_time_frame == TRIYEARLY or pivot_time_frame == QUINQUENNIALLY or
pivot_time_frame == DECENNIALLY
resolution := "12M"
resolution
var lines = array.new_line()
var labels = array.new_label()
draw_line(i, pivot, col) =>
if [Link](arr_time) > 1
[Link](lines, [Link]([Link](arr_time, i), [Link](pivot, i),
[Link](arr_time, i + 1), [Link](pivot, i), color=col, xloc=xloc.bar_time))
draw_label(i, y, txt, txt_color) =>
if show_labels
offset = ' '
labels_align_str_left= position_labels == "Left" ? txt + offset : offset +
txt
x = position_labels == "Left" ? [Link](arr_time, i) :
[Link](arr_time, i + 1)
[Link](labels, [Link](x = x, y=y, text=labels_align_str_left,
textcolor=txt_color, style=label.style_label_center, color=#00000000,
xloc=xloc.bar_time))
traditional() =>
pivotX_Median = (pivotX_prev_high + pivotX_prev_low + pivotX_prev_close) / 3
[Link](p, pivotX_Median)
[Link](r1, pivotX_Median * 2 - pivotX_prev_low)
[Link](s1, pivotX_Median * 2 - pivotX_prev_high)
[Link](r2, pivotX_Median + 1 * (pivotX_prev_high - pivotX_prev_low))
[Link](s2, pivotX_Median - 1 * (pivotX_prev_high - pivotX_prev_low))
[Link](r3, pivotX_Median * 2 + (pivotX_prev_high - 2 * pivotX_prev_low))
[Link](s3, pivotX_Median * 2 - (2 * pivotX_prev_high - pivotX_prev_low))
[Link](r4, pivotX_Median * 3 + (pivotX_prev_high - 3 * pivotX_prev_low))
[Link](s4, pivotX_Median * 3 - (3 * pivotX_prev_high - pivotX_prev_low))
[Link](r5, pivotX_Median * 4 + (pivotX_prev_high - 4 * pivotX_prev_low))
[Link](s5, pivotX_Median * 4 - (4 * pivotX_prev_high - pivotX_prev_low))
fibonacci() =>
pivotX_Median = (pivotX_prev_high + pivotX_prev_low + pivotX_prev_close) / 3
pivot_range = pivotX_prev_high - pivotX_prev_low
[Link](p, pivotX_Median)
[Link](r1, pivotX_Median + 0.382 * pivot_range)
[Link](s1, pivotX_Median - 0.382 * pivot_range)
[Link](r2, pivotX_Median + 0.618 * pivot_range)
[Link](s2, pivotX_Median - 0.618 * pivot_range)
[Link](r3, pivotX_Median + 1 * pivot_range)
[Link](s3, pivotX_Median - 1 * pivot_range)
woodie() =>
pivotX_Woodie_Median = (pivotX_prev_high + pivotX_prev_low + pivotX_open * 2)/4
pivot_range = pivotX_prev_high - pivotX_prev_low
[Link](p, pivotX_Woodie_Median)
[Link](r1, pivotX_Woodie_Median * 2 - pivotX_prev_low)
[Link](s1, pivotX_Woodie_Median * 2 - pivotX_prev_high)
[Link](r2, pivotX_Woodie_Median + 1 * pivot_range)
[Link](s2, pivotX_Woodie_Median - 1 * pivot_range)
pivot_point_r3 = pivotX_prev_high + 2 * (pivotX_Woodie_Median -
pivotX_prev_low)
pivot_point_s3 = pivotX_prev_low - 2 * (pivotX_prev_high -
pivotX_Woodie_Median)
[Link](r3, pivot_point_r3)
[Link](s3, pivot_point_s3)
[Link](r4, pivot_point_r3 + pivot_range)
[Link](s4, pivot_point_s3 - pivot_range)
classic() =>
pivotX_Median = (pivotX_prev_high + pivotX_prev_low + pivotX_prev_close)/3
pivot_range = pivotX_prev_high - pivotX_prev_low
[Link](p, pivotX_Median)
[Link](r1, pivotX_Median * 2 - pivotX_prev_low)
[Link](s1, pivotX_Median * 2 - pivotX_prev_high)
[Link](r2, pivotX_Median + 1 * pivot_range)
[Link](s2, pivotX_Median - 1 * pivot_range)
[Link](r3, pivotX_Median + 2 * pivot_range)
[Link](s3, pivotX_Median - 2 * pivot_range)
[Link](r4, pivotX_Median + 3 * pivot_range)
[Link](s4, pivotX_Median - 3 * pivot_range)
demark() =>
pivotX_Demark_X = pivotX_prev_high + pivotX_prev_low * 2 + pivotX_prev_close
if pivotX_prev_close == pivotX_prev_open
pivotX_Demark_X := pivotX_prev_high + pivotX_prev_low + pivotX_prev_close *
2
if pivotX_prev_close > pivotX_prev_open
pivotX_Demark_X := pivotX_prev_high * 2 + pivotX_prev_low +
pivotX_prev_close
[Link](p, pivotX_Demark_X / 4)
[Link](r1, pivotX_Demark_X / 2 - pivotX_prev_low)
[Link](s1, pivotX_Demark_X / 2 - pivotX_prev_high)
camarilla() =>
pivotX_Median = (pivotX_prev_high + pivotX_prev_low + pivotX_prev_close) / 3
pivot_range = pivotX_prev_high - pivotX_prev_low
[Link](p, pivotX_Median)
[Link](r1, pivotX_prev_close + pivot_range * 1.1 / 12.0)
[Link](s1, pivotX_prev_close - pivot_range * 1.1 / 12.0)
[Link](r2, pivotX_prev_close + pivot_range * 1.1 / 6.0)
[Link](s2, pivotX_prev_close - pivot_range * 1.1 / 6.0)
[Link](r3, pivotX_prev_close + pivot_range * 1.1 / 4.0)
[Link](s3, pivotX_prev_close - pivot_range * 1.1 / 4.0)
[Link](r4, pivotX_prev_close + pivot_range * 1.1 / 2.0)
[Link](s4, pivotX_prev_close - pivot_range * 1.1 / 2.0)
resolution = get_pivot_resolution()
[sec_open, sec_high, sec_low, sec_close] = security([Link], resolution,
[open, high, low, close], lookahead = barmerge.lookahead_on)
sec_open_gaps_on = security([Link], resolution, open, gaps =
barmerge.gaps_on, lookahead = barmerge.lookahead_on)
var number_of_years = 0
is_change_years = false
var custom_years_resolution = pivot_time_frame == BIYEARLY or pivot_time_frame ==
TRIYEARLY or pivot_time_frame == QUINQUENNIALLY or pivot_time_frame == DECENNIALLY
if custom_years_resolution and change(time(resolution))
number_of_years += 1
if pivot_time_frame == BIYEARLY and number_of_years % 2 == 0
is_change_years := true
number_of_years := 0
else if pivot_time_frame == TRIYEARLY and number_of_years % 3 == 0
is_change_years := true
number_of_years := 0
else if pivot_time_frame == QUINQUENNIALLY and number_of_years % 5 == 0
is_change_years := true
number_of_years := 0
else if pivot_time_frame == DECENNIALLY and number_of_years % 10 == 0
is_change_years := true
number_of_years := 0
var is_change = false
var uses_current_bar = [Link] and kind == WOODIE
var change_time = int(na)
is_time_change = (change(time(resolution)) and not custom_years_resolution) or
is_change_years
if is_time_change
change_time := time
if (not uses_current_bar and is_time_change) or (uses_current_bar and not
na(sec_open_gaps_on))
if is_daily_based
pivotX_prev_open := sec_open[1]
pivotX_prev_high := sec_high[1]
pivotX_prev_low := sec_low[1]
pivotX_prev_close := sec_close[1]
pivotX_open := sec_open
pivotX_high := sec_high
pivotX_low := sec_low
else
pivotX_prev_high := pivotX_high
pivotX_prev_low := pivotX_low
pivotX_prev_open := pivotX_open
pivotX_open := open
pivotX_high := high
pivotX_low := low
pivotX_prev_close := close[1]
if [Link] and not is_change and [Link](arr_time) > 0
[Link](arr_time, [Link](arr_time) - 1, change_time)
else
[Link](arr_time, change_time)
if kind == TRADITIONAL
traditional()
else if kind == FIBONACCI
fibonacci()
else if kind == WOODIE
woodie()
else if kind == CLASSIC
classic()
else if kind == DEMARK
demark()
else if kind == CAMARILLA
camarilla()
if [Link](arr_time) > look_back
if [Link](arr_time) > 0
[Link](arr_time)
if [Link](p) > 0 and p_show
[Link](p)
if [Link](r1) > 0 and s1r1_show
[Link](r1)
if [Link](s1) > 0 and s1r1_show
[Link](s1)
if [Link](r2) > 0 and s2r2_show
[Link](r2)
if [Link](s2) > 0 and s2r2_show
[Link](s2)
if [Link](r3) > 0 and s3r3_show
[Link](r3)
if [Link](s3) > 0 and s3r3_show
[Link](s3)
if [Link](r4) > 0 and s4r4_show
[Link](r4)
if [Link](s4) > 0 and s4r4_show
[Link](s4)
if [Link](r5) > 0 and s5r5_show
[Link](r5)
if [Link](s5) > 0 and s5r5_show
[Link](s5)
is_change := true
else
if is_daily_based
pivotX_high := max(pivotX_high, sec_high)
pivotX_low := min(pivotX_low, sec_low)
else
pivotX_high := max(pivotX_high, high)
pivotX_low := min(pivotX_low, low)
if [Link] and [Link](arr_time) > 0 and is_change
is_change := false
if [Link](arr_time) > 2 and custom_years_resolution
last_pivot_time = [Link](arr_time, [Link](arr_time) - 1)
prev_pivot_time = [Link](arr_time, [Link](arr_time) - 2)
estimate_pivot_time = last_pivot_time - prev_pivot_time
[Link](arr_time, last_pivot_time + estimate_pivot_time)
else
[Link](arr_time, time_close(resolution))
for i = 0 to [Link](lines) - 1
if [Link](lines) > 0
[Link]([Link](lines))
if [Link](lines) > 0
[Link]([Link](labels))
for i = 0 to [Link](arr_time) - 2
if [Link](p) > 0 and p_show
draw_line(i, p, p_color)
draw_label(i, [Link](p, i), "P", p_color)
if [Link](r1) > 0 and s1r1_show
draw_line(i, r1, s1r1_color)
draw_label(i, [Link](r1, i), "R1", s1r1_color)
if [Link](s1) > 0 and s1r1_show
draw_line(i, s1, s1r1_color)
draw_label(i, [Link](s1, i), "S1", s1r1_color)
if [Link](r2) > 0 and s2r2_show
draw_line(i, r2, s2r2_color)
draw_label(i, [Link](r2, i), "R2", s2r2_color)
if [Link](s2) > 0 and s2r2_show
draw_line(i, s2, s2r2_color)
draw_label(i, [Link](s2, i), "S2", s2r2_color)
if [Link](r3) > 0 and s3r3_show
draw_line(i, r3, s3r3_color)
draw_label(i, [Link](r3, i), "R3", s3r3_color)
if [Link](s3) > 0 and s3r3_show
draw_line(i, s3, s3r3_color)
draw_label(i, [Link](s3, i), "S3", s3r3_color)
if [Link](r4) > 0 and s4r4_show
draw_line(i, r4, s4r4_color)
draw_label(i, [Link](r4, i), "R4", s4r4_color)
if [Link](s4) > 0 and s4r4_show
draw_line(i, s4, s4r4_color)
draw_label(i, [Link](s4, i), "S4", s4r4_color)
if [Link](r5) > 0 and s5r5_show
draw_line(i, r5, s5r5_color)
draw_label(i, [Link](r5, i), "R5", s5r5_color)
if [Link](s5) > 0 and s5r5_show
draw_line(i, s5, s5r5_color)
draw_label(i, [Link](s5, i), "S5", s5r5_color)