amck-cpr

You might also like

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 12

// This source code is subject to the terms of the Mozilla Public License 2.

0 at
https://mozilla.org/MPL/2.0/
//study("mr BANKER", shorttitle="🕆 ,overlay=true)
//.......-:+==*=*=*:--:---.........-@@@@@
//......+==@##@@@@#@@#=#=*=*:......-@@@@@
//....+###=@@@@#@#@@@@@@@@@####+-..-@@@@@
//..-#@@#==#=#@@==##@@WW@@WW@#@@@*::@#@@@
//.-#@@@@=#@@@##=*=##@@WWWWWWW@WW@#@@@W@#
//.:#@@@WW@@##@@#######@@@W@WWWWWW##=@@@@
//.+@@WWWWW@@##@@@@####@@@@@@@WWWWW@@@@@W
//.-#@#W@@WW@@@@###===####@@@@@WWWWWWWW#@
//.-####:*@@##*===*========##@@WWWWWWW@@+
//..=@W*:***==**==*******=====##@WWWW@#@@
//..=WW=++++*++**++***++***====#@WWW@--=W
//..-@@#+++++++++++++:--:+++*===#WWW#:--@
//:--*@@+::+++++++++++:++++++**=#@W##+-+W
//=--*=#+*==##=********=#@@@@@@#=@@##@#=W
//@---*#+=###@@@@@#*=##@@@@@#@@#=#@#@WWWW
//@*--**-+=====####===@@###=###===#@WWWWW
//W#=@@=--+*=======***#=========*==@WWWWW
//W@@@++:--:**=***+---+====*===*==@@@@###
//W@@##=****====*--..--+:======###@@@@@@@
//W@@====###@@#====**==####@@###=@@@@@@@@
//#=====#####@@#=====#=###@@####@WWWWWW@@
//#==###@W@####===##@#@#######@@@WWWWWWWW
//#=####WWWW@##======#######@@@@WWWWWWWWW
//##@###@WWWW##========####@@@@WWWWWWWWWW
//@#@#@#@WWWW@#@#=======##@@@@WWWWWWWWWWW
//@@@@@@@WWWWW@@##@@@#@@@@@@WWWWWWWWWWWWW
//@@@@@@@WWWWWWW@@@@@@@@@WWWWWWWWWWWWWWW@
//@@@@@@@WWWWWWWWWW@@@WWWWWWWWWWWWWWW@W@@

//@version=4
study("TeamTaurus Master",shorttitle="ॐ" ,overlay = true, max_bars_back = 5000)
mode =input(title = "HTF Method", defval = 'User Defined', options=['Auto', 'User
Defined'], tooltip = "Choose Of the method to Select the Timeframe")
HTFm = input('D', title = "Time Frame (if HTF Method=User Defined)",
type=input.resolution, tooltip = "Manual Timeframe Selection")
showlast = input(title = "Show Only Last Period", defval = true, group = "Settings
ॐ", tooltip = "Shows only Today levels bar by bar")
showlabels = input(title = "Show Labels", defval = true, group = "Settings ॐ",
tooltip = "Shows labels on plotted pivots")
lstyle = input(title = "CAM Style", options = ['Solid', 'Circles', 'Cross'], defval
='Solid', group = "Style", tooltip = "Change Line Style for Camarilla")
lstyle2 = input(title = "CPR Style", options = ['Solid', 'Circles', 'Cross'],
defval ='Solid', group = "Style", tooltip = "Change Line Style for CPR")
flstyle = input(title = "Fib Style", options = ['Solid', 'Circles', 'Cross'],
defval ='Solid', group = "Style", tooltip = "Change Line Style for Fibonacci
Pivots")
cturnon = input(title = "Turn On Camarilla", defval = true, group = "Settings ॐ",
tooltip = "Turn Camarilla ON")
cprturnon = input(title = "Turn On CPR", defval = true, group = "Settings ॐ",
tooltip = "Turn CPR on")
JP = input(title = "Just Pivot", defval = false, group = "Settings ॐ", tooltip =
"Show Only Pivot of the day")
fibon = input(title = "Turn On Fib Pivot", defval= false, group = "Settings ॐ",
tooltip = "Turn Fib Pivots On")
sal = input(title="Show Additional Levels?", defval = false, group = "Settings ॐ",
tooltip = "Show additional levels of Fib Pivots")
PDHL = input(title = "Show Previous Hi-Lo", defval=true, group = "Settings ॐ",
tooltip = "Show Previous Days Hi and Low")
rsicol = input(false, title="Show RSI colors?", group = "Settings ॐ", tooltip =
"Show RSI Levels On Bars")
vwaplot = input (false, title="VWAP Strategy", group = "Settings ॐ", tooltip =
"Turn on Vwap")
emaplot = input (false, title="Show EMA on chart", group = "Settings ॐ", tooltip =
"Turns On 3 Ema's On Chart, Levels can be Edited")
smaplot = input (false, title="Show MA on chart", group = "Settings ॐ", tooltip =
" Turns On 2 MA's")
vwmaplot = input (false, title="VWMA on", group = "Settings ॐ", tooltip = "Turn on
Volume Weighted Moving Average")
vsr = input(false, title="Show Volume Based S&R", group = "Settings ॐ", tooltip =
"Shows Volume Based Support and Resistance on Stocks and Futures")
prd = input(defval = 30, title="Pivot Point Period", minval = 5, maxval = 100,
group ="Swing Length")
swing = input(defval = true, title="Swing High Low", group = "Settings ॐ", tooltip
="Turn On Swing Hi/Lo")

float ph = na, float pl = na


ph := pivothigh(prd, prd)
pl := pivotlow(prd, prd)

plotshape(ph and swing, text="█▬█", style=shape.labeldown, color=na,


textcolor=color.red, location=location.abovebar, transp=0, offset = -prd)
plotshape(pl and swing, text="█▄▄", style=shape.labeldown, color=na,
textcolor=color.green, location=location.belowbar, transp=0, offset = -prd)

//auto higher time frame


HTFo =timeframe.period == '1' ? '30' :
timeframe.period == '3' ? '60' :
timeframe.period == '5' ? '60' :
timeframe.period == '15' ? '240' :
timeframe.period == '30' ? 'D' :
timeframe.period == '45' ? 'D' :
timeframe.period == '60' ? 'D' :
timeframe.period == '120' ? 'D' :
timeframe.period == '180' ? 'D' :
timeframe.period == '240' ? 'D' :
timeframe.period == 'D' ? 'W' :
timeframe.period == 'W' ? 'M' :
'5W'

HTF = mode == 'Auto' ? HTFo : HTFm

hhtf = security(syminfo.tickerid, HTF, high[1], lookahead = barmerge.lookahead_on)


lhtf = security(syminfo.tickerid, HTF, low[1], lookahead = barmerge.lookahead_on)
chtf = security(syminfo.tickerid, HTF, close[1], lookahead = barmerge.lookahead_on)

rng = hhtf - lhtf


rng50 = rng/2
PDM = rng50+lhtf
// is this last bar for HTF?
islast = showlast ? security(syminfo.tickerid, HTF, barstate.islast, lookahead =
true) : true

// Line Style
linestyle = lstyle == 'Solid' ? plot.style_line :
lstyle == 'Circle' ? plot.style_circles : plot.style_cross
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)
M0 = chtf + rng * 1.1/250

plot(islast and cturnon ? H6 : na, title = "H6", color = color.red, linewidth = 1,


style = linestyle, transp = 0)
plot(islast and cturnon ? H5 : na, title = "H5", color = color.red, linewidth = 1,
style = linestyle, transp = 0)
plot(islast and cturnon ? H4 : na, title = "H4", color = color.red, linewidth = 3,
style = linestyle, transp = 0)
h3s=plot(islast and cturnon ? H3 : na, title = "H3", color = color.red, linewidth =
1, style = linestyle, transp = 0)
l3s=plot(islast and cturnon ? L3 : na, title = "L3", color = #008000, linewidth =
1, style = linestyle, transp = 0)
plot(islast and cturnon ? L4 : na, title = "L4", color = color.lime, linewidth = 3,
style = linestyle, transp = 0)
plot(islast and cturnon ? L5 : na, title = "L5", color = color.lime, linewidth = 1,
style = linestyle, transp = 0)
plot(islast and cturnon ? L6 : na, title = "L6", color = color.lime, linewidth = 1,
style = linestyle, transp = 0)
m0s=plot(islast and cturnon ? M0 : na, title = "MID", color = color.black,
linewidth = 2, style = linestyle, transp = 0)

fill(l3s, m0s, color = #80ff80)


fill(h3s, m0s, color = #ff4d4d)
// Label for S/R
mndr = time - time[1]
mndr := change(mndr) > 0 ? mndr[1] : mndr

Round_it(valu)=>
a = 0
num = syminfo.mintick
s = valu
if na(s)
s := syminfo.mintick
if num < 1
for i = 1 to 20
num := num * 10
if num > 1
break
a := a +1

for x = 1 to a
s := s * 10
s := round(s)
for x = 1 to a
s := s / 10
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 s0label = 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(s0label)
label.delete(r3label), label.delete(r4label), label.delete(r5label),
label.delete(r6label)
s3label := label.new(x = time + mndr * 20, y = L3, text = "
L3 REVERSAL " + tostring(Round_it(L3)), color = #008000, textcolor=color.green,
style=label.style_none, xloc = xloc.bar_time, yloc=yloc.price)
s4label := label.new(x = time + mndr * 20, y = L4, text = "
L4 BREAKDOWN " + tostring(Round_it(L4)), color = color.lime, textcolor=color.black,
style=label.style_none, xloc = xloc.bar_time, yloc=yloc.price)
s5label := label.new(x = time + mndr * 20, y = L5, text = "
L5 TARGET " + tostring(Round_it(L5)), color = color.lime, textcolor=color.black,
style=label.style_none, xloc = xloc.bar_time, yloc=yloc.price)
s6label := label.new(x = time + mndr * 20, y = L6, text = "
L6 TARGET " + tostring(Round_it(L6)), color = color.lime, textcolor=color.black,
style=label.style_none, xloc = xloc.bar_time, yloc=yloc.price)
r3label := label.new(x = time + mndr * 20, y = H3, text = "
H3 REVERSAL " + 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 * 20, y = H4, text = "
H4 BREAKOUT " + tostring(Round_it(H4)), color = color.red, textcolor=color.black,
style=label.style_none, xloc = xloc.bar_time, yloc=yloc.price)
r5label := label.new(x = time + mndr * 20, y = H5, text = "
H5 TARGET " + tostring(Round_it(H5)), color = color.red, textcolor=color.black,
style=label.style_none, xloc = xloc.bar_time, yloc=yloc.price)
r6label := label.new(x = time + mndr * 20, y = H6, text = "
H6 TARGET " + tostring(Round_it(H6)), color = color.red, textcolor=color.black,
style=label.style_none, xloc = xloc.bar_time, yloc=yloc.price)
s0label := label.new(x = time + mndr * 20, y = M0, text = "
MID POINT " + tostring(Round_it(M0)), color = color.black, textcolor=color.black,
style=label.style_none, xloc = xloc.bar_time, yloc=yloc.price)

//////Central Pivot
Pivot = (hhtf + lhtf + chtf)/3
BC = (hhtf + lhtf)/2
TC = (Pivot - BC) + Pivot
//LineStyle CPR
linestylee = lstyle2 == 'Solid' ? plot.style_line :
lstyle2 == 'Circle' ? plot.style_circles : plot.style_cross

TC1=plot(islast and cprturnon ? TC : na, title = "TC", color = color.blue,


linewidth = 1, style = linestylee, transp = 0)
plot(islast and cprturnon ? Pivot : na, title = "Pivot", color = color.red,
linewidth = 1, style = linestylee, transp = 0)
BC1=plot(islast and cprturnon ? BC : na, title = "BC", color = color.blue,
linewidth = 1, style = linestylee, transp = 0)
plot(islast and JP ? Pivot : na, title = "JPivot", color = color.red, linewidth =
1, style = linestylee, transp = 0)
if showlabels and JP
var label jplabel = na

label.delete(jplabel)
jplabel := label.new(x = time + mndr * 20, y = Pivot, text = "Pivot " +
tostring(Round_it(Pivot)), textcolor=color.black, style=label.style_none, xloc =
xloc.bar_time, yloc=yloc.price)
chtf

fill(TC1, BC1, color = #ffff4d)


///////Day High Low//////
plot(islast and PDHL ? hhtf : na, title = "Day High", color = color.black,
linewidth = 1, style = linestylee, transp = 0)
plot(islast and PDHL ? lhtf : na, title = "Day Low", color = color.black, linewidth
= 1, style = linestylee, transp = 0)

plot(islast and PDHL ? PDM : na, title = "Day Mid", color = color.black, linewidth
= 1, style = linestylee, transp = 0)

if showlabels and PDHL


var label pdhlabel = na
var label pdllabel = na
var label pdmlabel = na

label.delete(pdhlabel)
label.delete(pdllabel)
label.delete(pdmlabel)
pdhlabel := label.new(x = time + mndr * 20, y = hhtf, text = "
PDH " + 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 "+ tostring(Round_it(lhtf)), textcolor=color.black, style=label.style_none,
xloc = xloc.bar_time, yloc=yloc.price)
pdmlabel := label.new(x = time + mndr * 20, y = PDM, text = "
PDM "+ tostring(Round_it(lhtf)), textcolor=color.black, style=label.style_none,
xloc = xloc.bar_time, yloc=yloc.price)
//////Fibo Pivot
// fib Line Style
flinestyle = flstyle == 'Solid' ? plot.style_line :
flstyle == 'Circle' ? plot.style_cross : plot.style_circles

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)

plot(fibon and sal and islast ? R7 : na, title = "R7", color = color.red, linewidth
= 1, style = flinestyle, transp = 0)
plot(fibon and sal and islast ? R6 : na, title = "R6", color = color.red, linewidth
= 1, style = flinestyle, transp = 0)
plot(fibon and sal and islast ? R5 : na, title = "R5", color = color.red, linewidth
= 1, style = flinestyle, transp = 0)
plot(fibon and islast ? R4 : na, title = "R4", color = color.red, linewidth = 1,
style = flinestyle, transp = 0)
plot(fibon and islast ? R3 : na, title = "R3", color = color.red, linewidth = 1,
style = flinestyle, transp = 0)
plot(fibon and islast ? R2 : na, title = "R2", color = color.red, linewidth = 1,
style = flinestyle, transp = 0)
plot(fibon and islast ? R1 : na, title = "R1", color = color.red, linewidth = 1,
style = flinestyle, transp = 0)
plot(fibon and islast ? pivot : na, title = "pivot", color = color.silver,
linewidth = 1, style = flinestyle, transp = 0)
plot(fibon and islast ? S1 : na, title = "S1", color = color.lime, linewidth = 1,
style = flinestyle, transp = 0)
plot(fibon and islast ? S2 : na, title = "S2", color = color.lime, linewidth = 1,
style = flinestyle, transp = 0)
plot(fibon and islast ? S3 : na, title = "S3", color = color.lime, linewidth = 1,
style = flinestyle, transp = 0)
plot(fibon and islast ? S4 : na, title = "S4", color = color.lime, linewidth = 1,
style = flinestyle, transp = 0)
plot(fibon and sal and islast ? S5 : na, title = "S5", color = color.lime,
linewidth = 1, style = flinestyle, transp = 0)
plot(fibon and sal and islast ? S6 : na, title = "S6", color = color.lime,
linewidth = 1, style = flinestyle, transp = 0)
plot(fibon and sal and islast ? S7 : na, title = "S7", color = color.lime,
linewidth = 1, style = flinestyle, transp = 0)

if showlabels and fibon


var label fs1label = na, var label fs2label = na, var label fs3label = na, var
label fs4label = na, var label plabel = na
var label fr1label = na, var label fr2label = na, var label fr3label = na, var
label fr4label = na

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 " +
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 " +
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 " +
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 " +
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 " +
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 " +
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 " +
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 " +
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 " +
tostring(Round_it(R4)), color = color.red, textcolor=color.black,
style=label.style_none, xloc = xloc.bar_time, yloc=yloc.price)

if showlabels and fibon and sal


var label fs5label = na, var label fs6label = na, var label fs7label = na
var label fr5label = na, var label fr6label = na, var label fr7label = na

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 " +
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 " +
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 " +
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 " +
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 " +
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 " +
tostring(Round_it(R7)), color = color.red, textcolor=color.black,
style=label.style_none, xloc = xloc.bar_time, yloc=yloc.price)

//Dark Cloud
//barcolor(open[1] < close[1] ? open > high[1] ? close < close[1] - ((close[1] -
open[1]) / 2) ? close > open[1] ? #dbff01 :na :na :na :na, title='Dark Cloud
Cover')

//Bearish Engulfing
//barcolor(close < open[1] ? low < low[1] ? high > high[1] ? open >= open[1] ?
#FF7000 : na: na: na: na, title="Bearish engulfing")
//alertcondition(close < open[1] and low < low[1] and high > high[1] and open >=
open[1], title='Alert on bearish engulf', message='Bearish engulfing')

//Bullish Engulfing
//barcolor(low < low[1] ? high > high[1] ? open <= open[1] ? close > open[1] ?
#00FF00 : na: na: na: na, title="Bullish engulfing")
//alertcondition(low < low[1] and high > high[1] and open <= open[1] and close >
open[1], title='bullish engulf', message='Bullish engulfing')

//Three White Soldiers


//barcolor(close > open ? close[1] > open[1] ? close[2] > open[2] ? close > high[1]
? close[1] > high[2] ? open < close[1] ? open[1] < close[2] ? (high - close ) * 3 <
close - open ? (high[1] - close[1]) * 3 < close[1] - open[1] ? (high[2] - close[2])
* 3 < close[2] - open[2] ? #66ff00 : na : na : na : na : na : na:na : na : na : na,
title= "Three White Soldiers")
//barcolor(close < open ? close[1] < open[1] ? close[2] < open[2] ? close <
low[1] ? close[1] < low[2] ? open > close[1] ? open[1] > close[2] ? (close - low) *
3 < open - close ? (close[1] - low[1]) * 3 < open[1] - close[1] ? (close[2] -
low[2]) * 3 < open[2] - close[2] ? #ff6600 : na : na : na : na : na : na:na : na :
na : na, title= "Three Black Crows")

//////SMA

len6 = input(8, minval=1, title="MA Length", group = "MA's Length", tooltip


="Fastest")
len3 = input(20, minval=1, title="MA Length", group = "MA's Length", tooltip
="Fast")
len5 = input(200, minval=1, title="MA2 Length", group = "MA's Length", tooltip
="Slow")
src2 = input(close, title="MA Source", group = "Source")
out3 = sma(src2, len3)
out5 = sma(src2, len5)
out6 = sma(src2, len6)
plot(out6 and smaplot ? out6 :na, color=color.red, title="MA0")
plot(out3 and smaplot ? out3 :na, color=color.green, title="MA")
plot(out5 and smaplot ? out5 :na, color=color.red, title="MA2")

////////////////RSI
srcRSI = close, lenRSI = input(14, minval=1, title="RSI Length", group = "RSI
Settings")
up = rma(max(change(srcRSI), 0), lenRSI)
down = rma(-min(change(srcRSI), 0), lenRSI)
rsi = down == 0 ? 100 : up == 0 ? 0 : 100 - (100 / (1 + up / down))
//coloring method below
srcRSI1 = close, lenRSI1 = input(60, minval=1, title="Over Bought", group = "RSI
Settings")
srcRSI2 = close, lenRSI2 = input(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 )

////////////Volume Based Support Resistance


Vlength = input(20, minval=1, group = "Volume S/R Settings")
Vchange = volume/volume[1] - 1
stdev = stdev(Vchange, Vlength)
difference = Vchange / stdev[1]
Treshold = input(5)
zero = 0
signal = abs(difference)
vstylee = plot.style_circles

leveluphi = valuewhen(signal > Treshold,high[1],0)


leveluplo = valuewhen(signal > Treshold,low[1],0)

//plot(UpperTreshold, color=black)
p1=plot(vsr and leveluphi ? leveluphi : na,
title="LevelHi",style=vstylee,color=color.blue)
p2=plot(vsr and leveluplo ? leveluplo :
na,title="Levello",style=vstylee,color=color.blue)
fill(p1,p2,color.black,50,"Fill")
/////////////////////Label
//---------------------------------
show_label = input(true, title="Show Label", group = "labels")
//----------------------------------------
fwd_offset = input(75,options=[0,10,20,30,40,75,-75,-40,-30,-20,-
10],title="Offset")
bar_index_duration = time - time[1]
label_fwd_offset = fwd_offset * bar_index_duration
//------------------------------------------------
isbullish = close >= open
label_y_location = close
label_color_transparency = isbullish ? color.new(color.lime, 20) :
color.new(color.red, 20)
label_text_color = isbullish ? color.new(color.lime, 0) :
color.new(color.red, 0)
//label_style = isbullish ? label.style_none : label.style_none
label_size = size.large
label_text_align = text.align_center
//-----------Plot lable----------------------

if show_label
lbl = label.new(
x = time + label_fwd_offset,
y = close,
text = "
👈🦊 IS THERE A SETUP !?? 😂👉 SOH",
xloc = xloc.bar_time,
yloc = yloc.price,
color = label_color_transparency,
style = label.style_none,
textcolor = label_text_color,
size = label_size,
textalign = label_text_align
)
label.delete(lbl[1])
//------------------------------------
Ecandle = input(false, "Indecisive-Candle", group="Settings ॐ", tooltip="Shows
Candle")

cand = high-low
bodyr = open-close

candle = (bodyr*100/cand)

barcolor (Ecandle and candle>-50 and candle <50 ? #0b00ff : na)


//EOS

// ----To draw Fib extensions for uptrend,


// 1. Choose a Pivot Low point (LL or a HL) as Pivot 1
// 2. Choose a Pivot High point (must be higher than Pivot 1) as Pivot 2
// 3. Choose a Pivot Low point (must be lower than Pivot 2, must be Higher than
Pivot 1)

// ----To draw Fib extensions for downtrend,


// 1. Choose a Pivot High point (HH or a LH) as Pivot 1
// 2. Choose a Pivot Low point (must be lower than Pivot 1) as Pivot 2
// 3. Choose a Pivot High point (must be higher than Pivot 2 and lower than Pivot
1)
//Pivot1 = input(true, title="Show Pivot High/Lows")
//UseClose = input(false, "Use Close price for Pivots")
//LP = input(defval = 4, title = "Left bars for Pivot")
//RP = input(defval = 3, title = "Right bars for Pivot")
//TxtColor = input(color.orange, type=input.color, title = "Pivot Text Colour")

//hsrc = UseClose?close:high
//lsrc = UseClose?close:low

//PH1 = pivothigh(hsrc,LP,RP)
//PH = valuewhen(PH1,PH1,0)
//plotshape(Pivot?PH1:na,style=shape.circle, color=#FF4500, text = "H",
textcolor=#000000,location=location.abovebar, offset=-RP, transp = 0, title="Pivot
High")
//BR1=plot(Pivot?PH:na,style=plot.style_circles, linewidth=2,color=high<=PH?
#FF4500:na,title="Pivot High", offset = 0)

//PL1 = pivotlow(lsrc,LP,RP)
//PL = valuewhen(PL1,PL1,0)
//plotshape(Pivot?PL1:na,style=shape.circle, color=#6B8E23, text = "L",
textcolor=#000000,location=location.belowbar, offset=-RP, transp = 0,title="Pivot
Low")
//BR2=plot(Pivot?PL:na,style=plot.style_circles, linewidth=2, color=low>=PL?
#008000:na,title="Pivot Low", offset = 0)

//
═══════════════════════════════════════════════════════════════════════════════════
═══════════════ //
//
// Volume / Volatility AddOns
//
═══════════════════════════════════════════════════════════════════════════════════
═══════════════ //

//
-----------------------------------------------------------------------------------
----------- //
// -Inputs
-----------------------------------------------------------------------------------
--- //

group_vol_vol = "Volume / Volatility AddOns"


tooltip_volume_spike_sign_of_exhaustion = "Moments where\n" +
"huge volume detected : current volume
is grater than the product of the theshold value and volume moving average"

tooltip_high_volatility = "Moments where\n" +


"price range of the current bar is
grater than the product of the theshold value and average true range value of
defined period"

tooltip_volume_weighted_colored_bars = "Volume Weighted Colored Bars\nColors


bars based on the bar's volume relative to volume moving average"

//
-----------------------------------------------------------------------------------
----------- //
// High Volatility
------------------------------------------------------------------------------ //

i_hATRLb =
input(true , "⚡"
, inline = "ATR" ,
group = group_vol_vol, tooltip = tooltip_high_volatility)
i_weightedATR =
atr(input(13 , "ATR : Length"
, inline = "ATR" ,
group = group_vol_vol)) *
input(2.718 , "Mult", minval = .1, step = .1
, inline = "ATR" , group = group_vol_vol)

//
-----------------------------------------------------------------------------------
----------- //
// Volume Moving Average : Base
----------------------------------------------------------------- //

i_vSMA = sma(nz(volume), input(89, "Volume Moving Average Length", group


= group_vol_vol))

//
-----------------------------------------------------------------------------------
----------- //
// Volume Spike - Sign of Exhaustion
------------------------------------------------------------ //

i_vSpikeLb = input(true , "🚦"


, inline = "SRS1", group = group_vol_vol, tooltip =
tooltip_volume_spike_sign_of_exhaustion)
i_vSpikeThresh = input(4.669 , "Volume Spike Theshold ", minval
= .1, step = .1 , inline = "SRS1", group = group_vol_vol)

//
-----------------------------------------------------------------------------------
----------- //
// Volume Weighted Colored Bars
----------------------------------------------------------------- //

i_vwcb = input(true , ""


, inline = "VWC", group = group_vol_vol, tooltip =
tooltip_volume_weighted_colored_bars)
i_vwcbHighThresh = input(1.618 , "VWCB : High ", minval = 1., step
= .1 , inline = "VWC", group = group_vol_vol)
i_vwcbLowThresh = input(0.618 , " Low" , minval = .1, step = .1
, inline = "VWC", group = group_vol_vol)

//
-----------------------------------------------------------------------------------
----------- //
// -Calculations and Plotting
------------------------------------------------------------------- //

nzVolume = nz(volume)
bullCandle = close > open
bearCandle = close < open
range = abs(high - low)
//
-----------------------------------------------------------------------------------
----------- //
// Volume Spike - Sign of Exhaustion
------------------------------------------------------------ //

exhaustVol = nzVolume > i_vSpikeThresh * i_vSMA


plotchar(i_vSpikeLb and nzVolume ? exhaustVol : na, "Exhaustion Bar", "🚦",
location.abovebar, size=size.tiny)
alertcondition(crossover(nzVolume, i_vSMA * i_vSpikeThresh), "Volume Spikes", "sign
of exhaustion, huge volume increase detected\n{{exchange}}:{{ticker}}->\nOpen =
{{open}}, Current = {{close}},\nTime = {{time}}")

//
-----------------------------------------------------------------------------------
----------- //
// High Volatility
------------------------------------------------------------------------------ //

highVolatility = range > i_weightedATR


plotchar(i_hATRLb ? highVolatility : na, "High Volatile Bar", "⚡",
location.belowbar, size=size.tiny)
alertcondition(crossover(range, i_weightedATR), "High Volatility", "high volatility
detected\n{{exchange}}:{{ticker}}->\nOpen = {{open}}, Current = {{close}},\nTime =
{{time}}")

//
-----------------------------------------------------------------------------------
----------- //
// Volume Weighted Colored Bars by Kıvanç Özbilgiç
---------------------------------------------- //

vwcbCol = nzVolume > i_vSMA * i_vwcbHighThresh ?


bullCandle ? #006400 : #910000 :
nzVolume < i_vSMA * i_vwcbLowThresh ?
bearCandle ? #FF9800 : #7FFFD4 :
na

barcolor(i_vwcb and nzVolume ? vwcbCol : na, title = "Volume Weighted Colored


Bars")

// Voloume / Volatility AddOns


//
═══════════════════════════════════════════════════════════════════════════════════
═══════════════ //

fill(TC1, BC1, color = #ffff4d)

You might also like