Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
- // © TaurusTeam
- //@version=4
- study("[TT] Master", shorttitle="ॐ" ,overlay=true)
- fibpivots = input(false,"Fib Pivots")
- Camarilla = input(false,"Cam Pivots")
- SelectColor(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
- res = input("12M", type=input.resolution)
- Ln_color = input(title="Line Color", defval="maroon", options=["aqua", "black", "blue", "fuchsia", "gray", "green", "lime", "maroon", "navy", "olive", "orange", "purple", "red", "silver", "teal", "white", "yellow"])
- Ltx_color = input(title="Text Color", defval="gray", options=["aqua", "black", "blue", "fuchsia", "gray", "green", "lime", "maroon", "navy", "olive", "orange", "purple", "red", "silver", "teal", "white", "yellow"])
- showlast = input(title = "Show Only Last Period", defval = true, tooltip = "Shows only Today levels bar by bar")
- On = input(true, "Day Range", group = "Settings ॐ",tooltip="Day Range")
- OrB = input(false,"ORB", group ="Settings ॐ", tooltip = "ORB")
- sr = input(false,"Show Reversal",group="Settings ॐ")
- PAB = input(true, "Price Action Bars",group="Price Action",tooltip="Price Action Bars")
- //DarkCloudCoverInput = input(true,title="DCC",group="Price Action")
- //PiercingInput = input(false,"Piercing",group="Price Action")
- HammerInput = input(true,"Hammer",group="Price Action")
- HangingManInput = input(true,"Hanging Man",group="Price Action")
- InvertedHammerInput = input(true,"Inverted Hammer",group="Price Action")
- //EngulfingInput = input(true,"Engulfing",group="Price Action")
- RTbearish = input(true,title="Railway Track Bearish",group="Price Action")
- RTbullish = input(true,title="Railway Track Bullish",group="Price Action")
- TTbullish = input(true,title="Tweezer Top Bullish",group="Price Action")
- TTbearish = input(true,title="Tweezer Top Bearish",group="Price Action")
- up = input(defval = color.blue, title="Bullish", group="Settings ॐ", tooltip="Reversal Signal Color")
- down = input(defval = color.orange, title="Bearish", group="Settings ॐ", tooltip="Down Reversal SIgnal Color")
- sl = input(30, title="Show Last", group="Settings ॐ", tooltip ="Show RR in the last Num of bars")
- sig = input(5,"SL length",group="Settings ॐ",tooltip="Length of SL line")
- Ecandle = input(false, "Indecisive-Candle", group="Settings ॐ", tooltip="Shows Indecisive Candle")
- PDHL = input(false,title="Previous Day Levels",group="Settings ॐ",tooltip="Previous Day High/Low")
- ATRTsl = input(false,title="Trailing SL",group="Settings ॐ",tooltip="ATR Trailing SL")
- cprturnon = input(false,"CPR", group="Settings ॐ", tooltip="Plot CPR")
- chtf = security(syminfo.tickerid, res, close[1], lookahead=true)
- hhtf = security(syminfo.tickerid, res, high[1], lookahead=true)
- lhtf = security(syminfo.tickerid, res, low[1], lookahead=true)
- islast = showlast ? security(syminfo.tickerid, res, barstate.islast, lookahead = true) : true
- //Barstate
- confirm = barstate.isconfirmed
- //Label Settings
- mndr = time - time[1]
- mndr := change(mndr) > 0 ? mndr[1] : mndr
- //Yesterday High/Low
- plot(islast and PDHL ? hhtf : na, title = "Day High", color = color.black, linewidth = 2, style = plot.style_line )
- plot(islast and PDHL ? lhtf : na, title = "Day Low", color = color.black, linewidth = 2, style = plot.style_line )
- if 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", 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", textcolor=color.black, style=label.style_none, xloc = xloc.bar_time, yloc=yloc.price)
- //CPR Pivot {
- //////Central Pivot
- Pivot = (hhtf + lhtf + chtf)/3
- BC = (hhtf + lhtf)/2
- TC = (Pivot - BC) + Pivot
- //LineStyle
- linestylee = plot.style_line
- plot(islast and cprturnon ? TC : na, title = "TC", color = color.blue, linewidth = 1, style = linestylee )
- plot(islast and cprturnon ? Pivot : na, title = "Pivot", color = color.red, linewidth = 1, style = linestylee )
- plot(islast and cprturnon ? BC : na, title = "BC", color = color.blue, linewidth = 1, style = linestylee )
- // }
- //Dayly Fibonacci Settings:
- rng = hhtf-lhtf
- //Pivot = (hhtf + lhtf + chtf) / 3
- FR1 = Pivot + 0.382*rng
- FS1 = Pivot - 0.382*rng
- FR2 = Pivot + 0.618*rng
- FS2 = Pivot - 0.618*rng
- FR3 = Pivot + rng
- FS3 = Pivot - rng
- FR4 = Pivot + 1.272*rng
- FS4 = Pivot - 1.272*rng
- DR5 = Pivot + 1.618*rng
- FS5 = Pivot - 1.618*rng
- FR6 = Pivot + 2.058*rng
- FS6 = Pivot - 2.058*rng
- FR7 = Pivot + 2.618*rng
- FS7 = Pivot - 2.618*rng
- if fibpivots
- var line FR1L = na
- var line FpLine = na
- var line FS1L = na
- var line FR2L = na
- var line FS2L = na
- var line FR3L = na
- var line FS3L = na
- var line FR4L = na
- var line FS4L = na
- var line DR5L = na
- var line FS5L = na
- var line FR6L = na
- var line FS6L = na
- var line FR7L = na
- var line FS7L = na
- var label FR1LA = na
- var label FpL = na
- var label FS1LA = na
- var label FR2LA = na
- var label FS2LA = na
- var label FR3LA = na
- var label FS3LA = na
- var label FR4LA = na
- var label FS4LA = na
- var label DR5LA = na
- var label FS5LA = na
- var label FR6LA = na
- var label FS6LA = na
- var label FR7LA = na
- var label FS7LA = na
- if Pivot[1] != Pivot
- line.set_x2(FR1L, bar_index)
- line.set_x2(FS1L, bar_index)
- line.set_x2(FR2L, bar_index)
- line.set_x2(FS2L, bar_index)
- line.set_x2(FR3L, bar_index)
- line.set_x2(FS3L, bar_index)
- line.set_x2(FR4L, bar_index)
- line.set_x2(FS4L, bar_index)
- line.set_x2(DR5L, bar_index)
- line.set_x2(FS5L, bar_index)
- line.set_x2(FR6L, bar_index)
- line.set_x2(FS6L, bar_index)
- line.set_x2(FR7L, bar_index)
- line.set_x2(FS7L, bar_index)
- line.set_extend(FR1L, extend.none)
- line.set_extend(FpLine, extend.none)
- line.set_extend(FS1L, extend.none)
- line.set_extend(FR2L, extend.none)
- line.set_extend(FS2L, extend.none)
- line.set_extend(FR3L, extend.none)
- line.set_extend(FS3L, extend.none)
- line.set_extend(FR4L,extend.none)
- line.set_extend(FS4L,extend.none)
- line.set_extend(DR5L,extend.none)
- line.set_extend(FS5L,extend.none)
- line.set_extend(FR6L,extend.none)
- line.set_extend(FS6L,extend.none)
- line.set_extend(FR7L,extend.none)
- line.set_extend(FS7L,extend.none)
- FR1L := line.new(bar_index, FR1, bar_index, FR1, width=1, extend=extend.none, style=line.style_dotted, color=SelectColor(Ln_color))
- FpLine := line.new(bar_index, Pivot, bar_index, Pivot, width=2, extend=extend.none,style=line.style_solid, color=SelectColor(Ln_color))
- FS1L := line.new(bar_index, FS1, bar_index, FS1, width=1,extend=extend.none, style=line.style_dotted, color=SelectColor(Ln_color))
- FR2L := line.new(bar_index, FR2, bar_index, FR2, width=2, extend=extend.none,style=line.style_solid, color=SelectColor(Ln_color))
- FS2L := line.new(bar_index, FS2, bar_index, FS2, width=2,extend=extend.none,style=line.style_solid, color=SelectColor(Ln_color))
- FR3L := line.new(bar_index, FR3, bar_index, FR3, width=2, extend=extend.none,style=line.style_solid, color=SelectColor(Ln_color))
- FS3L := line.new(bar_index, FS3, bar_index, FS3, width=2,extend=extend.none,style=line.style_solid, color=SelectColor(Ln_color))
- FR4L := line.new(bar_index, FR4, bar_index, FR4, width=1,extend=extend.none,style=line.style_dotted, color=SelectColor(Ln_color))
- FS4L := line.new(bar_index, FS4, bar_index, FS4, width=1,extend=extend.none,style=line.style_dotted, color=SelectColor(Ln_color))
- DR5L := line.new(bar_index, DR5, bar_index, DR5, width=1,extend=extend.none,style=line.style_dotted, color=SelectColor(Ln_color))
- FS5L := line.new(bar_index, FS5, bar_index, FS5, width=1,extend=extend.none,style=line.style_dotted, color=SelectColor(Ln_color))
- FR6L := line.new(bar_index, FR6, bar_index, FR6, width=1,extend=extend.none,style=line.style_dotted, color=SelectColor(Ln_color))
- FS6L := line.new(bar_index, FS6, bar_index, FS6, width=1,extend=extend.none,style=line.style_dotted, color=SelectColor(Ln_color))
- FR7L := line.new(bar_index, FR7, bar_index, FR7, width=2,extend=extend.none,style=line.style_dotted, color=SelectColor(Ln_color))
- FS7L := line.new(bar_index, FS7, bar_index, FS7, width=2,extend=extend.none,style=line.style_dotted, color=SelectColor(Ln_color))
- FR1LA := label.new(bar_index, FR1, "38",textcolor=SelectColor(Ltx_color), style=label.style_none)
- FpL := label.new(bar_index, Pivot, "Pivot", textcolor=SelectColor(Ltx_color), style=label.style_none)
- FS1LA := label.new(bar_index, FS1, "38",textcolor=SelectColor(Ltx_color), style=label.style_none)
- FR2LA := label.new(bar_index, FR2, "61",textcolor=SelectColor(Ltx_color), style=label.style_none)
- FS2LA := label.new(bar_index, FS2, "61",textcolor=SelectColor(Ltx_color), style=label.style_none)
- FR3LA := label.new(bar_index, FR3, "Resistance",textcolor=SelectColor(Ltx_color), style=label.style_none)
- FS3LA := label.new(bar_index, FS3, "Support",textcolor=SelectColor(Ltx_color), style=label.style_none)
- FR4LA := label.new(bar_index, FR4, "1.2",textcolor=SelectColor(Ltx_color), style=label.style_none)
- FS4LA := label.new(bar_index, FS4, "1.2",textcolor=SelectColor(Ltx_color), style=label.style_none)
- DR5LA := label.new(bar_index, DR5, "1.6",textcolor=SelectColor(Ltx_color), style=label.style_none)
- FS5LA := label.new(bar_index, FS5, "1.6",textcolor=SelectColor(Ltx_color), style=label.style_none)
- FR6LA := label.new(bar_index, FR6, "2",textcolor=SelectColor(Ltx_color), style=label.style_none)
- FS6LA := label.new(bar_index, FS6, "2",textcolor=SelectColor(Ltx_color), style=label.style_none)
- FR7LA := label.new(bar_index, FR7, "2.6",textcolor=SelectColor(Ltx_color), style=label.style_none)
- FS7LA := label.new(bar_index, FS7, "2.6",textcolor=SelectColor(Ltx_color), style=label.style_none)
- label.delete(FR1LA[1])
- label.delete(FS1LA[1])
- label.delete(FR2LA[1])
- label.delete(FS2LA[1])
- label.delete(FpL[1])
- label.delete(FR3LA[1])
- label.delete(FS3LA[1])
- label.delete(FR4LA[1])
- label.delete(FS4LA[1])
- label.delete(DR5LA[1])
- label.delete(FS5LA[1])
- label.delete(FR6LA[1])
- label.delete(FS6LA[1])
- label.delete(FR7LA[1])
- label.delete(FS7LA[1])
- line.delete(FR1L[1])
- line.delete(FS1L[1])
- line.delete(FR2L[1])
- line.delete(FS2L[1])
- line.delete(FpLine[1])
- line.delete(FR3L[1])
- line.delete(FS3L[1])
- line.delete(FR4L[1])
- line.delete(FS4L[1])
- line.delete(DR5L[1])
- line.delete(FS5L[1])
- line.delete(FR6L[1])
- line.delete(FS6L[1])
- line.delete(FR7L[1])
- line.delete(FS7L[1])
- if not na(FpLine) and line.get_x2(FpLine) != bar_index
- line.set_x2(FR1L, bar_index)
- line.set_x2(FpLine, bar_index)
- line.set_x2(FS1L, bar_index)
- line.set_x2(FR2L, bar_index)
- line.set_x2(FS2L, bar_index)
- line.set_x2(FR3L, bar_index)
- line.set_x2(FS3L, bar_index)
- line.set_x2(FR4L, bar_index)
- line.set_x2(FS4L, bar_index)
- line.set_x2(DR5L, bar_index)
- line.set_x2(FS5L, bar_index)
- line.set_x2(FR6L, bar_index)
- line.set_x2(FS6L, bar_index)
- line.set_x2(FR7L, bar_index)
- line.set_x2(FS7L, bar_index)
- ///Camarilla Calculation
- 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
- if Camarilla
- var line CR1L = na
- var line CS1L = na
- var line CR2L = na
- var line CS2L = na
- var line CR3L = na
- var line CS3L = na
- var line CR4L = na
- var line CS4L = na
- var line CSLB = na
- var line CSLr = na
- var line CSm = na
- var label CR1LA = na
- var label CS1LA = na
- var label CR2LA = na
- var label CS2LA = na
- var label CR3LA = na
- var label CS3LA = na
- var label CR4LA = na
- var label CS4LA = na
- if Pivot[1] != Pivot
- line.set_x2(CR1L, bar_index)
- line.set_x2(CS1L, bar_index)
- line.set_x2(CR2L, bar_index)
- line.set_x2(CS2L, bar_index)
- line.set_x2(CR3L, bar_index)
- line.set_x2(CS3L, bar_index)
- line.set_x2(CR4L, bar_index)
- line.set_x2(CS4L, bar_index)
- line.set_x2(CSLB, bar_index)
- line.set_x2(CSLr, bar_index)
- line.set_x2(CSm, bar_index)
- line.set_extend(CR1L, extend.none)
- line.set_extend(CS1L, extend.none)
- line.set_extend(CR2L, extend.none)
- line.set_extend(CS2L, extend.none)
- line.set_extend(CR3L, extend.none)
- line.set_extend(CS3L, extend.none)
- line.set_extend(CR4L, extend.none)
- line.set_extend(CS4L, extend.none)
- line.set_extend(CSLB, extend.none)
- line.set_extend(CSLr, extend.none)
- line.set_extend(CSm, extend.none)
- CR1L := line.new(bar_index, H3, bar_index, H3, width=2, extend=extend.none, style=line.style_solid, color=SelectColor(Ln_color))
- CS1L := line.new(bar_index, L3, bar_index, L3, width=2,extend=extend.none, style=line.style_solid, color=SelectColor(Ln_color))
- CR2L := line.new(bar_index, H4, bar_index, H4, width=2, extend=extend.none,style=line.style_solid, color=SelectColor(Ln_color))
- CS2L := line.new(bar_index, L4, bar_index, L4, width=2,extend=extend.none,style=line.style_solid, color=SelectColor(Ln_color))
- CR3L := line.new(bar_index, H5, bar_index, H5, width=1, extend=extend.none,style=line.style_dotted, color=SelectColor(Ln_color))
- CS3L := line.new(bar_index, L5, bar_index, L5, width=1,extend=extend.none,style=line.style_dotted, color=SelectColor(Ln_color))
- CR4L := line.new(bar_index, H6, bar_index, H6, width=1,extend=extend.none,style=line.style_dotted, color=SelectColor(Ln_color))
- CS4L := line.new(bar_index, L6, bar_index, L6, width=1,extend=extend.none,style=line.style_dotted, color=SelectColor(Ln_color))
- CSLB := line.new(bar_index, SLbull, bar_index, SLbull, width=1,extend=extend.none,style=line.style_dotted, color=SelectColor(Ln_color))
- CSLr := line.new(bar_index, SLbear, bar_index, SLbear, width=1,extend=extend.none,style=line.style_dotted, color=SelectColor(Ln_color))
- CSm := line.new(bar_index, mid, bar_index, mid, width=1,extend=extend.none,style=line.style_dotted, color=SelectColor(Ln_color))
- CR1LA := label.new(bar_index, H3, "Sell Reversal",textcolor=SelectColor(Ltx_color), style=label.style_none)
- CS1LA := label.new(bar_index, L3, "Buy Reversal",textcolor=SelectColor(Ltx_color), style=label.style_none)
- CR2LA := label.new(bar_index, H4, "BreakOut",textcolor=SelectColor(Ltx_color), style=label.style_none)
- CS2LA := label.new(bar_index, L4, "BreakOut",textcolor=SelectColor(Ltx_color), style=label.style_none)
- CR3LA := label.new(bar_index, H5, "Target",textcolor=SelectColor(Ltx_color), style=label.style_none)
- CS3LA := label.new(bar_index, L5, "Target",textcolor=SelectColor(Ltx_color), style=label.style_none)
- CR4LA := label.new(bar_index, H6, "Target",textcolor=SelectColor(Ltx_color), style=label.style_none)
- CS4LA := label.new(bar_index, L6, "Target",textcolor=SelectColor(Ltx_color), style=label.style_none)
- label.delete(CR1LA[1])
- label.delete(CS1LA[1])
- label.delete(CR2LA[1])
- label.delete(CS2LA[1])
- label.delete(CR3LA[1])
- label.delete(CS3LA[1])
- label.delete(CR4LA[1])
- label.delete(CS4LA[1])
- line.delete(CR1L[1])
- line.delete(CS1L[1])
- line.delete(CR2L[1])
- line.delete(CS2L[1])
- line.delete(CR3L[1])
- line.delete(CS3L[1])
- line.delete(CR4L[1])
- line.delete(CS4L[1])
- line.delete(CSLB[1])
- line.delete(CSLr[1])
- line.delete(CSm[1])
- if not na(CR1L) and line.get_x2(CR1L) != bar_index
- line.set_x2(CR1L, bar_index)
- line.set_x2(CS1L, bar_index)
- line.set_x2(CR2L, bar_index)
- line.set_x2(CS2L, bar_index)
- line.set_x2(CR3L, bar_index)
- line.set_x2(CS3L, bar_index)
- line.set_x2(CR4L, bar_index)
- line.set_x2(CS4L, bar_index)
- line.set_x2(CSLB, bar_index)
- line.set_x2(CSLr, bar_index)
- line.set_x2(CSm, bar_index)
- ///Ema
- width = input(2, "Line Width")
- show = input(false, "Ema On/Off")
- show2 = input(false,"Show two Ema's")
- show3 = input(false,"Show three Ema's")
- len = input(9, minval=1, title="Fast length")
- len2 = input(27, minval=1, title="Mid Length")
- len3 = input(111, minval=1, title="Slow Length")
- src = input(close, title="Source")
- offset = input(title="Offset", type=input.integer, defval=0, minval=-500, maxval=500)
- out = ema(src, len)
- out1 = ema(src,len2)
- out2 = ema(src, len3)
- plot(show ? out : na, title="EMA", color=color.green,linewidth = width, offset=offset,editable=false)
- plot(show2 ? out1 : na, title="EMA 2", color=color.silver, linewidth = width,offset=offset,editable=false)
- plot(show2 and show3 ? out2 : na, title="EMA 3", color=color.red,linewidth = width, offset=offset,editable=false)
- ///Day Range
- newDay = dayofweek != dayofweek[1]
- fill(plot1=plot(On and islast ? H4 : na, color=na, editable=false),
- plot2=plot(On and islast ? FR2 : na, color=na, editable=false),
- color=newDay ? na : color.new(#ff7700,75))
- fill(plot1=plot(On and islast ? L4 : na, color=na, editable=false),
- plot2=plot(On and islast ? FS2 : na, color=na,editable=false),
- color=newDay ? na : color.new(#000000,75))
- ///////////////Orb
- colBars = input(defval = true, title = 'Colorize Bars') // color or gray bars
- colWicks = input(defval = true, title = 'Colorize Wicks') // color or gray wicks
- shoPush = input(defval = true, title = 'Show Pressure') // color top wicks red and bottom wicks green
- shoFills = input(defval = true, title = 'Show Fills') // fill space with color or off
- shoClose = input(defval = true, title = 'Show Close') // show or hide the first bar of day close
- shoOpen = input(defval = true, title = 'Show Open') // show or hide the first bar of day open
- shoHigh = input(defval = true, title = 'Show High') // show or hide the first bar of day high
- shoHL2 = input(defval = false, title = 'Show HL2') // show or hide the first bar of day mid
- shoLow = input(defval = true, title = 'Show Low') // show or hide the first bar of day low
- shoPLow = input(defval = false, title = 'Show Previous Low',group="Previous Day") // show or hide the first bar of previous day low
- shoprvH = input(defval = false, title = 'Show Previous day High', group = "Previous Day") // Show or hide the first bar of previous day high
- shoprvC = input(defval = false, title = 'Show Previous day Close', group = "Previous Day")// Show or hide the first bar of previous day close
- SLabels = input(defval = false, title = 'Show Labels', group="Previous Day")
- // === PRICE LOGIC ===
- dayOpen = 0.0, dayOpen := newDay ? open : nz(dayOpen[1])
- dayHigh = 0.0, dayHigh := newDay ? high : nz(dayHigh[1])
- prvHigh = 0.0, prvHigh := newDay ? dayHigh[1] : nz(prvHigh[1])
- dayLow = 0.0, dayLow := newDay ? low : nz(dayLow[1])
- prvLow = 0.0, prvLow := newDay ? dayLow[1] : nz(prvLow[1])
- dayClose = 0.0, dayClose := newDay ? close : nz(dayClose[1])
- prvClose = 0.0, prvClose := newDay ? dayClose[1] : nz(prvClose[1])
- dayHL2 = 0.0, dayHL2 := newDay ? hl2 : nz(dayHL2[1])
- // === COLOR LOGIC ===
- isUpDay = dayClose > dayOpen // is first bar of day up or down?
- isColBS = not colBars ? color.new(#787b86, 75) : isUpDay ? color.new(#26a69a, 75) : color.new(#ef5350, 75) // bar color is gray, green or red
- isColWD = not colWicks ? color.new(#787b86, 75) : shoPush ? color.new(#ef5350, 75) : isUpDay ? color.new(#26a69a, 75) : color.new(#ef5350, 75) // top wick color is gray, red, green or red
- isColWU = not colWicks ? color.new(#787b86, 75) : shoPush ? color.new(#26a69a, 75) : isUpDay ? color.new(#26a69a, 75) : color.new(#ef5350, 75) // bot wick color is gray, green, green or red
- // === PLOTS LOGIC ===
- plotDO = plot(OrB and shoOpen ? dayOpen : na, title = 'Open', color = not shoOpen or newDay ? na : isColBS, linewidth = 2, style = plot.style_line)
- plotDH = plot(OrB and shoHigh ? dayHigh : na, title = 'High', color = not shoHigh or newDay ? na : isColWD, linewidth = 1, style = plot.style_line)
- plotDM = plot(OrB and shoHL2 ? dayHL2 : na, title = 'HL2', color = not shoHL2 or newDay ? na : #ffeb3a, linewidth = 1, style = plot.style_line)
- plotDL = plot(OrB and shoLow ? dayLow : na, title = 'Low', color = not shoLow or newDay ? na : isColWU, linewidth = 1, style = plot.style_line)
- plotPL = plot(OrB and shoPLow ? prvLow : na, title = 'P-Low', color = not shoPLow or newDay ? na : #e041fb, linewidth = 2, style = plot.style_line)
- plotDC = plot(OrB and shoClose ? dayClose : na, title = 'Close', color = not shoClose or newDay ? na : isColBS, linewidth = 2, style = plot.style_line)
- plot(OrB and shoprvC ? prvClose : na, title = 'P-Close', color = not shoprvC or newDay ? na : isColBS, linewidth = 1, style = plot.style_line)
- plot(OrB and shoprvH ? prvHigh : na, title = 'P-High', color = not shoprvH or newDay ? na : isColBS, linewidth = 1, style = plot.style_line)
- pushDN = plot(OrB and isUpDay ? dayClose : dayOpen, title = 'Push Dn', color = na) // lo of top wick
- pushUP = plot(OrB and isUpDay ? dayOpen : dayClose, title = 'Push Up', color = na) // hi of bot wick
- fill(plotDH, pushDN, color = not shoFills or newDay ? na : isColWD,title="Top Wick Dn Pressure") // fill color top wick dn pressure
- fill(plotDO, plotDC, color = not shoFills or newDay ? na : isColBS,title="First Bar Up/DN") // fill color bar up or down
- fill(plotDL, pushUP, color = not shoFills or newDay ? na : isColWU,title="Bot Wick Up Pressure") // fill color bot wick up pressure
- /////////Labels
- if SLabels and shoPLow
- var label pvrLowLBL = na
- label.delete(pvrLowLBL)
- pvrLowLBL := label.new(x = time + mndr * 20, y = prvLow, text = "P Low ", color = color.lime, textcolor=color.green, style=label.style_none, xloc = xloc.bar_time, yloc=yloc.price)
- if SLabels and shoClose
- var label DcLbl = na
- label.delete(DcLbl)
- DcLbl := label.new(x = time + mndr * 20, y = dayClose, text = "T Close ", color = color.lime, textcolor=color.black, style=label.style_none, xloc = xloc.bar_time, yloc=yloc.price)
- if SLabels and shoprvC
- var label pvrClvl = na
- label.delete(pvrClvl)
- pvrClvl := label.new(x = time + mndr * 20, y = prvClose, text = "Y Close ", color = color.lime, textcolor=color.black, style=label.style_none, xloc = xloc.bar_time, yloc=yloc.price)
- if SLabels and shoprvH
- var label pvrHlvl = na
- label.delete(pvrHlvl)
- pvrHlvl := label.new(x = time + mndr * 20, y = prvHigh, text = "Y High ", color = color.lime, textcolor=color.black, style=label.style_none, xloc = xloc.bar_time, yloc=yloc.price)
- //////////////
- TR1 = input(27, title= "SMA to determine Trend", minval = 1, maxval = 500)
- TR2 = input(111, title= "SMA to determine Trend", minval = 1, maxval = 500)
- CS = input(14,title="Candle Strength", minval=14,maxval=50)
- C_DownTrend = true
- C_UpTrend = true
- var trendRule1 = "EMA50"
- var trendRule2 = "EMA50, EMA200"
- var trendRule = input(trendRule1, "Detect Trend Based On", options=[trendRule1, trendRule2, "No detection"])
- if trendRule == trendRule1
- priceAvg = ema(close, TR1)
- C_DownTrend := close < priceAvg
- C_UpTrend := close > priceAvg
- if trendRule == trendRule2
- sma200 = ema(close, TR2)
- sma50 = ema(close, TR1)
- C_DownTrend := close < sma50 and sma50 < sma200
- C_UpTrend := close > sma50 and sma50 > sma200
- C_Len = CS // ema depth for bodyAvg
- C_ShadowPercent = 5.0 // size of shadows
- C_ShadowEqualsPercent = 100.0
- C_DojiBodyPercent = 5.0
- C_Factor = 2.0 // shows the number of times the shadow dominates the candlestick body
- C_BodyHi = max(close, open)
- C_BodyLo = min(close, open)
- C_Body = C_BodyHi - C_BodyLo
- C_BodyAvg = ema(C_Body, C_Len)
- C_SmallBody = C_Body < C_BodyAvg
- C_LongBody = C_Body > C_BodyAvg
- C_UpShadow = high - C_BodyHi
- C_DnShadow = C_BodyLo - low
- C_HasUpShadow = C_UpShadow > C_ShadowPercent / 100 * C_Body
- C_HasDnShadow = C_DnShadow > C_ShadowPercent / 100 * C_Body
- C_WhiteBody = open < close
- C_BlackBody = open > close
- C_Range = high-low
- C_IsInsideBar = C_BodyHi[1] > C_BodyHi and C_BodyLo[1] < C_BodyLo
- C_BodyMiddle = C_Body / 2 + C_BodyLo
- C_ShadowEquals = C_UpShadow == C_DnShadow or (abs(C_UpShadow - C_DnShadow) / C_DnShadow * 100) < C_ShadowEqualsPercent and (abs(C_DnShadow - C_UpShadow) / C_UpShadow * 100) < C_ShadowEqualsPercent
- C_IsDojiBody = C_Range > 0 and C_Body <= C_Range * C_DojiBodyPercent / 100
- C_Doji = C_IsDojiBody and C_ShadowEquals
- patternLabelPosLow = low - (atr(30) * 0.99)
- patternLabelPosHigh = high + (atr(30) * 0.99)
- label_color_bullish = input(color.blue, "Label Color Bullish")
- label_color_bearish = input(color.red, "Label Color Bearish")
- label_color_neutral = input(color.gray, "Label Color Neutral")
- text_color_bullish = input(color.green, "Text Color Bull")
- text_color_bearish = input(color.red, "Text color Bear")
- CandleType = input(title = "Pattern Type", defval="Both", options=["Bullish", "Bearish", "Both"])
- C_HammerBullishNumberOfCandles = 1
- C_HammerBullish = false
- if C_SmallBody and C_Body > 0 and C_BodyLo > hl2 and C_DnShadow >= C_Factor * C_Body and not C_HasUpShadow and confirm
- if C_DownTrend
- C_HammerBullish := true
- alertcondition(C_HammerBullish, title = "Hammer – Bullish", message = "New Hammer – Bullish pattern detected")
- if C_HammerBullish and HammerInput and (("Bullish" == CandleType) or CandleType == "Both")
- var ttBullishHammer = "Hammer\nHammer candlesticks form when a security moves lower after the open, but continues to rally into close above the intraday low. The candlestick that you are left with will look like a square attached to a long stick-like figure. This candlestick is called a Hammer if it happens to form during a decline."
- label.new(bar_index, patternLabelPosLow, text="H", style=label.style_none, color = label_color_bullish, textcolor=text_color_bullish, tooltip = ttBullishHammer)
- C_HangingManBearishNumberOfCandles = 1
- C_HangingManBearish = false
- if C_SmallBody and C_Body > 0 and C_BodyLo > hl2 and C_DnShadow >= C_Factor * C_Body and not C_HasUpShadow and confirm
- if C_UpTrend
- C_HangingManBearish := true
- alertcondition(C_HangingManBearish, title = "Hanging Man – Bearish", message = "New Hanging Man – Bearish pattern detected")
- if C_HangingManBearish and HangingManInput and (("Bearish" == CandleType) or CandleType == "Both")
- var ttBearishHangingMan = "Hanging Man\nWhen a specified security notably moves lower after the open, but continues to rally to close above the intraday low, a Hanging Man candlestick will form. The candlestick will resemble a square, attached to a long stick-like figure. It is referred to as a Hanging Man if the candlestick forms during an advance."
- label.new(bar_index, patternLabelPosHigh, text="HM", style=label.style_none, color = label_color_bearish, textcolor=text_color_bearish, tooltip = ttBearishHangingMan)
- C_InvertedHammerBullishNumberOfCandles = 1
- C_InvertedHammerBullish = false
- if C_SmallBody and C_Body > 0 and C_BodyHi < hl2 and C_UpShadow >= C_Factor * C_Body and not C_HasDnShadow and confirm
- if C_DownTrend
- C_InvertedHammerBullish := true
- alertcondition(C_InvertedHammerBullish, title = "Inverted Hammer – Bullish", message = "New Inverted Hammer – Bullish pattern detected")
- if C_InvertedHammerBullish and InvertedHammerInput and (("Bullish" == CandleType) or CandleType == "Both")
- var ttBullishInvertedHammer = "Inverted Hammer\nIf in a downtrend, then the open is lower. When it eventually trades higher, but closes near its open, it will look like an inverted version of the Hammer Candlestick. This is a one-day bullish reversal pattern."
- label.new(bar_index, patternLabelPosLow, text="IH", style=label.style_none, color = label_color_bullish, textcolor=text_color_bullish, tooltip = ttBullishInvertedHammer)
- C_RailwayTrackNumberOfCandles = 2
- C_RailwayTrackBearish = false
- if (C_UpTrend[1] and C_WhiteBody[1] and C_LongBody[1]) and (C_BlackBody and (open > C_BodyMiddle[1] ) and close < C_BodyMiddle[1] and C_LongBody) and confirm
- C_RailwayTrackBearish := true
- alertcondition(C_RailwayTrackBearish, title = "Railway Track – Bearish", message = "New Railway Track – Bearish pattern detected")
- if C_RailwayTrackBearish and RTbearish and (("Bearish" == CandleType) or CandleType == "Both")
- var ttRailwayTrackBearish = "RailwayTrack bearish\nRailway Track Bearish Effective in uptrend and pullback."
- label.new(bar_index, patternLabelPosHigh, text="RT", style=label.style_none, color = label_color_bearish, textcolor=text_color_bearish, tooltip = ttRailwayTrackBearish)
- C_RailwayTrackBullishNumberOfCandles = 2
- C_RailwayTrackBullish = false
- if (C_DownTrend[1] and C_BlackBody[1] and C_LongBody[1]) and (C_WhiteBody and ( open < C_BodyMiddle[1]) and close > C_BodyMiddle[1] and C_LongBody) and confirm
- C_RailwayTrackBullish := true
- alertcondition(C_RailwayTrackBullish, title = "Railway Track – Bullish", message = "Railway Track – Bullish pattern detected")
- if C_RailwayTrackBullish and RTbullish and (("Bullish" == CandleType) or CandleType == "Both")
- var ttRailwayTrackBullish = "Railway Track Bullish\nRailway Track Bullish Effective in Downtrend and Pullback."
- label.new(bar_index, patternLabelPosLow, text="RT", style=label.style_none, color = label_color_bearish, textcolor=text_color_bullish, tooltip = ttRailwayTrackBullish)
- //////////////////////////////////////////////////////////////////////////
- bustyle = input(title = "Bull Signal", options = ['Arrow', 'Triangle', 'Label'], defval ='Label', group = "Style", tooltip = "Change Shape")
- brstyle = input(title = "Bear Signal", options = ['Arrow', 'Triangle', 'Label'], defval ='Label', group = "Style", tooltip = "Change Shape")
- ////Styling
- Bearstyle = brstyle == 'Arrow' ? shape.arrowdown :
- brstyle == 'Triangle' ? shape.triangledown :
- brstyle == 'Label' ? shape.labeldown : na
- Bullstyle = bustyle == 'Arrow' ? shape.arrowup :
- bustyle == 'Triangle' ? shape.triangleup :
- bustyle == 'Label' ? shape.labelup : na
- ////5 Bars
- C01_O = open[4]
- C01_C = close[4]
- C01_H = high[4]
- C01_L = low[4]
- C0_O = open[3]
- C0_C = close[3]
- C0_H = high[3]
- C0_L = low[3]
- C1_O = open[2]
- C1_C = close [2]
- C1_H = high[2]
- C1_L = low[2]
- C2_O = open[1]
- C2_C = close[1]
- C2_L = low[1]
- C2_H = high[1]
- C3_O = open
- C3_C = close
- C3_H = high
- C3_L = low
- //bullish calc first
- candle01_BuB = C01_O - C01_C
- candle01_BuW = C01_H - C01_L
- candle01 = (candle01_BuB*100/candle01_BuW)
- candle0_BuB = C0_O - C0_C
- candle0_BuW = C0_H - C0_L
- candle0 = (candle0_BuB*100/candle0_BuW)
- candle1_BuB = C1_O - C1_C
- candle1_BuW = C1_H - C1_L
- candle1 = (candle1_BuB*100/candle1_BuW)
- candle2_BuB = C2_O - C2_C
- candle2_BuW = C2_H - C2_L
- candle2 = (candle2_BuB*100/candle2_BuW)
- candle3_BuB = C3_C - C3_O
- candle3_BuW = C3_H - C3_L
- candle3 = (candle3_BuB*100/candle3_BuW)
- ////////Plot Reversal Pattern
- per = input(50,title="1st Candle",minval=50, maxval=90)
- perc = input(50,title="1st Candle",minval=50, maxval=90)
- bool bullTypeA = (candle1 > per) and (candle2 < 50) and (candle2 > -50) and (C2_L < C1_L) and (candle3 > perc) and (C2_L < C3_L or C3_H > C2_H) and (confirm)
- bool bullTypeB = (candle0 > per) and (candle1 < 50) and (candle1 > -50) and (candle2 < 50) and (candle2 > -50) and (candle3 > perc) and ( C2_L < C3_L or C3_H > C2_H) and (confirm)
- bool bullTypeC = (candle01 > per) and (candle0 < 50) and (candle0 > -50) and (candle1 < 50) and (candle1 > -50) and (candle2 < 50) and (candle2 > -50) and (candle3 > perc) and ( C2_L < C3_L or C3_H > C2_H) and (confirm)
- bool bullStar = (bullTypeA or bullTypeB or bullTypeC) ? 1 : 0
- //plotshape(bullTypeA, title="Bull Type A", style = linestyle, location = location.belowbar, color = color.green, size = Sstyle)
- //plotshape(bullTypeB, title="Bull Type B", style = linestyle, location = location.belowbar, color = color.blue, size = Sstyle)
- //plotshape(bullTypeC, title="Bull Type C", style = linestyle, location = location.belowbar, color = color.purple, size = Sstyle)
- /////////////////////////////////Bearish Calc
- candle01_BrB = C01_C - C01_O
- candle01_BrW = C01_H - C01_L
- candle01br = (candle01_BrB*100/candle01_BrW)
- candle0_BrB = C0_C - C0_O
- candle0_BrW = C0_H - C0_L
- candle0br = (candle0_BrB*100/candle0_BrW)
- candle1_BrB = C1_C - C1_O
- candle1_BrW = C1_H - C1_L
- candle1_Br = (candle1_BrB*100/candle1_BrW)
- candle2_BrB = C2_C - C2_O
- candle2_BrW = C2_H - C2_L
- candle2_Br = (candle2_BrB*100/candle2_BrW)
- candle3_BrB = C3_O - C3_C
- candle3_BrW = C3_H - C3_L
- candle3_Br = (candle3_BrB*100/candle3_BrW)
- bool bearTypeA = (candle1_Br > per) and (candle2_Br < 50) and (candle2_Br > -50)and (candle3_Br > perc) and (C3_L < C2_L) and (confirm)
- bool bearTypeB = (candle0br > per) and (candle1_Br < 50) and (candle1_Br > -50) and (candle2_Br < 50) and (candle2_Br > -50) and (candle3_Br > perc) and (C2_H > C3_H or C3_L < C2_L) and (confirm)
- bool bearTypeC = (candle01br > per) and (candle0br < 50) and (candle0br > -50) and (candle1_Br < 50) and (candle1_Br > -50) and (candle2_Br < 50) and (candle2_Br > -50) and (candle3_Br > perc ) and (C2_H > C3_H or C3_L < C2_L) and (confirm)
- bool bearStar = (bearTypeA or bearTypeB or bearTypeC) ? 1 : 0
- prev = 0
- prev := bullStar ? 1: bearStar ? 1 : prev[1]
- bull_final = bullStar and prev[1] == 1
- bear_final = bearStar and prev[1] == 1
- plotshape(sr and bull_final, title="3 Bar Bull", style = Bullstyle, location = location.belowbar, color = up, size = size.small, show_last=sl, editable=false)
- plotshape(sr and bear_final, title="Bearish Reverse", style = Bearstyle, location = location.abovebar, color = down, size = size.small, show_last=sl, editable=false)
- //plotshape(bullTypeBA, title="Bear Type A", style = linestyle, location = location.abovebar, color = color.green, size = Sstyle)
- //plotshape(bullTypeBB, title="Bear Type B", style = linestyle, location = location.abovebar, color = color.blue, size = Sstyle)
- //plotshape(bullTypeBC, title="Bear Type C", style = linestyle, location = location.abovebar, color = color.purple, size = Sstyle)
- lineLength=sig
- f_timeDelta() =>
- var timeDelta = 10e15
- timeDelta := min(time - nz(time[1]), timeDelta)
- ofst = int(time + f_timeDelta() * lineLength)
- haBull = ohlc4
- mn = min ( low[1],low[3],low[2])
- hl = max (high[1], high[3],high[2])
- var line _mn = na, var line _hl = na, var line _ha = na
- var label l_mn = na, var label l_hl = na, var label l_ha = na
- if sr and bull_final== 1
- _mn := line.new(time, mn , ofst, mn , xloc = xloc.bar_time, color = color.aqua, width=2)
- line.delete(_mn[1])
- l_mn := label.new(x = time + mndr * sig, y = mn, text = "SL ", color = color.lime, textcolor=color.black, style=label.style_none, xloc = xloc.bar_time, yloc=yloc.price)
- label.delete(l_mn[1])
- if sr and bear_final== 1
- _hl := line.new(time, hl , ofst, hl , xloc = xloc.bar_time, color = color.orange, width=2)
- line.delete(_hl[1])
- l_hl := label.new(x = time + mndr * sig, y = hl, text = "SL ", color = color.red, textcolor=color.black, style=label.style_none, xloc = xloc.bar_time, yloc=yloc.price)
- label.delete(l_hl[1])
- ///////////////
- if C_RailwayTrackBullish or C_RailwayTrackBearish
- _ha := line.new(time, haBull, ofst, haBull, xloc = xloc.bar_time, color = color.red, width=1)
- line.delete(_ha[1])
- l_ha := label.new(x = time + mndr * sig, y = haBull, text = "SL ", color = color.red, textcolor=color.black, style=label.style_none, xloc = xloc.bar_time, yloc=yloc.price,tooltip="If a bar closes below this line Railway track is invalid.")
- label.delete(l_ha[1])
- ////////
- 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] ? #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")
- //Three White Soldiers
- TWS = 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
- barcolor(PAB ? TWS : na, title="Three white soliders")
- TBC = 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
- barcolor (PAB ? TBC : na, title = "Three Black Crows")
- 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" )
- ///
- cand = high-low
- bodyr = open-close
- candle = (bodyr*100/cand)
- barcolor (Ecandle and candle>-50 and candle < 50 ? #26c6da : na)
- /////
- ////////////Volume Based Support Resistance
- vsr = input(false,"Sup/Res Vol based", group ="Settings ॐ", tooltip="Volume Based S/r for stocks")
- 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=color.new(color.black,50),title="Fill")
- /////// Tweezer top & Bottom
- //enable_tweezer = input(defval = true, title = "Enable Tweezer", group ="Settings ॐ", tooltip = "Tweezertop & Bottom Activation")
- maxrate = input(defval = 150., title = "Max Rate % Between Wick Sizes") / 100.
- leveldiff = input(defval = 20., title = "Max Difference in level %") / 100.
- prd =input(defval = 5, title = "Highest/Lowest Period")
- apartprd = input(defval = 12, title = "Max Distance between Tweezers", minval = 1)
- topwick = high - max(close, open)
- bottomwick = min(close, open) - low
- body = abs(close - open)
- ishb = highestbars(prd) == 0
- islb = lowestbars(prd) == 0
- aparttweezers_top(len)=>
- ret = 0
- if topwick > 0
- for x = 1 to apartprd
- if nz(topwick[x]) == 0
- break
- if (max(topwick, topwick[x]) / min(topwick, topwick[x])) <= maxrate and abs(high - high[x]) < max(topwick, topwick[x]) * leveldiff and ishb[x]
- ret := x
- break
- else
- if high[x] >= high
- ret := 0
- break
- ret
- aparttweezers_bottom(len)=>
- ret = 0
- if bottomwick > 0
- for x = 1 to apartprd
- if nz(bottomwick[x]) == 0
- break
- if (max(bottomwick, bottomwick[x]) / min(bottomwick, bottomwick[x])) <= maxrate and abs(low - low[x]) < max(bottomwick, bottomwick[x]) * leveldiff and islb[x]
- ret := x
- break
- else
- if low[x] <= low
- ret := 0
- break
- ret
- top_tweezer = false
- if C_UpTrend[1] and aparttweezers_top(apartprd)
- top_tweezer := true
- alertcondition(top_tweezer, title = "Tweezer Top – Bearish", message = "TT Bearish – Bearish pattern detected")
- if top_tweezer and TTbearish and (("Bearish" == CandleType) or CandleType == "Both")
- var tttweezertop = "Tweezer Top bearish\n Tweezer Top Bearish Effective in uptrend and pullback."
- label.new(bar_index, patternLabelPosHigh, text="TT", style=label.style_none, color = label_color_bearish, textcolor=text_color_bearish, tooltip = tttweezertop)
- bottom_tweezer = false
- if C_DownTrend[1] and aparttweezers_bottom(apartprd)
- bottom_tweezer := true
- alertcondition(bottom_tweezer, title = "Tweezer Bottom – Bullish", message = "TT Bullish – Bullish pattern detected")
- if bottom_tweezer and TTbullish and (("Bullish" == CandleType) or CandleType == "Both")
- var tttweezerbot = "Tweezer Bottom bullish\n Tweezer Top Bullish Effective in uptrend and pullback."
- label.new(bar_index, patternLabelPosLow, text="TT", style=label.style_none, color = label_color_bullish, textcolor=text_color_bullish, tooltip = tttweezerbot)
- // ATR Trailing SL {
- nATRPeriod = input(5)
- nATRMultip = input(3.5)
- xATR = atr(nATRPeriod)
- nLoss = nATRMultip * xATR
- xATRTrailingStop = 0.0
- xATRTrailingStop :=iff(close > nz(xATRTrailingStop[1], 0) and close[1] > nz(xATRTrailingStop[1], 0), max(nz(xATRTrailingStop[1]), close - nLoss),
- iff(close < nz(xATRTrailingStop[1], 0) and close[1] < nz(xATRTrailingStop[1], 0), min(nz(xATRTrailingStop[1]), close + nLoss),
- iff(close > nz(xATRTrailingStop[1], 0), close - nLoss, close + nLoss)))
- 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_right , 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)
- //}
Advertisement
Add Comment
Please, Sign In to add comment