Pivot-Master by CF-Zak & Team-Taurus
Pivot-Master by CF-Zak & Team-Taurus
//@version=5
indicator('Pivot Master by Team Taurus', shorttitle='Pivot Master by Team Taurus',
overlay=true, max_bars_back=5000)
// { Time Range
FromMonth = input.int(defval=1, title='FromMonth', minval=1, maxval=12,
group='Backtest Date')
FromDay = input.int(defval=1, title='FromDay', minval=1, maxval=31, group='Backtest
Date')
FromYear = input.int(defval=2020, title='FromYear', minval=2016, group='Backtest
Date')
ToMonth = input.int(defval=1, title='ToMonth', minval=1, maxval=12, group='Backtest
Date')
ToDay = input.int(defval=1, title='ToDay', minval=1, maxval=31, group='Backtest
Date')
ToYear = input.int(defval=9999, title='ToYear', minval=2017, group='Backtest Date')
start = timestamp(FromYear, FromMonth, FromDay, 00, 00)
finish = timestamp(ToYear, ToMonth, ToDay, 23, 59)
window() =>
time >= start and time <= finish ? true : false
zeroline = 0
// } Time Range
float ph = na
float pl = na
ph := ta.pivothigh(prd, prd)
pl := ta.pivotlow(prd, prd)
// Line Style
linestyle = lstyle == 'Solid' ? plot.style_line : lstyle == 'Circles' ?
plot.style_circles : lstyle == 'Cross' ? plot.style_cross : na
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
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
if showlabels and cturnon
var label s3label = na
var label s4label = na
var label s5label = na
var label s6label = na
var label r3label = na
var label r4label = na
var label r5label = na
var label r6label = na
label.delete(s3label)
label.delete(s4label)
label.delete(s5label)
label.delete(s6label)
label.delete(r3label)
label.delete(r4label)
label.delete(r5label)
label.delete(r6label)
s3label := label.new(x=time + mndr * 10, y=L2, text='Buy Reversal ' +
str.tostring(Round_it(L3)), color=color.lime, textcolor=color.green,
style=label.style_none, xloc=xloc.bar_time, yloc=yloc.price)
s4label := label.new(x=time + mndr * 10, y=L4, text='Break Down ' +
str.tostring(Round_it(L4)), color=color.lime, textcolor=color.white,
style=label.style_none, xloc=xloc.bar_time, yloc=yloc.price)
s5label := label.new(x=time + mndr * 10, y=L5, text='Target ' +
str.tostring(Round_it(L5)), color=color.lime, textcolor=color.white,
style=label.style_none, xloc=xloc.bar_time, yloc=yloc.price)
s6label := label.new(x=time + mndr * 10, y=L6, text='Target ' +
str.tostring(Round_it(L6)), color=color.lime, textcolor=color.white,
style=label.style_none, xloc=xloc.bar_time, yloc=yloc.price)
r3label := label.new(x=time + mndr * 10, y=H2, text='Sell reversal ' +
str.tostring(Round_it(H3)), color=color.red, textcolor=color.red,
style=label.style_none, xloc=xloc.bar_time, yloc=yloc.price)
r4label := label.new(x=time + mndr * 10, y=H4, text='Breakout ' +
str.tostring(Round_it(H4)), color=color.red, textcolor=color.white,
style=label.style_none, xloc=xloc.bar_time, yloc=yloc.price)
r5label := label.new(x=time + mndr * 10, y=H5, text='Target ' +
str.tostring(Round_it(H5)), color=color.red, textcolor=color.white,
style=label.style_none, xloc=xloc.bar_time, yloc=yloc.price)
r6label := label.new(x=time + mndr * 10, y=H6, text='Target ' +
str.tostring(Round_it(H6)), color=color.red, textcolor=color.white,
style=label.style_none, xloc=xloc.bar_time, yloc=yloc.price)
r6label
//////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
label.delete(jplabel)
jplabel := label.new(x=time + mndr * 20, y=Pivot, text='Pivot ' +
str.tostring(Round_it(Pivot)), textcolor=color.black, style=label.style_none,
xloc=xloc.bar_time, yloc=yloc.price)
chtf
///////Day High Low//////
plot(islast and PDHL ? hhtf : na, title='Day High', color=color.new(color.black,
0), linewidth=2, style=linestylee)
plot(islast and PDHL ? lhtf : na, title='Day Low', color=color.new(color.black, 0),
linewidth=2, style=linestylee)
if showlabels and PDHL
var label pdhlabel = na
var label pdllabel = na
label.delete(pdhlabel)
label.delete(pdllabel)
pdhlabel := label.new(x=time + mndr * 20, y=hhtf, text='PDH ' +
str.tostring(Round_it(hhtf)), textcolor=color.black, style=label.style_none,
xloc=xloc.bar_time, yloc=yloc.price)
pdllabel := label.new(x=time + mndr * 20, y=lhtf, text='PDL ' +
str.tostring(Round_it(lhtf)), textcolor=color.black, style=label.style_none,
xloc=xloc.bar_time, yloc=yloc.price)
pdllabel
//////Fibo Pivot
// fib Line Style
flinestyle = flstyle == 'Solid' ? plot.style_line : flstyle == 'Cross' ?
plot.style_cross : flstyle == 'Circles' ? plot.style_circles : na
frc = #146690
fsc = #00bcd4
label.delete(fs1label)
label.delete(fs2label)
label.delete(fs3label)
label.delete(fs4label)
label.delete(plabel)
label.delete(fr1label)
label.delete(fr2label)
label.delete(fr3label)
label.delete(fr4label)
fs1label := label.new(x=time + mndr * 20, y=S1, text='0.382 ' +
str.tostring(Round_it(S1)), color=color.lime, textcolor=color.green,
style=label.style_none, xloc=xloc.bar_time, yloc=yloc.price)
fs2label := label.new(x=time + mndr * 20, y=S2, text='0.618 ' +
str.tostring(Round_it(S2)), color=color.lime, textcolor=color.black,
style=label.style_none, xloc=xloc.bar_time, yloc=yloc.price)
fs3label := label.new(x=time + mndr * 20, y=S3, text='100 ' +
str.tostring(Round_it(S3)), color=color.lime, textcolor=color.black,
style=label.style_none, xloc=xloc.bar_time, yloc=yloc.price)
fs4label := label.new(x=time + mndr * 20, y=S4, text='1.272 ' +
str.tostring(Round_it(S4)), color=color.lime, textcolor=color.black,
style=label.style_none, xloc=xloc.bar_time, yloc=yloc.price)
plabel := label.new(x=time + mndr * 20, y=pivot, text='Pivot ' +
str.tostring(Round_it(pivot)), color=color.silver, textcolor=color.silver,
style=label.style_none, xloc=xloc.bar_time, yloc=yloc.price)
fr1label := label.new(x=time + mndr * 20, y=R1, text='0.382 ' +
str.tostring(Round_it(R1)), color=color.red, textcolor=color.red,
style=label.style_none, xloc=xloc.bar_time, yloc=yloc.price)
fr2label := label.new(x=time + mndr * 20, y=R2, text='0.618 ' +
str.tostring(Round_it(R2)), color=color.red, textcolor=color.black,
style=label.style_none, xloc=xloc.bar_time, yloc=yloc.price)
fr3label := label.new(x=time + mndr * 20, y=R3, text='100 ' +
str.tostring(Round_it(R3)), color=color.red, textcolor=color.black,
style=label.style_none, xloc=xloc.bar_time, yloc=yloc.price)
fr4label := label.new(x=time + mndr * 20, y=R4, text='1.272 ' +
str.tostring(Round_it(R4)), color=color.red, textcolor=color.black,
style=label.style_none, xloc=xloc.bar_time, yloc=yloc.price)
fr4label
label.delete(fs5label)
label.delete(fs6label)
label.delete(fs7label)
label.delete(fr5label)
label.delete(fr6label)
label.delete(fr7label)
fs5label := label.new(x=time + mndr * 20, y=S5, text='1.618 ' +
str.tostring(Round_it(S5)), color=color.lime, textcolor=color.green,
style=label.style_none, xloc=xloc.bar_time, yloc=yloc.price)
fs6label := label.new(x=time + mndr * 20, y=S6, text='2.058 ' +
str.tostring(Round_it(S6)), color=color.lime, textcolor=color.black,
style=label.style_none, xloc=xloc.bar_time, yloc=yloc.price)
fs7label := label.new(x=time + mndr * 20, y=S7, text='2.618 ' +
str.tostring(Round_it(S7)), color=color.lime, textcolor=color.black,
style=label.style_none, xloc=xloc.bar_time, yloc=yloc.price)
fr5label := label.new(x=time + mndr * 20, y=R5, text='1.618 ' +
str.tostring(Round_it(R5)), color=color.red, textcolor=color.black,
style=label.style_none, xloc=xloc.bar_time, yloc=yloc.price)
fr6label := label.new(x=time + mndr * 20, y=R6, text='2.058 ' +
str.tostring(Round_it(R6)), color=color.red, textcolor=color.black,
style=label.style_none, xloc=xloc.bar_time, yloc=yloc.price)
fr7label := label.new(x=time + mndr * 20, y=R7, text='2.618 ' +
str.tostring(Round_it(R7)), color=color.red, textcolor=color.black,
style=label.style_none, xloc=xloc.bar_time, yloc=yloc.price)
fr7label
//Bearish Engulfing
BrEng = close < open[1] ? low < low[1] ? high > high[1] ? open >= open[1] ? #FF7000
: 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] ? #00FF00
: na : na : na : na
barcolor(PAB ? BuEng : na, title='Bullish Engulf')
//////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)
plot(emaplot and choice == 'EMA' ? ta.ema(close, MAd) : emaplot and choice == 'SMA'
? ta.sma(close, MAd) : na, title='Additonal MA', color=color.new(#ff7700, 0),
linewidth=lw)
////////////////RSI
srcRSI = close
lenRSI = input.int(14, minval=1, title='RSI Length', group='RSI Settings')
up = ta.rma(math.max(ta.change(srcRSI), 0), lenRSI)
down = ta.rma(-math.min(ta.change(srcRSI), 0), lenRSI)
rsi = down == 0 ? 100 : up == 0 ? 0 : 100 - 100 / (1 + up / down)
//coloring method below
srcRSI1 = close
lenRSI1 = input.int(60, minval=1, title='Over Bought', group='RSI Settings')
srcRSI2 = close
lenRSI2 = input.int(40, minval=1, title='Over Sold', group='RSI Settings')
isup() =>
rsi > lenRSI1
isdown() =>
rsi < lenRSI2
barcolor(rsicol and isup() ? color.green : rsicol and isdown() ? color.red : na)
//plot(UpperTreshold, color=black)
p1 = plot(vsr and leveluphi ? leveluphi : na, title='LevelHi', style=vstylee,
color=color.new(color.blue, 0))
p2 = plot(vsr and leveluplo ? leveluplo : na, title='Levello', style=vstylee,
color=color.new(color.blue, 0))
fill(p1, p2, color=color.new(color.black, 50), title='Fill')
////////////////////////
Ecandle = input.bool(false, 'Indecisive-Candle', group='Settings ॐ', tooltip='Shows
Candle')
barcolor(Ecandle and candle > -50 and candle < 50 ? #0b00ff : na)
/////
plotshape(series=ta.crossover(close, H4), style=shape.circle,
location=location.belowbar, color=color.new(color.green, 0))
plotshape(series=ta.crossunder(close, L4), style=shape.circle,
location=location.abovebar, color=color.new(color.red, 0))