//@TeamTaurus Pivots are taken from Tradingview Default app and modified the
calculation to my own ....
// A combination Script to Get confirmation with confluence .. Pivots taken from TV
Builtin version, Trendlines by Lonesomeblue,
//@version=5
indicator('[TT] PivotBoss', 'ॐ', overlay=true, max_lines_count=500,
max_labels_count=500, max_bars_back=5000)
AUTO = 'Auto'
HOURLY = 'Hourly'
DAILY = 'Daily'
WEEKLY = 'Weekly'
MONTHLY = 'Monthly'
QUARTERLY = 'Quarterly'
YEARLY = 'Yearly'
BIYEARLY = 'Biyearly'
TRIYEARLY = 'Triyearly'
QUINQUENNIAL = 'Quinquennial'
FIBONACCI = 'Fibonacci'
CAMARILLA = 'Camarilla'
CPR = 'CPR'
DEMARK = 'OFF'
kind = input.string(title='Type', defval='Camarilla', options=[DEMARK, FIBONACCI,
CAMARILLA,CPR], inline='Pi', group='Pivots')
pivot_time_frame = input.string(title='', defval=DAILY, options=[AUTO, HOURLY,
DAILY, WEEKLY, MONTHLY, QUARTERLY, YEARLY, BIYEARLY, TRIYEARLY, QUINQUENNIAL],
inline='Pi', group='Pivots')
look_back = input.int(title='', defval=1, minval=1, maxval=5000, inline='Pi',
group='Pivots', tooltip='No Of previous Levels')
is_daily_based = input.bool(title='Use Daily-based Values', 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", defval=false, inline = "labels")
position_labels = input.string('Left', '', options=['Left', 'Right'],
inline='labels')
tl = input(false,title = "Trend Line",group='Settings ॐ')
swing = input.bool(defval=false, title='Swing ', inline='Swing', group='Settings
ॐ', tooltip='Turn On Swing Hi/Lo') //
prd = input.int(defval=10, title=' ', inline='Swing', group='Settings ॐ')
ColorSelector(c_) =>
c_ == 'aqua' ? color.aqua : c_ == 'black' ? color.black : c_ == 'blue' ?
color.blue : c_ == 'fuchsia' ? color.fuchsia : c_ == 'gray' ? color.gray : c_ ==
'green' ? color.green : c_ == 'lime' ? color.lime : c_ == 'maroon' ? color.maroon :
c_ == 'navy' ? color.navy : c_ == 'olive' ? color.olive : c_ == 'orange' ?
color.orange : c_ == 'purple' ? color.purple : c_ == 'red' ? color.red : c_ ==
'silver' ? color.silver : c_ == 'teal' ? color.teal : c_ == 'white' ? color.white :
c_ == 'yellow' ? color.yellow : color.black
Hi_color = input.string(title='HH', defval='orange', options=['aqua', 'black',
'blue', 'fuchsia', 'gray', 'green', 'lime', 'maroon', 'navy', 'olive', 'orange',
'purple', 'red', 'silver', 'teal', 'white',
'yellow'],inline='Swing',group='Settings ॐ')
Lo_color = input.string(title='LL', defval='black', options=['aqua', 'black',
'blue', 'fuchsia', 'gray', 'green', 'lime', 'maroon', 'navy', 'olive', 'orange',
'purple', 'red', 'silver', 'teal', 'white',
'yellow'],inline='Swing',group='Settings ॐ')
showlast = input.bool(title='Show Only Last Period', defval=true, group='Settings
ॐ', tooltip='Shows only Today levels bar by bar')
showlabels = input.bool(title='Show Labels', defval=true, group='Settings ॐ',
tooltip='Shows labels on plotted pivots')
ltcol = input.color(color.black,"Target Color",inline='labels')
lbcol = input.color(color.yellow,"Breakout/down Color",inline='labels')
lstyle2 = input.string(title='CPR Style', options=['Solid', 'Circles', 'Cross'],
defval='Solid', group='Style', tooltip='Change Line Style for CPR')
cmidon = input.bool(defval=false, title='Cam Mid ', group='Settings ॐ',
tooltip='Turn Camarilla Mid')
cprturnon = input.bool(title='Turn On CPR', defval=false, group='Settings ॐ',
tooltip='Turn CPR on')
JP = input.bool(title='Just Pivot', defval=false, group='Settings ॐ',
tooltip='Show Only Pivot of the day')
PDHL = input.bool(false, 'Prev HiLo ', inline='Settings ॐ', group='Settings ॐ')
PColor = input.color(color.orange, '', inline='Settings ॐ', group='Settings ॐ')
Pres = input.timeframe(defval='D', inline='Settings ॐ', group='Settings ॐ')
lvl = input.int(1, title='', inline='Settings ॐ', group='Settings ॐ')
vwaplot = input.bool(false, title='VWAP', inline='vwap', group='Settings ॐ',
tooltip='Turn on Vwap')
emaplot = input.bool(false, title='EMA on ', inline='Settings ॐ',
group='Settings ॐ', tooltip='Turns On 3 Ema\'s On Chart, Levels can be Edited')
choice = input.string(title='', defval='EMA', options=['EMA', 'SMA'],
inline='Settings ॐ', group='Settings ॐ', tooltip='Select Either EMA or SMA from
dropdown menu')
MAa = input.int(9, title='EMA', inline='EMA', minval=1, maxval=500, group='Settings
ॐ')
MAb = input.int(27, title=' ', inline='EMA', minval=1, maxval=500, group='Settings
ॐ')
MAc = input.int(111, title=' ', inline='EMA', minval=1, maxval=500, group='Settings
ॐ')
lw = input.int(1, title='Width', minval=1, maxval=3, inline='EMA', group='Settings
ॐ')
vsr = input.bool(false, title='Show Volume Based S&R', group='Settings ॐ',
tooltip='Shows Volume Based Support and Resistance on Stocks and Futures')
vol = input(false,title = "Volume Range", group='Settings ॐ', inline = "VR")
vbull = input(true,"Vbull", group='Settings ॐ', inline = "VR")
vbear = input(true,"Vbear", group='Settings ॐ', inline = "VR")
ATRTsl = input.bool(false, 'Trailing SL', inline='atr', group='Settings ॐ',
tooltip='Trailing SL')
//Pivot Settings
var DEF_COLOR = #FB8C00
var S3_COLOR = #000000
var S4_COLOR = #ff9800
var S5_COLOR = #ff0000
var arr_time = array.new_int()
var p = array.new_float()
p_show = input.bool(false, 'P ', inline='P')
p_color = input.color(DEF_COLOR, '', inline='P')
var r1 = array.new_float()
var s1 = array.new_float()
s1r1_show = input.bool(false, 'S1/R1', inline='S1/R1')
s1r1_color = input.color(DEF_COLOR, '', inline='S1/R1')
var r2 = array.new_float()
var s2 = array.new_float()
s2r2_show = input.bool(false, 'S2/R2', inline='S2/R2')
s2r2_color = input.color(S3_COLOR, '', inline='S2/R2')
var r3 = array.new_float()
var s3 = array.new_float()
s3r3_show = input.bool(true, 'S3/R3', inline='S3/R3')
s3r3_color = input.color(S4_COLOR, '', inline='S3/R3')
var r4 = array.new_float()
var s4 = array.new_float()
s4r4_show = input.bool(true, 'S4/R4', inline='S4/R4')
s4r4_color = input.color(S5_COLOR, '', inline='S4/R4')
var r5 = array.new_float()
var s5 = array.new_float()
s5r5_show = input.bool(true, 'S5/R5', inline='S5/R5')
s5r5_color = input.color(S5_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 timeframe.isintraday
resolution := timeframe.multiplier <= 15 ? 'D' : 'W'
resolution
else if timeframe.isweekly or timeframe.ismonthly
resolution := '12M'
resolution
else if pivot_time_frame == HOURLY
resolution := '240'
resolution
else if pivot_time_frame == DAILY
resolution := 'D'
resolution
else if pivot_time_frame == WEEKLY
resolution := 'W'
resolution
else if pivot_time_frame == MONTHLY
resolution := 'M'
resolution
else if pivot_time_frame == QUARTERLY
resolution := '3M'
resolution
else if pivot_time_frame == YEARLY or pivot_time_frame == BIYEARLY or
pivot_time_frame == TRIYEARLY or pivot_time_frame == QUINQUENNIAL
resolution := '12M'
resolution
resolution
var lines = array.new_line()
var labels = array.new_label()
draw_line(i, pivot, col) =>
if array.size(arr_time) > 1
array.push(lines, line.new(array.get(arr_time, i), array.get(pivot, i),
array.get(arr_time, i + 1), array.get(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' ? array.get(arr_time, i) :
array.get(arr_time, i + 1)
array.push(labels, label.new(x=x, y=y, text=labels_align_str_left,
textcolor=txt_color, style=label.style_label_center, color=#00000000,
xloc=xloc.bar_time))
fibonacci() =>
pivotX_Median = (pivotX_prev_high + pivotX_prev_low + pivotX_prev_close) / 3
pivot_range = pivotX_prev_high - pivotX_prev_low
array.push(p, pivotX_Median)
array.push(r1, pivotX_Median + 0.382 * pivot_range)
array.push(s1, pivotX_Median - 0.382 * pivot_range)
array.push(r2, pivotX_Median + 0.618 * pivot_range)
array.push(s2, pivotX_Median - 0.618 * pivot_range)
array.push(r3, pivotX_Median + 1 * pivot_range)
array.push(s3, pivotX_Median - 1 * pivot_range)
array.push(r4, pivotX_Median + 1.272 * pivot_range)
array.push(s4, pivotX_Median - 1.272 * pivot_range)
array.push(r5, pivotX_Median + 1.618 * pivot_range)
array.push(s5, pivotX_Median - 1.618 * pivot_range)
camarilla() =>
pivotX_Median = (pivotX_prev_high + pivotX_prev_low + pivotX_prev_close) / 3
pivot_range = pivotX_prev_high - pivotX_prev_low
H4 = pivotX_prev_close + pivot_range * 1.1 / 2
H3 = pivotX_prev_close + pivot_range * 1.1 / 4
H2 = pivotX_prev_close + pivot_range * 1.1 / 6
H1 = pivotX_prev_close + pivot_range * 1.1 / 12
L1 = pivotX_prev_close - pivot_range * 1.1 / 12
L2 = pivotX_prev_close - pivot_range * 1.1 / 6
L3 = pivotX_prev_close - pivot_range * 1.1 / 4
L4 = pivotX_prev_close - pivot_range * 1.1 / 2
L5 = L4 - 1.168 * (L3 - L4)
H5 = H4 + 1.168 * (H4 - H3)
H6 = pivotX_prev_high / pivotX_prev_low * pivotX_prev_close
L6 = pivotX_prev_close - (H6 - pivotX_prev_close)
array.push(p, pivotX_Median)
array.push(r1, H2)
array.push(s1, L2)
array.push(r2, H3)
array.push(s2, L3)
array.push(r3, H4)
array.push(s3, L4)
array.push(r4, H5)
array.push(s4, L5)
array.push(r5, H6)
array.push(s5, L6)
traditional() =>
pivotX_Median = (pivotX_prev_high + pivotX_prev_low + pivotX_prev_close) / 3
array.push(p, pivotX_Median)
array.push(r1, pivotX_Median * 2 - pivotX_prev_low)
array.push(s1, pivotX_Median * 2 - pivotX_prev_high)
array.push(r2, pivotX_Median + (pivotX_prev_high - pivotX_prev_low))
array.push(s2, pivotX_Median - (pivotX_prev_high - pivotX_prev_low))
array.push(r3, pivotX_prev_high + 2 * (pivotX_Median - pivotX_prev_low))
array.push(s3, pivotX_prev_low - 2 * (pivotX_prev_high - pivotX_Median))
resolution = get_pivot_resolution()
[sec_open, sec_high, sec_low, sec_close] = request.security(syminfo.tickerid,
resolution, [open, high, low, close], lookahead=barmerge.lookahead_on)
sec_open_gaps_on = request.security(syminfo.tickerid, 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 == QUINQUENNIAL
if custom_years_resolution and ta.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
number_of_years
else if pivot_time_frame == TRIYEARLY and number_of_years % 3 == 0
is_change_years := true
number_of_years := 0
number_of_years
else if pivot_time_frame == QUINQUENNIAL and number_of_years % 5 == 0
is_change_years := true
number_of_years := 0
number_of_years
var is_change = false
var uses_current_bar = timeframe.isintraday
var change_time = int(na)
is_time_change = ta.change(time(resolution)) and not custom_years_resolution or
is_change_years
if is_time_change
change_time := time
change_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
pivotX_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]
pivotX_prev_close
if barstate.islast and not is_change and array.size(arr_time) > 0
array.set(arr_time, array.size(arr_time) - 1, change_time)
else
array.push(arr_time, change_time)
if kind == FIBONACCI
fibonacci()
else if kind == CAMARILLA
camarilla()
else if kind == CPR
traditional()
if array.size(arr_time) > look_back
if array.size(arr_time) > 0
array.shift(arr_time)
if array.size(p) > 0 and p_show
array.shift(p)
if array.size(r1) > 0 and s1r1_show
array.shift(r1)
if array.size(s1) > 0 and s1r1_show
array.shift(s1)
if array.size(r2) > 0 and s2r2_show
array.shift(r2)
if array.size(s2) > 0 and s2r2_show
array.shift(s2)
if array.size(r3) > 0 and s3r3_show
array.shift(r3)
if array.size(s3) > 0 and s3r3_show
array.shift(s3)
if array.size(r4) > 0 and s4r4_show
array.shift(r4)
if array.size(s4) > 0 and s4r4_show
array.shift(s4)
if array.size(r5) > 0 and s5r5_show
array.shift(r5)
if array.size(s5) > 0 and s5r5_show
array.shift(s5)
is_change := true
is_change
else
if is_daily_based
pivotX_high := math.max(pivotX_high, sec_high)
pivotX_low := math.min(pivotX_low, sec_low)
pivotX_low
else
pivotX_high := math.max(pivotX_high, high)
pivotX_low := math.min(pivotX_low, low)
pivotX_low
if barstate.islast and array.size(arr_time) > 0 and is_change
is_change := false
if array.size(arr_time) > 2 and custom_years_resolution
last_pivot_time = array.get(arr_time, array.size(arr_time) - 1)
prev_pivot_time = array.get(arr_time, array.size(arr_time) - 2)
estimate_pivot_time = last_pivot_time - prev_pivot_time
array.push(arr_time, last_pivot_time + estimate_pivot_time)
else
array.push(arr_time, time_close(resolution))
for i = 0 to array.size(lines) - 1 by 1
if array.size(lines) > 0
line.delete(array.shift(lines))
if array.size(lines) > 0
label.delete(array.shift(labels))
for i = 0 to array.size(arr_time) - 2 by 1
if array.size(p) > 0 and p_show
draw_line(i, p, p_color)
draw_label(i, array.get(p, i), 'P', p_color)
if array.size(r1) > 0 and s1r1_show
draw_line(i, r1, s1r1_color)
draw_label(i, array.get(r1, i), 'R1', s1r1_color)
if array.size(s1) > 0 and s1r1_show
draw_line(i, s1, s1r1_color)
draw_label(i, array.get(s1, i), 'S1', s1r1_color)
if array.size(r2) > 0 and s2r2_show
draw_line(i, r2, s2r2_color)
draw_label(i, array.get(r2, i), 'R2', s2r2_color)
if array.size(s2) > 0 and s2r2_show
draw_line(i, s2, s2r2_color)
draw_label(i, array.get(s2, i), 'S2', s2r2_color)
if array.size(r3) > 0 and s3r3_show
draw_line(i, r3, s3r3_color)
draw_label(i, array.get(r3, i), 'R3', s3r3_color)
if array.size(s3) > 0 and s3r3_show
draw_line(i, s3, s3r3_color)
draw_label(i, array.get(s3, i), 'S3', s3r3_color)
if array.size(r4) > 0 and s4r4_show
draw_line(i, r4, s4r4_color)
draw_label(i, array.get(r4, i), 'R4', s4r4_color)
if array.size(s4) > 0 and s4r4_show
draw_line(i, s4, s4r4_color)
draw_label(i, array.get(s4, i), 'S4', s4r4_color)
if array.size(r5) > 0 and s5r5_show
draw_line(i, r5, s5r5_color)
draw_label(i, array.get(r5, i), 'R5', s5r5_color)
if array.size(s5) > 0 and s5r5_show
draw_line(i, s5, s5r5_color)
draw_label(i, array.get(s5, i), 'S5', s5r5_color)
////////////////////////////////
hih = ta.pivothigh(high, prd, prd)
lol = ta.pivotlow(low, prd, prd)
top = ta.valuewhen(hih, high[prd], 0)
bot = ta.valuewhen(lol, low[prd], 0)
plot(swing ? top : na, color=top != top[1] ? na : ColorSelector(Hi_color), offset=-
prd, editable=false)
plot(swing ? bot : na, color=bot != bot[1] ? na : ColorSelector(Lo_color), offset=-
prd, editable=false)
////////ORB {
sess = input.session('0915-0945', title='ORB Period', inline='orb', group='Settings
ॐ')
t = time(timeframe.period, sess + ':1234567')
hide = timeframe.isintraday and timeframe.multiplier <= 10
is_newbar(res) =>
ta.change(time(res)) != 0
in_session = not na(t)
is_first = in_session and not in_session[1]
orb_high = float(na)
orb_low = float(na)
if is_first
orb_high := high
orb_low := low
orb_low
else
orb_high := orb_high[1]
orb_low := orb_low[1]
orb_low
if high > orb_high and in_session
orb_high := high
orb_high
if low < orb_low and in_session
orb_low := low
orb_low
show15highlow = input.bool(title='ORB ', defval=false, inline='orb',
group='Settings ॐ')
plot(show15highlow ? orb_high : na, style=plot.style_circles, color=orb_high[1] !=
orb_high ? na : color.purple, title='IB High', linewidth=1, show_last=75)
plot(show15highlow ? orb_low : na, style=plot.style_circles, color=orb_low[1] !=
orb_low ? na : color.purple, title='IB Low', linewidth=1, show_last=75)
//}
hhtf = request.security(syminfo.tickerid, resolution, high[1],
lookahead=barmerge.lookahead_on)
lhtf = request.security(syminfo.tickerid, resolution, low[1],
lookahead=barmerge.lookahead_on)
chtf = request.security(syminfo.tickerid, resolution, close[1],
lookahead=barmerge.lookahead_on)
rng = hhtf - lhtf
// is this last bar for HTF?
islast = showlast ? request.security(syminfo.tickerid, resolution, barstate.islast,
lookahead=barmerge.lookahead_on) : true
// Line Style
linestyleL = plot.style_circles
///////Calculation Camarilla
H4 = chtf + rng * 1.1 / 2
H3 = chtf + rng * 1.1 / 4
H2 = chtf + rng * 1.1 / 6
H1 = chtf + rng * 1.1 / 12
L1 = chtf - rng * 1.1 / 12
L2 = chtf - rng * 1.1 / 6
L3 = chtf - rng * 1.1 / 4
L4 = chtf - rng * 1.1 / 2
L5 = L4 - 1.168 * (L3 - L4) //L5 = chtf - (H5 - chtf)
H5 = H4 + 1.168 * (H4 - H3) //H5 = (hhtf / lhtf) * chtf
H6 = hhtf / lhtf * chtf //H6 = H5 + 1.168 * (H5 - H4)
L6 = chtf - (H6 - chtf) //L6 = chtf - (H6 - chtf)
SLbull = (H4 + H3) / 2
SLbear = (L4 + L3) / 2
mid = (H3 + L3) / 2
////////Color Settings
plot(islast and kind == CAMARILLA and cmidon ? mid : na, 'Mid-H3-L3',
color=color.new(#000000, 60), linewidth=1, style=linestyleL, editable=false)
plot(islast and kind == CAMARILLA and cmidon ? SLbull : na, 'SLBull H3-H4',
color=color.new(#ff0000, 60), linewidth=1, style=linestyleL, editable=false)
plot(islast and kind == CAMARILLA and cmidon ? SLbear : na, 'SLBear L3-L4',
color=color.new(#388e3c, 60), linewidth=1, style=linestyleL, editable=false)
// Label for S/R
mndr = time - time[1]
mndr := ta.change(mndr) > 0 ? mndr[1] : mndr
Round_it(valu) =>
a = 0
num = syminfo.mintick
s = valu
if na(s)
s := syminfo.mintick
s
if num < 1
for i = 1 to 20 by 1
num *= 10
if num > 1
break
a += 1
a
for x = 1 to a by 1
s *= 10
s
s := math.round(s)
for x = 1 to a by 1
s /= 10
s
s := s < syminfo.mintick ? syminfo.mintick : s
s
// Labels
//////Central Pivot
Pivot = (hhtf + lhtf + chtf) / 3
BC = (hhtf + lhtf) / 2
TC = Pivot - BC + Pivot
//LineStyle CPR
linestylee = lstyle2 == 'Solid' ? plot.style_line : lstyle2 == 'Circles' ?
plot.style_circles : lstyle2 == 'Cross' ? plot.style_cross : na
plot(islast and cprturnon ? TC : na, title='TC', color=color.new(color.blue, 0),
linewidth=1, style=linestylee)
plot(islast and cprturnon ? Pivot : na, title='Pivot', color=color.new(color.red,
0), linewidth=1, style=linestylee)
plot(islast and cprturnon ? BC : na, title='BC', color=color.new(color.blue, 0),
linewidth=1, style=linestylee)
plot(islast and JP ? Pivot : na, title='JPivot', color=color.new(color.red, 0),
linewidth=2, style=linestylee)
if showlabels and JP
var label jplabel = na
label.delete(jplabel)
jplabel := label.new(x=time + mndr * 20, y=Pivot, text='Pivot •' +
str.tostring(Round_it(Pivot)), color=color.new(#000000, 100),
textcolor=color.black, style=label.style_label_left, xloc=xloc.bar_time,
yloc=yloc.price)
chtf
///////Day High Low//////
phhtf = request.security(syminfo.tickerid, Pres, high[lvl],
lookahead=barmerge.lookahead_on)
plhtf = request.security(syminfo.tickerid, Pres, low[lvl],
lookahead=barmerge.lookahead_on)
pchtf = request.security(syminfo.tickerid, Pres, close[lvl],
lookahead=barmerge.lookahead_on)
islast2 = showlast ? request.security(syminfo.tickerid, Pres, barstate.islast,
lookahead=barmerge.lookahead_on) : true
plot(islast2 and PDHL ? phhtf : na, title='Day High', color=PColor, linewidth=2,
style=linestylee)
plot(islast2 and PDHL ? plhtf : na, title='Day Low', color=PColor, linewidth=2,
style=linestylee)
plot(islast2 and PDHL ? pchtf : na, title='Day Close', color=PColor, linewidth=2,
style=linestylee)
if showlabels and PDHL
var label pdhlabel = na
var label pdllabel = na
var label pdclabel = na
label.delete(pdhlabel)
label.delete(pdllabel)
label.delete(pdclabel)
pdhlabel := label.new(x=time + mndr * 20, y=phhtf, text='PDH •' +
str.tostring(Round_it(phhtf)), color=color.new(#000000, 100), textcolor=PColor,
style=label.style_label_left, xloc=xloc.bar_time, yloc=yloc.price)
pdllabel := label.new(x=time + mndr * 20, y=plhtf, text='PDL •' +
str.tostring(Round_it(plhtf)), color=color.new(#000000, 100), textcolor=PColor,
style=label.style_label_left, xloc=xloc.bar_time, yloc=yloc.price)
pdclabel := label.new(x=time + mndr * 20, y=pchtf, text='PDC •' +
str.tostring(Round_it(pchtf)), color=color.new(#000000, 100), textcolor=PColor,
style=label.style_label_left, xloc=xloc.bar_time, yloc=yloc.price)
pdclabel
//////Fibo Pivot
pivot = (hhtf + lhtf + chtf) / 3.0
R1 = pivot + 0.382 * rng
S1 = pivot - 0.382 * rng
R2 = pivot + 0.618 * rng
S2 = pivot - 0.618 * rng
R3 = pivot + rng
S3 = pivot - rng
R4 = pivot + 1.272 * rng
S4 = pivot - 1.272 * rng
R5 = pivot + 1.618 * rng
S5 = pivot - 1.618 * rng
R6 = pivot + 2.058 * rng
S6 = pivot - 2.058 * rng
R7 = pivot + 2.618 * rng
S7 = pivot - 2.618 * rng
PAB = input.bool(true, 'Price Action Bars', group='Settings ॐ')
//Dark Cloud
DRKC = open[1] < close[1] ? open > high[1] ? close < close[1] - (close[1] -
open[1]) / 2 ? close > open[1] ? #dbff01 : na : na : na : na
barcolor(PAB ? DRKC : na, title='Dark Cloud')
//Bearish Engulfing
BrEng = close < open[1] ? low < low[1] ? high > high[1] ? open >= open[1] ? #ff0000
: na : na : na : na
barcolor(PAB ? BrEng : na, title='Bearish Engulf')
//Bullish Engulfing
BuEng = low < low[1] ? high > high[1] ? open <= open[1] ? close > open[1] ? #00ff0a
: na : na : na : na
barcolor(PAB ? BuEng : na, title='Bullish Engulf')
BearishENG = open[1] < close[1] ? close < open[1] ? open > close[1] ? #ff0000 :
na : na : na
barcolor(PAB ? BearishENG : na, title='Bearish 2 Engulf')
BullishENG = open[1] > close[1] ? close > open[1] ? open < close[1] ? #00ff0a :
na : na : na
barcolor(PAB ? BullishENG : na, title='Bullish 2 Engulf')
/////VWAP////MVWAP
Length = input.int(50, title='MVWAP', inline='vwap', group='Settings ॐ')
mvwap = ta.ema(ta.vwap, Length)
plot(vwaplot ? mvwap : na, linewidth=2, title='MVWAP', style=plot.style_line,
color=color.new(color.purple, 0))
plot(ta.vwap and vwaplot ? ta.vwap : na, linewidth=lw, title='VWAP',
color=color.new(#FF7000, 0))
//////EMA
plot(emaplot and choice == 'EMA' ? ta.ema(close, MAa) : emaplot and choice == 'SMA'
? ta.sma(close, MAa) : na, title='Fast MA', color=color.new(color.green, 0),
linewidth=lw)
plot(emaplot and choice == 'EMA' ? ta.ema(close, MAb) : emaplot and choice == 'SMA'
? ta.sma(close, MAb) : na, title='Mid MA', color=color.new(color.black, 0),
linewidth=lw)
plot(emaplot and choice == 'EMA' ? ta.ema(close, MAc) : emaplot and choice == 'SMA'
? ta.sma(close, MAc) : na, title='Slow MA', color=color.new(color.red, 0),
linewidth=lw)
////////////Volume Based Support Resistance
Vlength = input.int(20, minval=1, group='Volume S/R Settings')
Vchange = volume / volume[1] - 1
stdev = ta.stdev(Vchange, Vlength)
difference = Vchange / stdev[1]
Treshold = input(5)
zero = 0
signal = math.abs(difference)
vstylee = plot.style_circles
leveluphi = ta.valuewhen(signal > Treshold, high[1], 0)
leveluplo = ta.valuewhen(signal > Treshold, low[1], 0)
//plot(UpperTreshold, color=black)
pv1 = plot(vsr and leveluphi ? leveluphi : na, title='LevelHi', style=vstylee,
color=color.new(color.blue, 0))
pv2 = plot(vsr and leveluplo ? leveluplo : na, title='Levello', style=vstylee,
color=color.new(color.blue, 0))
fill(pv1, pv2, color=color.new(color.black, 50), title='Fill')
////////////////////////
///////// Day Range
On = input.bool(false, 'Day Range', group='Settings ॐ')
fill(plot1=plot(On and islast ? H4 : na, color=color.new(#ff7700, 80),
editable=false), plot2=plot(On and islast ? R2 : na, color=color.new(#ff7700, 100),
editable=false), color=color.new(#ff7700, 75))
fill(plot1=plot(On and islast ? L4 : na, color=color.new(#000000, 80),
editable=false), plot2=plot(On and islast ? S2 : na, color=color.new(#000000, 100),
editable=false), color=color.new(#000000, 75))
// ATR Trailing SL {
nATRPeriod = input.int(5, 'Period', inline='atr', group='Settings ॐ')
nATRMultip = input.float(3.5, 'Multi', inline='atr', group='Settings ॐ')
xATR = ta.atr(nATRPeriod)
nLoss = nATRMultip * xATR
xATRTrailingStop = 0.0
iff_1 = close > nz(xATRTrailingStop[1], 0) ? close - nLoss : close + nLoss
iff_2 = close < nz(xATRTrailingStop[1], 0) and close[1] < nz(xATRTrailingStop[1],
0) ? math.min(nz(xATRTrailingStop[1]), close + nLoss) : iff_1
xATRTrailingStop := close > nz(xATRTrailingStop[1], 0) and close[1] >
nz(xATRTrailingStop[1], 0) ? math.max(nz(xATRTrailingStop[1]), close - nLoss) :
iff_2
col = close < xATRTrailingStop[1] ? color.silver : color.black
plot(ATRTsl ? xATRTrailingStop[1] : na, color=col, title='ATR Trailing Stop') //}
//Table {
var table info = table.new(position.top_center, 1, 1)
var table logo = table.new(position.bottom_right, 1, 1)
if barstate.islast
table.cell(logo, 0, 0, 'ॐ ', text_size=size.normal, text_color=color.orange)
table.cell(info, 0, 0, '@TeamTaurus', text_size=size.small,
text_color=color.black)
//}
//BollingerBands {
bbon = input.bool(false, title='BollingerBands', inline='BB', group='Settings ॐ')
bblength = input.int(27, '', minval=1, inline='BB', group='Settings ॐ')
bbsrc = input.source(close, title='', inline='BB', group='Settings ॐ')
mult = input.float(2.0, minval=0.001, maxval=50, title='', inline='BB',
group='Settings ॐ')
basis = ta.sma(bbsrc, bblength)
dev = mult * ta.stdev(bbsrc, bblength)
upper = basis + dev
lower = basis - dev
offset = input.int(0, 'BB Offset', minval=-500, maxval=500)
plot(bbon ? basis : na, 'Basis', color=color.new(#872323, 0), offset=offset)
b1 = plot(bbon ? upper : na, 'Upper', color=color.new(color.teal, 0),
offset=offset)
b2 = plot(bbon ? lower : na, 'Lower', color=color.new(color.teal, 0),
offset=offset)
fill(b1, b2, title='Background', color=color.new(#198787, 95)) //}
////////////Trendlines Taken from Lonesomeblue {
startyear = input(defval=2020, title='Start Year',group='Trendline')
startmonth = input(defval=1, title='Start Month',group='Trendline')
startday = input(defval=1, title='Start day',group='Trendline')
prdl = input.int(defval=10, title='Pivot Period', minval=10,
maxval=50,group='Trendline')
PPnum = input.int(defval=3, title='Number of Pivot Points to check', minval=2,
maxval=8,group='Trendline')
utcol = input.color(defval=color.lime, title='Colors',
inline='tcol',group='Trendline')
dtcol = input.color(defval=color.red, title='', inline='tcol',group='Trendline')
float ph = ta.pivothigh(prdl, prdl)
float pl = ta.pivotlow(prdl, prdl)
var tval = array.new_float(PPnum)
var tpos = array.new_int(PPnum)
var bval = array.new_float(PPnum)
var bpos = array.new_int(PPnum)
add_to_array(apointer1, apointer2, val) =>
array.unshift(apointer1, val)
array.unshift(apointer2, bar_index)
array.pop(apointer1)
array.pop(apointer2)
if ph
add_to_array(tval, tpos, ph)
if pl
add_to_array(bval, bpos, pl)
// line definitions
maxline = 3
var bln = array.new_line(maxline, na)
var tln = array.new_line(maxline, na)
// loop for pivot points to check if there is possible trend line
countlinelo = 0
countlinehi = 0
starttime = timestamp(startyear, startmonth, startday, 0, 0, 0)
if time >= starttime
for x = 0 to maxline - 1 by 1
line.delete(array.get(bln, x))
line.delete(array.get(tln, x))
for p1 = 0 to PPnum - 2 by 1
uv1 = 0.0
uv2 = 0.0
up1 = 0
up2 = 0
if countlinelo <= maxline
for p2 = PPnum - 1 to p1 + 1 by 1
val1 = array.get(bval, p1)
val2 = array.get(bval, p2)
pos1 = array.get(bpos, p1)
pos2 = array.get(bpos, p2)
if val1 > val2
diff = (val1 - val2) / (pos1 - pos2)
hline = val2 + diff
lloc = bar_index
lval = low
valid = true
for x = pos2 + 1 - prd to bar_index by 1
if close[bar_index - x] < hline
valid := false
break
lloc := x
lval := hline
hline += diff
hline
if valid
uv1 := hline - diff
uv2 := val2
up1 := lloc
up2 := pos2
break
dv1 = 0.0
dv2 = 0.0
dp1 = 0
dp2 = 0
if countlinehi <= maxline
for p2 = PPnum - 1 to p1 + 1 by 1
val1 = array.get(tval, p1)
val2 = array.get(tval, p2)
pos1 = array.get(tpos, p1)
pos2 = array.get(tpos, p2)
if val1 < val2
diff = (val2 - val1) / float(pos1 - pos2)
hline = val2 - diff
lloc = bar_index
lval = high
valid = true
for x = pos2 + 1 - prd to bar_index by 1
if close[bar_index - x] > hline
valid := false
break
lloc := x
lval := hline
hline -= diff
hline
if valid
dv1 := hline + diff
dv2 := val2
dp1 := lloc
dp2 := pos2
break
// if there is continues uptrend line then draw it
if tl and up1 != 0 and up2 != 0 and countlinelo < maxline
countlinelo += 1
array.set(bln, countlinelo - 1, line.new(up2 - prd, uv2, up1, uv1,
color=utcol))
// if there is continues downtrend line then draw it
if tl and dp1 != 0 and dp2 != 0 and countlinehi < maxline
countlinehi += 1
array.set(tln, countlinehi - 1, line.new(dp2 - prd, dv2, dp1, dv1,
color=dtcol))
//}
//Vol Range {
bull = close > open
bear = open > close
condbull = bull and bull[1] and bull[2] and volume[1] < volume[2] and volume <
volume[2] and volume > volume[1] and barstate.isconfirmed
condbear = bear and bear[1] and bear[2] and volume[1] < volume[2] and volume <
volume[2] and volume > volume[1] and barstate.isconfirmed
//
plotshape(condbull,title="Vol",style=shape.triangleup,size=size.normal,location=loc
ation.belowbar)
lineLength = 20
f_timeDelta() =>
var timeDelta = 10e15
timeDelta := math.min(time - nz(time[1]), timeDelta)
timeDelta
ofst = int(time + f_timeDelta() * lineLength)
var line _ha = na
var line _haa = na
var line B_ha = na
var line B_haa = na
if condbull and vol and vbull
_ha := line.new(time, high, ofst, high, xloc=xloc.bar_time, color=color.green,
width=1)
line.delete(_ha[1])
_haa := line.new(time, low, ofst, low, xloc=xloc.bar_time, color=color.green,
width=1)
line.delete(_haa[1])
if condbear and vol and vbear
B_ha := line.new(time, high, ofst, high, xloc=xloc.bar_time, color=color.red,
width=1)
line.delete(B_ha[1])
B_haa := line.new(time, low, ofst, low, xloc=xloc.bar_time, color=color.red,
width=1)
line.delete(B_haa[1])
//}