INDIBOT PRO ANAKLYS ABO SALTAN //@version=5
indicator(title = "INDIBOT PRO ANAKLYS", overlay = true, max_bars_back = 5000, max_lines_count = 500, max_boxes_count = 500, max_labels_count = 500,calc_bars_count = 5000)
showHL = input.bool(false, "Major Pullback", inline = "HL", group = "Pullback", inline = 'smc11')
colorHL = input.color(#000000, "", group = "Pullback", inline='smc11')
showMn = input.bool(false, "Minor pullback", group = "Pullback")
//market structure
showSMC = input.bool(true, "True SMC Market Structure", group = "Market Structure",inline ='smc1')
lengSMC = input.int(40, title=": Lenght", inline="liveSMC", group="Market Structure", inline = 'smc1')
colorIDM = input.color(color.rgb(0, 0, 0, 20), "IDM", group = "Market Structure")
structure_type = input.string ("Choch with IDM",title='Smc Structure Type ', group="Market Structure", options= )
showCircleHL = input.bool(true, "True SMC Swing", inline = "HL", group = "Market Structure")
bull = input.color(color.green, "Bullish", group = "Market Structure",inline = 'smc12')
bear = input.color(color.red , "Bearish", group = "Market Structure",inline = 'smc12')
// mitatypeTouch = input.string("Touch","Mitigation Type",options = ,group = "Order Block") == "Touch"
//order block
extndBox = input.bool(true,"Extend box on break",group = "Order Block")
showExob = input.bool(true,"Show EXT OB",group = "Order Block")
showIdmob = input.bool(true,"Show IDM OB",group = "Order Block")
showBrkob = input.bool(true,"Show Break EXT OB & IDM OB ",group = "Order Block")
txtsiz = input.string( size.auto ,"EXT OB & IDM OB Text Size",options = ,group ='Order Block')
clrtxtextbullbg = input.color(color.rgb(76, 175, 79, 86),"EXT OB BG Color : Demand",group = "Order Block",inline = "clr13")
clrtxtextbearbg = input.color(color.rgb(255, 82, 82, 83),"Supply",group = "Order Block",inline = "clr13")
clrtxtextbulliembg = input.color(color.rgb(76, 175, 79, 86),"IDM OB BG Color : Demand",group = "Order Block",inline = "clr113")
clrtxtextbeariembg = input.color(color.rgb(255, 82, 82, 86),"Supply",group = "Order Block",inline = "clr113")
clrtxtextbull = input.color(color.green,"EXT OB Text Color : Demand",group = "Order Block",inline = "clr1")
clrtxtextbear = input.color(color.red,"Supply",group = "Order Block",inline = "clr1")
clrtxtextbulliem = input.color(color.green,"IDM OB Text Color : Demand",group = "Order Block",inline = "clr11")
clrtxtextbeariem = input.color(color.red,"Supply",group = "Order Block",inline = "clr11")
showPOI = input.bool(true, "(Order + Breaker + Mitigation + propulsion) Block", group="Order Block")
poi_type = input.string ("Mother Bar",title='Zone Type', group="Order Block", options= )
colorSupply = input.color(#cd5c4800, 'Bullish', group = "Order Block")
colorDemand = input.color(#2f825f00, 'Bearish', group = "Order Block")
colorMitigated = input.color(#c0c0c000, 'Mitigated', group = "Order Block")
showSCOB = input.bool(true, "Show SCOB", inline = "Bar", group = "Order Block")
scobUp = input.color(#0b3ff9 , "Bullish SCOB", group = "Order Block")
scobDn = input.color(#da781d, "Bearish SCOB", group = "Order Block")
//Demand Zone & Supply Zone
show_order_blocks=input.bool(false,"Demand & Supply Zone",group = 'Demand Zone & Supply Zone', inline = 'smc6')
ibull_ob_css = input.color(#5f6b5d19, 'Demand Zone', inline = 'ob1', group = 'Demand Zone & Supply Zone')
ibear_ob_css = input.color(#ef3a3a19, 'Supply Zone', inline = 'ob1', group = 'Demand Zone & Supply Zone')
ob_type__ = 'All' //ob_type__= input.string('All', '',options = , group = 'Order Blocks',inline = 'ob1')
i_tf_ob = input.timeframe("", "Zone Timeframe", group = 'Demand Zone & Supply Zone')
mittigation_filt= 'wick' //input.string('Wicks', "Mitigation Method",options = , group = 'Demand Zone & Supply Zone',inline = 'smc6')
overlapping_filt= true //input(false, 'Hide Overlap', inline = 'ob3', group = 'Order Blocks')
max_obs = input.int(8, 'Max OBs', minval = 3, group = 'Demand Zone & Supply Zone', inline = 'ob4')
length_extend_ob = input.int(defval = 20,title = "Length", minval = 0, maxval = 500 ,group = 'Demand Zone & Supply Zone', inline = "ob4")
ob_extend =false //input.bool(false,"Extend",group = 'Demand Zone & Supply Zone', inline = "ob4")
text_size_ob_ = size.normal
ob_text_color_1 = color.new(#787b86, 0)
volume_text = false //input.bool(false, 'Volume', group='Order Blocks',inline = 'ob1_t')
percent_text = false //input.bool(false, 'Percentage', group='Order Blocks',inline = 'ob1_t')
show_line_ob_1 = false
line_style_ob_1 = line.style_solid
//Order flow
// mitatypeTouchof = input.string("Touch","Mitigation Type",options = ,group = "Order Flow") == "Touch"
showMajoinMiner = input.bool(false,"Show Major OF's",group = "Order Flow",inline = "mc")
showISOB = input.bool(true,"Show Minor OF's",group = "Order Flow",inline = "mc1")
showMajoinMinerMax = input.int(10," : Max Count",group = "Order Flow",inline = "mc")
showISOBMax = input.int(10," : Max Count",group = "Order Flow",inline = "mc1")
showTsted = input.bool(false,"Show Break ",inline = "tstd",group = "Order Flow")
maxTested = input.int(20,"OF's Count",inline = "tstd",group = "Order Flow")
ClrMajorOFBull = input.color(color.rgb(33, 149, 243, 71),"Major ORDER FLOW COLOR", group = "Order Flow",inline = "mj")
ClrMajorOFBear = input.color(color.rgb(33, 149, 243, 72),"", group = "Order Flow",inline = "mj")
ClrMinorOFBull = input.color(color.rgb(155, 39, 176, 81),"Minor ORDER FLOW COLOR", group = "Order Flow",inline = "mj1")
ClrMinorOFBear = input.color(color.rgb(155, 39, 176, 86),"", group = "Order Flow",inline = "mj1")
clrObBBTated = input.color(color.rgb(136, 142, 252, 86),"Major/Minor OB Tested", group = "Order Flow")
//Candle
showISB = input.bool(false, 'Inside Bar Candle', inline = "smc3", group = "Candle")
colorOSB_up = input.color(#0b3ff9,'',inline = 'smc3', group = "Candle")
showOSB = input.bool(false, 'Outside Bar Candle', inline = "smc4", group = "Candle")
colorOSB_down = input.color(#da781d,'', group = "Candle", inline = 'smc4')
colorISB = input.color(color.rgb(187, 6, 247, 77),'Inside Bar', group = "Candle")
//fvg
show_fvg = input(false, 'Fair Value Gaps (FVG)', group = 'Fair Value Gaps', inline = 'fvg_css')
i_tf = input.timeframe("", "Timeframe", group = 'Fair Value Gaps',inline = 'smc7')
max_width_fvg = 1.5
remove_small = true //input.bool(true,"Filter FVG",group = 'Fair Value Gaps', inline = "width")
mittigation_filt_fvg= input.string('Touch', 'Mitigation Method',options = , group = 'Fair Value Gaps', inline = "smc7")
fvg_color_fill = true // input.bool(true,"Fill",group = 'Fair Value Gaps', inline = "mt")
fvg_shade_fill = false //input.bool(false,"Shade",group = 'Fair Value Gaps', inline = "mt")
max_fvg = input.int(defval = 8,title = ": No", minval = 0, maxval = 50 ,group = 'Fair Value Gaps', inline = 'fvg_css')
length_extend = input.int(defval = 20,title = "Length", minval = 0, maxval = 100 ,group = 'Fair Value Gaps', inline = "OS")
fvg_extend =false //input.bool(false,"Extend",group = 'Fair Value Gaps', inline = "OS")
i_mtfbearishfvgcolor = input.color(color.yellow, "", group = 'Fair Value Gaps', inline = "fvg_css")
i_mtfbullishfvgcolor = input.color(color.yellow, "", group = 'Fair Value Gaps', inline = "fvg_css")
mid_style = 'Solid'
i_midPointColor = color.rgb(249, 250, 253, 99)
fvg_extend_B = true //input.bool(true,"Extend (Current)",group = 'Fair Value Gaps', inline = "mid")
//liquidity
liquidity_level_group = "Liquidity Levels"
currentTF = input.bool(false, title = "Liquidity Levels", group=liquidity_level_group, inline="smc8")
displayLimit = input.int(20, title = ": No", group=liquidity_level_group, inline="smc8")
lowLineColorHTF = input.color(#00bbf94d, "", group = liquidity_level_group, inline = "smc8")
highLineColorHTF = input.color(#e91e624d, "", group = liquidity_level_group, inline = "smc8")
htfTF = input.timeframe("", title = "Timeframe", inline="smc9",group=liquidity_level_group)
_candleType = input.string("Close", title = "Mitigation Method", options= , group=liquidity_level_group,inline = 'smc9')
leftBars = 20 //input.int(8, title = "Pivot Length", group=liquidity_level_group, inline="2")
mitiOptions = 'Remove' //input.string("Remove", title = "Mitigated", inline="3", options= , group=liquidity_level_group)
length_extend_liq = input.int(defval = 20,title = "Length", minval = 0, maxval = 500 ,group = liquidity_level_group, inline = "smc10")
extentionMax = false //input.bool(false, title = "Extend", group=liquidity_level_group, inline="4")
_highLineStyleHTF = "Solid"//input.string("Solid", title = "Line Style", options= , group=liquidity_level_group,inline='5')
highLineStyleHTF = _highLineStyleHTF=="Solid" ? line.style_solid : _highLineStyleHTF=="Dashed" ? line.style_dashed : line.style_dotted
box_width = 2.5//input.float(3.0, title = "Width", group=liquidity_level_group,inline='5', minval = 1, maxval = 10, step = 0.5)
lineWidthHTF=2
liquidity_text_color = input.color(color.black , 'Text Color', inline = 'smc10', group = liquidity_level_group)
highBoxBorderColorHTF = color.new(highLineColorHTF,90)
lowBoxBorderColorHTF = color.new(lowLineColorHTF,90)
displayStyle_liq = "Boxes"//'Lines'
isOTE = input.bool(false,"Show OTE", inline = "ote", group = "Structure")
ote1 = input.float(0.78,"",inline = "ote",group = "Structure")
ote2 = input.float(0.61,"",inline = "ote",group = "Structure")
oteclr = input.color(#ff95002b,"",inline = "ote",group = "Structure")
sizGd = input.string(size.normal,"OTE Zone Size",options = ,group = "Structure")
// maxOTECount = input.int(20, title="Max OTE Count", inline = "maxote", group="Structure")
showPdh = input.bool(false,"Show PDH", inline = "PDH", group = "Structure")
lengPdh = input.int(40, title="", inline = "PDH", group="Structure")
showPdl = input.bool(false,"Show PDL", inline = "PDL", group = "Structure")
lengPdl = input.int(40, title="", inline = "PDL", group="Structure")
showMid = input.bool(true, "Show Equilibrium", inline = "mid", group = "Structure")
lengMid = input.int(40, title="", inline = "mid", group="Structure")
showSw = input.bool(true, "Show Swing Sweep", inline = "sweep", group = "Structure")
markX = input.bool(false, 'Mark "X"', inline = "sweep", group = "Structure")
colorSweep = input.color(color.gray, "", group = "Structure", inline = 'sweep')
showTP = false //input.bool(false, 'Show Target profit',group = 'Structure')
colorTP = color.new(color.purple, 0) // 0 is full opacity
mergeRatio = 0.1 // Set a default value
maxBarHistory = 2000 // Default value to avoid errors
//#region variable declaration
//Constant
const string IDM_TEXT = "I D M"
const string CHOCH_TEXT = "CHoCH"
const string BOS_TEXT = "B O S"
const string PDH_TEXT = "PDH"
const string PDL_TEXT = "PDL"
const string MID_TEXT = "0.5"
//line babel
var label idm_label = na
var line idm_line = na
var label choch_label = na
var line choch_line = na
var label bos_label = na
var line bos_line = na
var line pdh_line = na
var label pdh_label = na
var line pdl_line = na
var label pdl_label = na
var line mid_line = na
var line mid_line1 = na
var line mid_line2 = na
var label mid_label = na
var label mid_label1 = na
var label mid_label2 = na
//high low
var puHigh = high
var puLow = low
var puHigh_ = high
var puLow_ = low
var L = low
var H = high
var idmLow = low
var idmHigh = high
var lastH = high
var lastL = low
var H_lastH = high
var L_lastHH = low
var H_lastLL = high
var L_lastL = low
var motherHigh = high
var motherLow = low
//bar indexes
var int motherBar = time
var int puBar = na
var int puHBar = na
var int puLBar = na
var int idmLBar = na
var int idmHBar = na
var int HBar = time
var int LBar = time
var int lastHBar = time
var int lastLBar = time
//structure confirm
var bool mnStrc = na
var bool prevMnStrc = na
var bool isPrevBos = na
var bool findIDM = false
var bool isBosUp = false
var bool isBosDn = false
var bool isCocUp = true
var bool isCocDn = true
//poi
var bool isSweepOBS = false
var int current_OBS = na
var float high_MOBS = na
var float low_MOBS = na
var bool isSweepOBD = false
var int current_OBD = na
var float low_MOBD = na
var float high_MOBD = na
//Array
var arrTopBotBar = array.new_int(1, time)
var arrTop = array.new_float(1, high)
var arrBot = array.new_float(1, low)
var arrPbHBar= array.new_int(0)
var arrPbHigh = array.new_float(0)
var arrPbLBar = array.new_int(0)
var arrPbLow = array.new_float(0)
var demandZone = array.new_box(0)
var supplyZone = array.new_box(0)
var supplyZoneIsMit = array.new_int(0)
var demandZoneIsMit = array.new_int(0)
var arrIdmHigh = array.new_float(0)
var arrIdmLow = array.new_float(0)
var arrIdmHBar = array.new_int(0)
var arrIdmLBar = array.new_int(0)
var arrLastH = array.new_float(0)
var arrLastHBar = array.new_int(0)
var arrLastL = array.new_float(0)
var arrLastLBar = array.new_int(0)
var arrIdmLine = array.new_line(0)
var arrIdmLabel = array.new_label(0)
var arrBCLine = array.new_line(0)
var arrBCLabel = array.new_label(0)
var arrHLLabel = array.new_label(0)
var arrHLCircle = array.new_label(0)
//color
color transp = color.new(color.gray,100)
//Caculate
curTf = timeframe.in_seconds(timeframe.period)
dayTf = timeframe.in_seconds("1D")
i_loop = 2*dayTf/curTf
= request.security(syminfo.tickerid, 'D', [high , low ])
len = curTf*1000
//#endregion
//#region Inside Bar
isb = motherHigh > high and motherLow < low
if isb
motherHigh := motherHigh
motherLow := motherLow
motherBar := motherBar
else
motherHigh := high
motherLow := low
motherBar := time
//#endregion
//#region drawing function
isGreenBar(int bar) => close > open
textCenter(int left, int right) => int(math.avg(left,right))
getStyleLabel(bool style) => style ? label.style_label_down : label.style_label_up
getStyleArrow(bool style) => style ? label.style_arrowdown : label.style_arrowup
getYloc(bool style) => style ? yloc.abovebar : yloc.belowbar
getDirection(bool trend, int HBar, int LBar, float H, float L) =>
x = trend ? HBar : LBar
y = trend ? H : L
getTextLabel(float current, float last, string same, string diff) => current > last ? same : diff
getPdhlBar(float value) =>
int x = na
if value == pdh
for i = i_loop to 1 by 1
if (high == pdh)
x := time
break
else
for i = i_loop to 1 by 1
if (low == pdl)
x := time
break
x
updateTopBotValue() =>
array.push(arrTop, high)
array.push(arrBot, low)
array.push(arrTopBotBar, time)
updateLastHLValue() =>
array.push(arrLastH,lastH)
array.push(arrLastHBar,lastHBar)
array.push(arrLastL,lastL)
array.push(arrLastLBar,lastLBar)
updateIdmHigh() =>
array.push(arrIdmHigh,puHigh)
array.push(arrIdmHBar,puHBar)
updateIdmLow() =>
array.push(arrIdmLow,puLow)
array.push(arrIdmLBar,puLBar)
getNLastValue(arr, n) =>
if array.size(arr) > n - 1
array.get(arr, array.size(arr) - n)
removeNLastLabel(arr, n) =>
if array.size(arr) > n - 1
label.delete(array.get(arr, array.size(arr) - n))
removeNLastLine(arr, n) =>
if array.size(arr) > n - 1
line.delete(array.get(arr, array.size(arr) - n))
removeLastLabel(arr, n) =>
if array.size(arr) > n - 1
for i = 1 to n
label.delete(array.get(arr, array.size(arr) - i))
removeLastLine(arr, n) =>
if array.size(arr) > n - 1
for i = 1 to n
line.delete(array.get(arr, array.size(arr) - i))
var arrmitOBBulla = array.new_bool(0)
var arrmitOBBull = array.new_box(0)
// var arrmitOBBulli = array.new_int(0)
var arrmitOBBeara = array.new_bool(0)
var arrmitOBBear = array.new_box(0)
// var arrmitOBBeari = array.new_int(0)
if extndBox
if arrmitOBBull.size() > 0
i = 0
while i < arrmitOBBull.size()
bx = arrmitOBBull.get(i)
bx.set_right(time)
if close > bx.get_top() and not arrmitOBBulla.get(i)
arrmitOBBulla.set(i,true)
if low < bx.get_top() and arrmitOBBulla.get(i)
//bx.set_right(arrmitOBBulli.get(i))
//arrmitOBBulli.remove(i)
arrmitOBBull.remove(i)
arrmitOBBulla.remove(i)
i -= 1
i += 1
if arrmitOBBear.size() > 0
i = 0
while i < arrmitOBBear.size()
bx = arrmitOBBear.get(i)
bx.set_right(time)
if close < bx.get_bottom() and not arrmitOBBeara.get(i)
arrmitOBBeara.set(i,true)
if high > bx.get_bottom() and arrmitOBBeara.get(i)
//bx.set_right(arrmitOBBeari.get(i))
//arrmitOBBeari.remove(i)
arrmitOBBear.remove(i)
arrmitOBBeara.remove(i)
i -= 1
i += 1
removeZone(zoneArray, box zone,zoneArrayisMit,isBull) =>
index = array.indexof(zoneArray, zone)
if not showBrkob
box.delete(zone)
else
box.set_right(zone, time)
box.set_extend(zone,extend.none)
// box.set_bgcolor(zone, colorMitigated)
// box.set_border_color(zone, colorMitigated)
if not isBull
arrmitOBBull.unshift(zone)
// arrmitOBBulli.unshift(time)
arrmitOBBulla.unshift(false)
else
arrmitOBBear.unshift(zone)
// arrmitOBBeari.unshift(time)
arrmitOBBeara.unshift(false)
array.remove(zoneArray, index)
array.remove(zoneArrayisMit, index)
fixStrcAfterBos() =>
removeLastLabel(arrBCLabel, 1)
removeLastLine(arrBCLine, 1)
removeLastLabel(arrIdmLabel, 1)
removeLastLine(arrIdmLine, 1)
removeLastLabel(arrHLLabel, 2)
removeLastLabel(arrHLCircle, 2)
fixStrcAfterChoch() =>
removeLastLabel(arrBCLabel, 2)
removeLastLine(arrBCLine, 2)
removeNLastLabel(arrHLLabel, 2)
removeNLastLabel(arrHLLabel, 3)
removeNLastLabel(arrHLCircle, 2)
removeNLastLabel(arrHLCircle, 3)
removeNLastLabel(arrIdmLabel, 2)
removeNLastLine(arrIdmLine, 2)
var float lstHlPrs = na
var float lstHlPrsIdm = na
var box lstBxIdm = na
drawIDM(bool trend) =>
= getDirection(trend, idmLBar, idmHBar, idmLow, idmHigh)
//label.new(bar_index,low)
box lstBx_ = na
if trend
idx = -1
float lstPrs = na
if demandZone.size() > 0
for i = 0 to demandZone.size() -1
bx = demandZone.get(i)
if demandZoneIsMit.get(i) == 0 and ((bx.get_top() > lstPrs) or na(lstPrs)) and bx.get_top() <= y and bx.get_bottom() >= lstHlPrsIdm
idx := i
lstPrs := bx.get_top()
if idx != -1
lstBxIdm.set_text("Hist IDM OB")
lstBx_ := demandZone.get(idx)
if showIdmob
demandZone.get(idx).set_text("IDM OB")
demandZone.get(idx).set_text_color(clrtxtextbulliem)
demandZone.get(idx).set_bgcolor(clrtxtextbulliembg)
demandZoneIsMit.set(idx,1)
else
removeZone(demandZone,demandZone.get(idx),demandZoneIsMit,true)
else
idx = -1
float lstPrs = na
if supplyZone.size() > 0
for i = 0 to supplyZone.size() -1
bx = supplyZone.get(i)
if supplyZoneIsMit.get(i) == 0 and ((bx.get_bottom() < lstPrs) or na(lstPrs)) and bx.get_bottom() >= y and bx.get_top() <= lstHlPrsIdm
idx := i
lstPrs := bx.get_top()
if idx != -1
lstBxIdm.set_text("Hist IDM OB")
lstBx_ := supplyZone.get(idx)
if showIdmob
supplyZone.get(idx).set_text("IDM OB")
supplyZone.get(idx).set_text_color(clrtxtextbeariem)
supplyZone.get(idx).set_bgcolor(clrtxtextbeariembg)
supplyZoneIsMit.set(idx,1)
else
removeZone(supplyZone,supplyZone.get(idx),supplyZoneIsMit,false)
colorText = trend and H_lastH > L_lastHH or not trend and H_lastLL > L_lastL ? color.red : colorIDM
if showSMC
ln = line.new(x, y, time, y, xloc.bar_time, color = colorIDM, style = line.style_dotted)
lbl = label.new(textCenter(time, x), y, IDM_TEXT, xloc.bar_time, color = transp, textcolor = colorText, style = getStyleLabel(not trend), size = size.small)
array.push(arrIdmLine,ln)
array.push(arrIdmLabel,lbl)
array.clear(trend ? arrIdmLow : arrIdmHigh)
array.clear(trend ? arrIdmLBar : arrIdmHBar)
lstBx_
var box lstBx = na
drawStructure(name, trend) =>
= getDirection(trend, lastHBar, lastLBar, lastH, lastL)
box lstBx_ = na
if trend
// label.new(bar_index,lstHlPrs)
// label.new(bar_index,y)
idx = -1
float lstPrs = na
if demandZone.size() > 0
// var arrlx = array.new_label(0)
// if arrlx.size() > 0
// while arrlx.size() > 0
// arrlx.pop().delete()
for i = 0 to demandZone.size() -1
bx = demandZone.get(i)
// if demandZoneIsMit.get(i) == 0 and ((bx.get_top() < lstPrs) or na(lstPrs)) and bx.get_top() <= y
// arrlx.unshift(label.new(bar_index,bx.get_top(),color = color.green))
if demandZoneIsMit.get(i) == 0 and ((bx.get_top() < lstPrs) or na(lstPrs)) and bx.get_top() <= y and bx.get_bottom() >= lstHlPrs
idx := i
lstPrs := bx.get_top()
if idx != -1
lstBx.set_text("Hist EXT OB")
lstBx_ := demandZone.get(idx)
if showExob
demandZone.get(idx).set_text("EXT OB")
demandZone.get(idx).set_text_color(clrtxtextbull)
demandZone.get(idx).set_bgcolor(clrtxtextbullbg)
demandZoneIsMit.set(idx,1)
else
removeZone(demandZone,demandZone.get(idx),demandZoneIsMit,true)
//label.new(bar_index,demandZone.get(idx).get_top(),color = color.red)
else
idx = -1
float lstPrs = na
if supplyZone.size() > 0
for i = 0 to supplyZone.size() -1
bx = supplyZone.get(i)
if supplyZoneIsMit.get(i) == 0 and ((bx.get_top() > lstPrs) or na(lstPrs)) and bx.get_bottom() >= y and bx.get_top() <= lstHlPrs
idx := i
lstPrs := bx.get_top()
if idx != -1
lstBx.set_text("Hist EXT OB")
lstBx_ := supplyZone.get(idx)
if showExob
supplyZone.get(idx).set_text("EXT OB")
supplyZone.get(idx).set_text_color(clrtxtextbear)
supplyZone.get(idx).set_bgcolor(clrtxtextbearbg)
supplyZoneIsMit.set(idx,1)
else
removeZone(supplyZone,supplyZone.get(idx),supplyZoneIsMit,false)
color = trend ? bull : bear
if name == "BOS" and showSMC
ln = line.new(x, y, time, y, xloc.bar_time, color = color, style = line.style_dashed)
lbl = label.new(textCenter(time, x), y, BOS_TEXT, xloc.bar_time, color = transp, style = getStyleLabel(trend), textcolor = color, size = size.small)
array.push(arrBCLine,ln)
array.push(arrBCLabel,lbl)
if name == "ChoCh" and showSMC
ln = line.new(x, y, time, y, xloc.bar_time, color = color, style = line.style_dashed)
lbl = label.new(textCenter(time, x), y, CHOCH_TEXT, xloc.bar_time, color = transp, style = getStyleLabel(trend), textcolor = color, size = size.small)
array.push(arrBCLine,ln)
array.push(arrBCLabel,lbl)
drawLiveStrc(bool condition, bool direction, color color1, color color2, string txt, int length, label lbl, line ln) =>
var line _ln = ln
var label _lbl = lbl
if condition
colorText = direction ? color1 : color2
= if txt == IDM_TEXT
getDirection(direction, idmHBar, idmLBar, idmHigh, idmLow)
else
getDirection(direction, lastHBar, lastLBar, lastH, lastL)
_txt = txt + " - " + str.tostring(y)
_ln := line.new(x, y, time + len*length, y, xloc.bar_time, color = colorIDM, style = line.style_dotted),
_lbl := label.new(time + len*length, y, _txt, xloc.bar_time, color = transp, textcolor = colorText, style = label.style_label_left, size = size.small)
line.delete(_ln )
label.delete(_lbl )
fibo_limit(ratio, range_high, range_low) =>
range_1 = range_high - range_low
range_ratio = range_high - range_1 * ratio
range_ratio
drawPrevStrc(bool condition, string txt, label lbl, line ln,ote) =>
var float val = na
var int valiIdx = na
var line _ln = ln
var label _lbl = lbl
idDirUP = lastLBar < lastHBar
= switch
txt == PDH_TEXT =>
txt == PDL_TEXT =>
txt == MID_TEXT =>
=>
_txt = txt + " - " + str.tostring(y)
if condition
val := y
valiIdx := x
_ln := line.new(x, y, x2, y, xloc.bar_time, color = color, style = style)
if txt != ""
_lbl := label.new(x2, y, _txt, xloc.bar_time, color = transp, textcolor = color, style = label.style_label_left, size = size.small)
line.delete(_ln )
label.delete(_lbl )
//_ln
var arrPrevPrsMin = array.new_float(1,0)
var arrPrevIdxMin = array.new_int(1,0)
var arrlstHigh = array.new_float(1,0)
var arrlstLow = array.new_float(1,0)
var arrOBTstdo = array.new_box(0)
var arrOBTstd = array.new_box(0)
var arrOBTstdTy = array.new_int(0)
i = 0
while i < arrOBTstd.size()
bx = arrOBTstd.get(i)
if arrOBTstdTy.get(i) == 1 and low < bx.get_bottom()
if showTsted
arrOBTstdo.unshift(arrOBTstd.remove(i))
else
arrOBTstd.remove(i).delete()
arrOBTstdTy.remove(i)
i -=1
else if arrOBTstdTy.get(i) == -1 and high > bx.get_top()
if showTsted
arrOBTstdo.unshift(arrOBTstd.remove(i))
else
arrOBTstd.remove(i).delete()
arrOBTstdTy.remove(i)
i -=1
i += 1
if arrOBTstdo.size() > maxTested
arrOBTstdo.pop().delete()
var arrOBBullm = array.new_box(0)
var arrOBBearm = array.new_box(0)
var arrOBBullisVm = array.new_bool(0)
var arrOBBearisVm = array.new_bool(0)
var arrOBBulls = array.new_box(0)
var arrOBBears = array.new_box(0)
var arrOBBullisVs = array.new_bool(0)
var arrOBBearisVs = array.new_bool(0)
getProcess(arrOBBull,arrOBBear,arrOBBullisV,arrOBBearisV)=>
alertBullOf = false
alertBearOf = false
if arrOBBull.size() > 0
i = 0
while i < arrOBBull.size()
bx = arrOBBull.get(i)
bx.set_right(time)
if not arrOBBullisV.get(i)
if low < bx.get_bottom()
bx.delete()
arrOBBull.remove(i)
arrOBBullisV.remove(i)
i -=1
else if high > bx.get_top()
arrOBBullisV.set(i,true)
else
if low < bx.get_top() and low > bx.get_top()
alertBullOf := true
if low < bx.get_top()
bx.set_bgcolor(clrObBBTated)
bx.set_border_color(clrObBBTated)
//if showTsted
arrOBTstd.unshift(bx)
arrOBTstdTy.unshift(1)
// if arrOBTstd.size() > maxTested
// arrOBTstd.pop().delete()
// else
// bx.delete()
arrOBBull.remove(i)
arrOBBullisV.remove(i)
i -=1
i += 1
if arrOBBear.size() > 0
i = 0
while i < arrOBBear.size()
bx = arrOBBear.get(i)
bx.set_right(time)
if not arrOBBearisV.get(i)
if high > bx.get_top()
bx.delete()
arrOBBear.remove(i)
arrOBBearisV.remove(i)
i -=1
else if low < bx.get_bottom()
arrOBBearisV.set(i,true)
else
if high > bx.get_bottom() and high < bx.get_bottom()
alertBearOf := true
if high > bx.get_bottom()
bx.set_bgcolor(clrObBBTated)
bx.set_border_color(clrObBBTated)
//if showTsted
arrOBTstd.unshift(bx)
arrOBTstdTy.unshift(-1)
// if arrOBTstd.size() > maxTested
// arrOBTstd.pop().delete()
// else
// bx.delete()
arrOBBear.remove(i)
arrOBBearisV.remove(i)
i -=1
i += 1
= getProcess(arrOBBullm,arrOBBearm,arrOBBullisVm,arrOBBearisVm)
= getProcess(arrOBBulls,arrOBBears,arrOBBullisVs,arrOBBearisVs)
alertcondition(alertBullOfMajor,"Major Bullish order flow","Major Bullish order flow")
alertcondition(alertBearOfMajor,"Major Bearish order flow","Major Bearish order flow")
alertcondition(alertBullOfMinor,"Minor Bullish order flow","Minor Bullish order flow")
alertcondition(alertBearOfMinor,"Minor Bearish order flow","Minor Bearish order flow")
labelMn(bool trend) =>
= getDirection(trend, puHBar, puLBar, puHigh, puLow)
color = trend ? bear : bull
txt = trend ? getTextLabel(puHigh, arrlstHigh.get(0), "HH", "LH") : getTextLabel(puLow, arrlstLow.get(0), "HL", "LL")
if showMn
label.new(x, y, "", xloc.bar_time, getYloc(trend), color, getStyleArrow(trend), size = size.tiny ,textcolor = color.red)
if showISOB
if txt == "HH" or txt == "LL"
arrPrevPrsMin.set(0,y)
arrPrevIdxMin.set(0,x)
if txt == "HL" or txt == "LH"
if arrPrevPrsMin.get(0) != 0
if txt == "HL"
arrOBBulls.unshift(box.new(arrPrevIdxMin.get(0),arrPrevPrsMin.get(0),x,y,bgcolor = ClrMinorOFBull,border_color = ClrMinorOFBull,xloc = xloc.bar_time))
arrOBBullisVs.unshift(false)
if arrOBBulls.size() > showISOBMax
arrOBBulls.pop().delete()
arrOBBullisVs.pop()
else
arrOBBears.unshift(box.new(x,y,arrPrevIdxMin.get(0),arrPrevPrsMin.get(0),bgcolor = ClrMinorOFBear,border_color = ClrMinorOFBear,xloc = xloc.bar_time))
arrOBBearisVs.unshift(false)
if arrOBBears.size() > showISOBMax
arrOBBears.pop().delete()
arrOBBearisVs.pop()
arrPrevPrsMin.set(0,0)
arrPrevIdxMin.set(0,0)
if trend
arrlstHigh.set(0,y)
else
arrlstLow.set(0,y)
var arrPrevPrs = array.new_float(1,0)
var arrPrevIdx = array.new_int(1,0)
labelHL(bool trend) =>
= getDirection(trend, HBar, LBar, H, L)
txt = trend ? getTextLabel(H, getNLastValue(arrLastH, 1), "HH", "LH") : getTextLabel(L, getNLastValue(arrLastL, 1), "HL", "LL")
if showMajoinMiner
if txt == "HH" or txt == "LL"
arrPrevPrs.set(0,y)
arrPrevIdx.set(0,x)
if txt == "HL" or txt == "LH"
if arrPrevPrs.get(0) != 0
if txt == "HL"
arrOBBullm.unshift(box.new(arrPrevIdx.get(0),arrPrevPrs.get(0),x,y,bgcolor = ClrMajorOFBull,border_color = ClrMajorOFBull,xloc = xloc.bar_time))
arrOBBullisVm.unshift(false)
if arrOBBullm.size() > showMajoinMinerMax
arrOBBullm.pop().delete()
arrOBBullisVm.pop()
else
arrOBBearm.unshift(box.new(x,y,arrPrevIdx.get(0),arrPrevPrs.get(0),bgcolor = ClrMajorOFBear,border_color = ClrMajorOFBear,xloc = xloc.bar_time))
arrOBBearisVm.unshift(false)
if arrOBBearm.size() > showMajoinMinerMax
arrOBBearm.pop().delete()
arrOBBearisVm.pop()
arrPrevPrs.set(0,0)
arrPrevIdx.set(0,0)
if showHL
lbl = label.new(x, y, txt, xloc.bar_time, color = transp, textcolor = colorHL, style = getStyleLabel(trend))
array.push(arrHLLabel, lbl)
if showCircleHL
lbl2 = label.new(x, y, '', xloc.bar_time, getYloc(trend), color = trend ? bull : bear, style = label.style_circle, size = size.tiny)
array.push(arrHLCircle, lbl2)
y
sweepHL(bool trend) =>
= getDirection(trend, lastHBar, lastLBar, lastH, lastL)
if showSw
line.new(x, y, time, y, xloc.bar_time, color = colorSweep, style = line.style_dotted)
if markX
label.new(textCenter(time, x), y, "X", xloc.bar_time, color = transp, textcolor = colorSweep, style = getStyleLabel(trend), size = size.small)
TP(H, L) =>
target = isCocUp ? high + math.abs(H - L) : low - math.abs(H - L)
target := target < 0 ? 0 : target
if showTP
line.new(bar_index, isCocUp ? high : low, bar_index, target, color = colorTP, style = line.style_arrow_right)
createBox(left, right, top, bottom, color) =>
box.new(left=left, right=right, top=top, bottom=bottom, xloc = xloc.bar_time, bgcolor=color, border_color=color,text_color = color.new(color,20),text_halign = text.align_center ,extend = extend.none,text_size = txtsiz)
marginZone(zone) =>
handleZone(zoneArray,zoneArrayisMit, left, top, bot, color,isBull) =>
_top = top
_bot = bot
_left = left
zone = getNLastValue(zoneArray, 1)
//zmt = getNLastValue(zoneArrayisMit, 1)
= marginZone(zone)
rangeTop = math.abs(_top-topZone)/(topZone-botZone) < mergeRatio
rangeBot = math.abs(_bot-botZone)/(topZone-botZone) < mergeRatio
//Merge zone
if _top >= topZone and _bot <= botZone or rangeTop or rangeBot
_top := math.max(_top,topZone)
_bot := math.min(_bot,botZone)
_left := leftZone
removeZone(zoneArray, zone,zoneArrayisMit,isBull)
if not (_top <= topZone and _bot >= botZone)
array.push(zoneArray, createBox(_left, time, _top, _bot, color))
zoneArrayisMit.push(0)
processZones(zones, isSupply,zonesmit) =>
isAlertextidm = false
if array.size(zones) > 0
for i = array.size(zones) - 1 to 0 by 1
zone = array.get(zones, i)
if zonesmit.get(i) == 0 or zonesmit.get(i) == 1
zone.set_right(time)
= marginZone(zone)
//isTouch = (isSupply and high >= botZone and high < topZone) or (not isSupply and low <= topZone and low > botZone)
//Breaker block zones
if isSupply and low < botZone and close > topZone
array.push(demandZone,createBox(leftZone, time, topZone, botZone, colorDemand))
demandZoneIsMit.push(0)
else if not isSupply and high > topZone and close < botZone
array.push(supplyZone, createBox(leftZone, time, topZone, botZone, colorSupply))
supplyZoneIsMit.push(0)
//Mitigated zones
else if (isSupply and high >= botZone and high < botZone) or (not isSupply and low <= topZone and low > topZone) //mitatypeTouch ? isTouch : (isSupply and high >= topZone and high < topZone) or (not isSupply and low <= botZone and low > botZone)
box.set_right(zone, time)
box.set_extend(zone,extend.none)
// box.set_bgcolor(zone, colorMitigated)
// box.set_border_color(zone, colorMitigated)
if extndBox and high >= topZone and low <= botZone
if isSupply
arrmitOBBull.unshift(zone)
// arrmitOBBulli.unshift(time)
arrmitOBBulla.unshift(false)
else
arrmitOBBear.unshift(zone)
// arrmitOBBeari.unshift(time)
arrmitOBBeara.unshift(false)
if isSupply
if supplyZoneIsMit.get(i) == 1
isAlertextidm := true
if supplyZoneIsMit.get(i) != 1
box.set_bgcolor(zone, colorMitigated)
box.set_border_color(zone, colorMitigated)
supplyZoneIsMit.set(i, supplyZoneIsMit.get(i) == 1 ? 3 : 2)
else
if demandZoneIsMit.get(i) == 1
isAlertextidm := true
if demandZoneIsMit.get(i) != 1
box.set_bgcolor(zone, colorMitigated)
box.set_border_color(zone, colorMitigated)
demandZoneIsMit.set(i, demandZoneIsMit.get(i) == 1 ? 3 : 2)
if showBrkob
zones.remove(i)
zonesmit.remove(i)
// if not showBrkob
// zone.delete()
// //Delete sweep zones
else if (time - leftZone > len*maxBarHistory) or (isSupply and high >= topZone) or (not isSupply and low <= botZone)
// box.set_bgcolor(zone, colorMitigated)
// box.set_border_color(zone, colorMitigated)
removeZone(zones, zone,zonesmit,not isSupply)
0
isAlertextidm
scob(zones, isSupply) =>
= marginZone(getNLastValue(zones, 1))
if not isb
if not isSupply and low < low and low < low and close > high and low < topZone and low > botZone
scobUp
else if isSupply and high > high and high > high and close < low and high < topZone and high > botZone
scobDn
else
na
//#endregion
//#region get value from array
top = getNLastValue(arrTop, 1)
bot = getNLastValue(arrBot, 1)
topBotBar = getNLastValue(arrTopBotBar, 1)
top1 = getNLastValue(arrTop, 2)
bot1 = getNLastValue(arrBot, 2)
topBotBar1 = getNLastValue(arrTopBotBar, 2)
//#endregion
//#region Outside Bar
osb = high > top and low < bot
//#endregion
//#region Minor Structure
if high >= top and low <= bot //notrend
if not na(mnStrc)
prevMnStrc := mnStrc ? true : false
else
if prevMnStrc and isGreenBar(0) and not isGreenBar(1)
puHigh := top
puHigh_ := top
puHBar := topBotBar
labelMn(true)
labelMn(false)
if high > H
updateIdmLow()
if not prevMnStrc and not isGreenBar(0) and isGreenBar(1)
puLow := bot
puLow_ := bot
puLBar := topBotBar
labelMn(true)
labelMn(false)
if low < L
updateIdmHigh()
if low < L and isGreenBar(0)
updateIdmHigh()
if high > H and not isGreenBar(0)
updateIdmLow()
updateTopBotValue()
puHigh := high
puHigh_ := high
puLow := low
puLow_ := low
puHBar := time
puLBar := time
mnStrc := na
if high >= top and low > bot //uptrend
if prevMnStrc and na(mnStrc)
puHigh := top1
puHigh_ := top1
puHBar := topBotBar1
labelMn(true)
labelMn(false)
else if (not prevMnStrc and na(mnStrc)) or not mnStrc
labelMn(false)
if high > H
updateIdmLow()
updateTopBotValue()
puHigh := high
puHigh_ := high
puHBar := time
prevMnStrc := na
mnStrc := true
if high < top and low <= bot //downtrend
if not prevMnStrc and na(mnStrc)
puLow := bot1
puLow_ := bot1
puLBar := topBotBar1
labelMn(false)
labelMn(true)
else if (prevMnStrc and na(mnStrc)) or mnStrc
labelMn(true)
if low < L
updateIdmHigh()
updateTopBotValue()
puLow := low
puLow_ := low
puLBar := time
prevMnStrc := na
mnStrc := false
//#endregion
//#region update IDM
if high >= H
H := high
HBar := time
L_lastHH := low
idmLow := getNLastValue(arrIdmLow, 1)
idmLBar := getNLastValue(arrIdmLBar, 1)
if low <= L
L := low
LBar := time
H_lastLL := high
idmHigh := getNLastValue(arrIdmHigh, 1)
idmHBar := getNLastValue(arrIdmHBar, 1)
//#endregion
// #region structure mapping
// Check for IDM
if findIDM and isCocUp and isCocUp
if low < idmLow
if structure_type == "Choch with IDM" and idmLow == lastL
if isPrevBos
fixStrcAfterBos()
lastL := getNLastValue(arrLastL, 1)
lastLBar := getNLastValue(arrLastLBar, 1)
else
fixStrcAfterChoch()
findIDM := false
isBosUp := false
lastH := H
lastHBar := HBar
lstHlPrs := labelHL(true) //Confirm HH
lstBx_ = drawIDM(true)
if not na(lstBx_)
lstBxIdm := lstBx_
updateLastHLValue()
H_lastH := getNLastValue(arrLastH, 1)
L := low
LBar := time
if findIDM and isCocDn and isBosDn
if high > idmHigh
if structure_type == "Choch with IDM" and idmHigh == lastH
if isPrevBos
fixStrcAfterBos()
lastH := getNLastValue(arrLastH, 1)
lastHBar := getNLastValue(arrLastHBar, 1)
else
fixStrcAfterChoch()
findIDM := false
isBosDn := false
lastL := L
lastLBar := LBar
lstHlPrs := labelHL(false) //Confirm LL
updateLastHLValue()
lstBx_ = drawIDM(false)
if not na(lstBx_)
lstBxIdm := lstBx_
L_lastL := getNLastValue(arrLastL, 1)
H := high
HBar := time
//Check for ChoCh
if isCocDn and high > lastH
if structure_type == "Choch without IDM" and idmHigh == lastH and close > idmHigh
removeLastLabel(arrIdmLabel, 1)
removeLastLine(arrIdmLine, 1)
if close > lastH
= drawStructure("ChoCh", true) //Confirm CocUp
lstHlPrsIdm := lstHlPrsIdm_
if not na(lstBx_)
lstBx := lstBx_
findIDM := true
isBosUp := true
isCocUp := true
isBosDn := false
isCocDn := false
isPrevBos := false
L_lastL := getNLastValue(arrLastL, 1)
TP(lastH,lastL)
else
if idmHigh == lastH
removeLastLine(arrIdmLine, 1)
sweepHL(true)
if isCocUp and low < lastL
if structure_type == "Choch without IDM" and idmLow == lastL and close < idmLow
removeLastLabel(arrIdmLabel, 1)
removeLastLine(arrIdmLine, 1)
if close < lastL
= drawStructure("ChoCh", false) //Confirm CocDn
lstHlPrsIdm := lstHlPrsIdm_
if not na(lstBx_)
lstBx := lstBx_
findIDM := true
isBosUp := false
isCocUp := false
isBosDn := true
isCocDn := true
isPrevBos := false
H_lastH := getNLastValue(arrLastH, 1)
TP(lastH,lastL)
else
if idmLow == lastL
removeLastLine(arrIdmLine, 1)
sweepHL(false)
//sweepHL(false)
//Check for BoS
if not findIDM and not isBosUp and isCocUp
if high > lastH
if close > lastH
findIDM := true
isBosUp := true
isCocUp := true
isBosDn := false
isCocDn := false
isPrevBos := true
lstHlPrs := labelHL(false) //Confirm HL
= drawStructure("BOS", true) //Confirm BosUp
lstHlPrsIdm := lstHlPrsIdm_
if not na(lstBx_)
lstBx := lstBx_
lastL := L
lastLBar := LBar
L_lastL := L
TP(lastH,lastL)
else
sweepHL(true)
if not findIDM and not isBosDn and isCocDn
if low < lastL
if close < lastL
findIDM := true
isBosUp := false
isCocUp := false
isBosDn := true
isCocDn := true
isPrevBos := true
lstHlPrs := labelHL(true) //Confirm LH
= drawStructure("BOS", false) //Confirm BosDn
lstHlPrsIdm := lstHlPrsIdm_
if not na(lstBx_)
lstBx := lstBx_
lastH := H
lastHBar := HBar
H_lastH := H
TP(lastH,lastL)
else
sweepHL(false)
//#endregion
//#trigger update High and Low
if high > lastH
lastH := high
lastHBar := time
if low < lastL
lastL := low
lastLBar := time
//#endregion
if showPOI
if not isSweepOBS
high_MOBS := high
low_MOBS := low
current_OBS := time
if high_MOBS > high and high_MOBS > high
isSweepOBS := true
else
if low_MOBS > high
handleZone(supplyZone,supplyZoneIsMit, current_OBS, high_MOBS, low_MOBS, colorSupply,false)
isSweepOBS := false
else
if poi_type == "Mother Bar" and isb
high_MOBS := math.max(high_MOBS,motherHigh )
low_MOBS := math.min(low_MOBS,motherLow )
current_OBS := math.min(current_OBS,motherBar)
else
high_MOBS := high
low_MOBS := low
current_OBS := time
if not isSweepOBD
low_MOBD := low
high_MOBD := high
current_OBD := time
if low_MOBD < low and low_MOBD < low
isSweepOBD := true
else
if high_MOBD < low
handleZone(demandZone,demandZoneIsMit, current_OBD, high_MOBD, low_MOBD, colorDemand,true)
isSweepOBD := false
else
if poi_type == "Mother Bar" and isb
high_MOBD := math.max(high_MOBD,motherHigh )
low_MOBD := math.min(low_MOBD,motherLow )
current_OBD := math.min(current_OBD,motherBar)
else
high_MOBD := high
low_MOBD := low
current_OBD := time
//#endregion
//#region run function
barcolor(showSCOB ? scob(supplyZone, true) : na, -1)
barcolor(showSCOB ? scob(demandZone, false) : na, -1)
barcolor(showISB and isb ? colorISB : na, 0,title="InSide Bar")
barcolor(osb and isGreenBar(0) and showOSB ? colorOSB_up : na)
barcolor(osb and not isGreenBar(0) and showOSB ? colorOSB_down : na)
isAlertextidmSell = processZones(supplyZone, true,supplyZoneIsMit)
isAlertextidmBuy = processZones(demandZone, false,demandZoneIsMit)
drawLiveStrc(showSMC and findIDM, not isCocUp, colorIDM, colorIDM, IDM_TEXT,lengSMC , idm_label, idm_line)
drawLiveStrc(showSMC, not isCocUp, bull, bear, CHOCH_TEXT, lengSMC, choch_label, choch_line)
drawLiveStrc(showSMC and not findIDM, isCocUp, bull, bear, BOS_TEXT,lengSMC , bos_label, bos_line)
drawPrevStrc(showPdh, PDH_TEXT, pdh_label, pdh_line,0.0)
drawPrevStrc(showPdl, PDL_TEXT, pdl_label, pdl_line,0.0)
drawPrevStrc(showMid, MID_TEXT, mid_label, mid_line,0.0)
if isOTE
// o1 = drawPrevStrc(true, "", mid_label1, mid_line1,ote1)
// o2 = drawPrevStrc(true, "", mid_label2, mid_line2,ote2)
// linefill.new(o1,o2,oteclr)
// var arrOte = array.new_box(0)
var box bxf = na
bxf.set_right(time)
var bxty = 0
minb = math.min(bxf.get_top(),bxf.get_bottom())
maxb = math.max(bxf.get_top(),bxf.get_bottom())
if not na(bxf)
// if bxty == 0
// if high < minb
// bxty := -1
// if low > maxb
// bxty := 1
if (bxty == 1 and low < minb) or (bxty == -1 and high > maxb)
bxf.delete()
bxf := na
bxty := 0
= drawPrevStrc(true, "", mid_label1, mid_line1,ote1)
= drawPrevStrc(true, "", mid_label2, mid_line2,ote2)
if not na(oi1) and (bxty == 0 ? oi1 != oi1 : true)//and (oi1 != oi1 or na(ot or ot != ot ))
// if bxf.get_left() == oi1 and arrOte.size() > 0
// arrOte.get(0).delete()
bxf.delete()
bxf := box.new(oi1,ot,time,ob,xloc = xloc.bar_time,border_color = na,bgcolor = oteclr,text = "Golden zone",text_color = color.new(oteclr,20),text_halign = text.align_center,text_size = sizGd)
// arrOte.unshift(bxf)
// if arrOte.size() > maxOTECount
// arrOte.pop().delete()
bxty := dir ? 1 : -1
alertcondition(isAlertextidmSell,"IDM EXT Alert Supply","IDM EXT Alert Supply")
alertcondition(isAlertextidmBuy,"IDM EXT Alert Demand","IDM EXT Alert Demand")
//#endregion
//2
//indicator(" SMC LEGEND 2 ",overlay = true, max_bars_back = 5000, max_lines_count = 500, max_boxes_count = 500, max_labels_count = 500)
//---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
//--------------------------------------------------------------- Input Settings
//---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
//----------------------------------------}
//Order Blocks
//----------------------------------------{
show_order_blocks_mtf = false
ibull_ob_css_2 = color.new(#5d606b, 25)
ibear_ob_css_2 = color.new(#5d606b, 25)
ob_type__mtf = 'All'
i_tf_ob_mtf = '240'
// mitigation_filt_mtf = input.string('Wicks', 'Mitigation Method', options = , group = 'Order Blocks', inline = 'mob3')
mittigation_filt_mtf = 'Wicks'
overlapping_filt_mtf = true
max_obs_mtf = 4
length_extend_ob_mtf = 20
ob_extend_mtf = false
// v_filter = true
text_size_ob2 = "Medium"
text_size_ob_2 = text_size_ob2 == "Small" ? size.tiny : text_size_ob2 == "Medium" ? size.small : text_size_ob2 == "Large" ? size.normal : text_size_ob2 == "Medium2" ? size.normal : size.small
ob_text_color_2 = color.new(#787b86, 0)
volume_text_2 = false
percent_text_2 = false
show_line_ob_2 = false
line_style_ob2 = "Solid"
line_style_ob_2 = line_style_ob2 == "Solid" ? line.style_solid : line_style_ob2 == "Dashed" ? line.style_dashed : line.style_dotted
v_buy = #00dbff4d
v_sell = #e91e634d
tf_s1=i_tf_ob_mtf==''?timeframe.period:i_tf_ob_mtf
timeframe_st=not(str.contains(tf_s1,'S')) and not(str.contains(tf_s1,'D')) and not(str.contains(tf_s1,'W')) and not(str.contains(tf_s1,'M')) ? str.tonumber(tf_s1)>=60? str.tostring(str.tonumber(tf_s1)/60) +"H": tf_s1 +"M" : tf_s1
timeframe1=timeframe_st + ' : '
show_iob = ob_type__=='All' or ob_type__=='Internal' //input(true, 'Internal', inline = 'ob', group = 'Order Blocks')
show_ob = ob_type__=='All' or ob_type__=='External' //input(false, 'External', inline = 'ob', group = 'Order Blocks')
show_iob_mtf = ob_type__mtf=='All' or ob_type__mtf=='Internal' //input(true, 'Internal', inline = 'ob', group = 'Order Blocks')
show_ob_mtf = ob_type__mtf=='All' or ob_type__mtf=='External' //input(false, 'External', inline = 'ob', group = 'Order Blocks')
ob_showlast = 5//input.int(10, 'LookBack', minval = 1, inline = 'ob', group = 'Order Blocks')
iob_showlast = 5//input.int(5, 'LookBack', minval = 1, inline = 'iob', group = 'Order Blocks')
max_width_ob = 3//input.float(3, 'Max OB Width', minval = 0.1,maxval = 3, inline = 'close', group = 'Order Blocks')
max_width_ob:=max_width_ob==3?20:max_width_ob
style = 'Colored'
v_lookback= 10
ob_loockback=10
timediff=(time -time )/100
//----------------------------------------}
//BOS and MSS
//----------------------------------------{
// Constants
color CLEAR = color.rgb(0,0,0,100)
// Inputs
showms=input(false,title="ICT Market Structure ",inline="0",group = "Market Structure")
bosColor1 = input.color(color.green , '', group="Market Structure",inline="0")
bosColor2 = input.color(color.red , '', group="Market Structure",inline="0")
ms_type =input.string("All", options= , title="", group="Market Structure",inline="0")
show_equal_highlow = input(false, 'Equal Highs & Lows', group = 'Market Structure',inline = 'equilibrium_zone')
eq_bear_color = input.color(#787b86 , '', group="Market Structure",inline="equilibrium_zone")
eq_bull_color = input.color(#787b86 , '', group="Market Structure",inline="equilibrium_zone")
eq_threshold = input.float(0.3, '', minval = 0, maxval = 0.5, step = 0.1, group = 'Market Structure',inline = 'equilibrium_zone')
showSwing = false // or false, depending on default behavior
swingSize = 10 // fixed swing point period
label_sizes_s = "Medium" // fixed label size: "Small", "Medium", or "Large"
label_size_buysell_s = label_sizes_s == "Small" ? size.tiny : label_sizes_s == "Medium" ? size.small : label_sizes_s == "Large" ? size.normal : label_sizes_s == "Medium2" ? size.normal : label_sizes_s == "Large2" ? size.large : size.huge
label_size_buysell = label_sizes_s == "Small" ? size.tiny : label_sizes_s == "Medium" ? size.small : label_sizes_s == "Large" ? size.normal : label_sizes_s == "Medium2" ? size.normal : label_sizes_s == "Large2" ? size.large : size.huge
length_eqh = 3
//----------------------------------------}
//Fair Value Gaps (FVG
//----------------------------------------{
i_bullishfvgcolor = color.new(color.green,100)
i_bearishfvgcolor = color.new(color.green,90)
i_fillByMid = true
i_deleteonfill = true
i_textColor = color.white
i_mtf = "HTF"
i_tfos = 10
i_mtfos = 50
//----------------------------------------}
//Liquidity Levels
//----------------------------------------{
//----------------------------------------}
//Key Levels
//----------------------------------------{
var Show_4H_Levels = input.bool(defval=false, title='4H', group='Key Levels', inline='4H')
Color_4H_Levels = input.color(title='', defval=color.orange, group='Key Levels', inline='4H')
Style_4H_Levels = 'Dotted' //input.string('Dotted', ' Style', , group="Key Levels",inline="4H")
Text_4H_Levels = true//input.bool(defval=false, title='Shorten', group='Key Levels', inline='4H')
var Show_Daily_Levels = input.bool(defval=false, title='Daily', group='Key Levels', inline='Daily')
Color_Daily_Levels = input.color(title='', defval=#08bcd4, group='Key Levels', inline='Daily')
Style_Daily_Levels ='Dotted'//input.string('Dotted', ' Style', , group="Key Levels",inline="Daily")
Text_Daily_Levels =true //input.bool(defval=false, title='Shorten', group='Key Levels', inline='Daily')
var Show_Monday_Levels = input.bool(defval=false, title='Monday', group='Key Levels', inline='Monday')
Color_Monday_Levels = input.color(title='', defval=color.white, group='Key Levels', inline='Monday')
Style_Monday_Levels = 'Dotted' //input.string('Dotted', ' Style', , group="Key Levels",inline="Monday")
Text_Monday_Levels =true // input.bool(defval=false, title='Shorten', group='Key Levels', inline='Monday')
var Show_Weekly_Levels = input.bool(defval=false, title='Weekly', group='Key Levels', inline='Weekly')
WeeklyColor = input.color(title='', defval=#fffcbc, group='Key Levels', inline='Weekly')
Weekly_style ='Dotted' //input.string('Dotted', ' Style', , group="Key Levels",inline="Weekly")
WeeklyTextType =true // input.bool(defval=false, title='Shorten', group='Key Levels', inline='Weekly')
var Show_Monthly_Levels = input.bool(defval=false, title='Monthly', group='Key Levels', inline='Monthly')
MonthlyColor = input.color(title='', defval=#098c30, group='Key Levels', inline='Monthly')
Monthly_style = 'Dotted' //input.string('Dotted', ' Style', , group="Key Levels",inline="Monthly")
MonthlyTextType = true //input.bool(defval=false, title='Shorten', group='Key Levels', inline='Monthly')
var Show_Quaterly_Levels = input.bool(defval=false, title='Quarterly', group='Key Levels', inline='Quarterly')
quarterlyColor = input.color(title='', defval=#bcffd0, group='Key Levels', inline='Quarterly')
Quaterly_style = 'Dotted'//input.string('Dotted', ' Style', , group="Key Levels",inline="Quarterly")
QuarterlyTextType =true // input.bool(defval=false, title='Shorten', group='Key Levels', inline='Quarterly')
var Show_Yearly_Levels = input.bool(defval=false, title='Yearly', group='Key Levels', inline='Yearly')
YearlyColor = input.color(title='', defval=#ffbcdb, group='Key Levels', inline='Yearly')
Yearly_style = 'Dotted' //input.string('Dotted', ' Style', , group="Key Levels",inline="Yearly")
YearlyTextType = true //input.bool(defval=false, title='Shorten', group='Key Levels', inline='Yearly')
labelsize = 'Small' //input.string(defval='Small', title='Text Size', options= ,group = "Key Levels", inline='H')
var pdhtext = Text_Daily_Levels ? 'PDH' : 'Prev Day High'
var pdltext = Text_Daily_Levels ? 'PDL' : 'Prev Day Low'
var dotext = Text_Daily_Levels ? 'DO' : 'Daily Open'
var pdmtext = Text_Daily_Levels ? 'PDM' : 'Prev Day Mid'
var pwhtext = WeeklyTextType ? 'PWH' : 'Prev Week High'
var pwltext = WeeklyTextType ? 'PWL' : 'Prev Week Low'
var wotext = WeeklyTextType ? 'WO' : 'Weekly Open'
var pwmtext = WeeklyTextType ? 'PWM' : 'Prev Week Mid'
var pmhtext = MonthlyTextType ? 'PMH' : 'Prev Month High'
var pmltext = MonthlyTextType ? 'PML' : 'Prev Month Low'
var motext = MonthlyTextType ? 'MO' : 'Monthly Open'
var pmmtext = MonthlyTextType ? 'PMM' : 'Prev Month Mid'
var pqhtext = QuarterlyTextType ? 'PQH' : 'Prev Quarter High'
var pqltext = QuarterlyTextType ? 'PQL' : 'Prev Quarter Low'
var qotext = QuarterlyTextType ? 'QO' : 'Quarterly Open'
var pqmtext = QuarterlyTextType ? 'PQM' : 'Prev Quarter Mid'
var cyhtext = YearlyTextType ? 'CYH' : 'Current Year High'
var cyltext = YearlyTextType ? 'CYL' : 'Current Year Low'
var yotext = YearlyTextType ? 'YO' : 'Yearly Open'
var cymtext = YearlyTextType ? 'CYM' : 'Current Year Mid'
var pihtext = Text_4H_Levels ? 'P-4H-H' : 'Prev 4H High'
var piltext = Text_4H_Levels ? 'P-4H-L' : 'Prev 4H Low'
var iotext = Text_4H_Levels ? '4H-O' : '4H Open'
var pimtext = Text_4H_Levels ? 'P-4H-M' : 'Prev 4H Mid'
var pmonhtext = Text_Monday_Levels ? 'MDAY-H' : 'Monday High'
var pmonltext = Text_Monday_Levels ? 'MDAY-L' : 'Monday Low'
var pmonmtext = Text_Monday_Levels ? 'MDAY-M' : 'Monday Mid'
displayStyle = 'Standard'
distanceright = 25
radistance = 250
linesize = 'Small'
linestyle = 'Solid'
var untested_monday = false
//----------------------------------------}
//Session Levels
//----------------------------------------{
var is_londonrange_enabled = input.bool(defval=false, title='London', group='Session Levels', inline='london')
var london_OC = true//input.bool(defval=true, title='O/C', group='Session Levels', inline='london')
var london_HL =true// input.bool(defval=true, title='H/L', group='Session Levels', inline='london')
var is_usrange_enabled = input.bool(defval=false, title='New York', group='Session Levels', inline='US')
var us_OC =true //input.bool(defval=true, title='O/C', group='Session Levels', inline='US')
var us_HL = true//input.bool(defval=true, title='H/L', group='Session Levels', inline='US')
var is_tokyorange_enabled = input.bool(defval=false, title='Tokyo', group='Session Levels', inline='asia')
var asia_OC = true//input.bool(defval=true, title='O/C', group='Session Levels', inline='asia')
var asia_HL = true//input.bool(defval=true, title='H/L', group='Session Levels', inline='asia')
SessionTextType = false//input.bool(defval=false, title='ShortHand', group='Sessions', inline='FXColor')
Londont = "0800-1600"
USt = "1400-2100"
Asiat = "0000-0900"
LondonColor = input.color(title='', defval=color.rgb(15, 13, 13), group='Session Levels', inline='london')
USColor = input.color(title='', defval=color.rgb(190, 8, 236), group='Session Levels', inline='US')
AsiaColor = input.color(title='', defval=color.rgb(33, 5, 241), group='Session Levels', inline='asia')
Short_text_London = true//input.bool(defval=false, title='Shorten', group='Session Levels', inline='london')
Short_text_NY =true// input.bool(defval=false, title='Shorten', group='Session Levels', inline='US')
Short_text_TKY = true//input.bool(defval=false, title='Shorten', group='Session Levels', inline='asia')
var London_high_text = Short_text_London ? 'Lon-H' : 'London High'
var London_low_text = Short_text_London ? 'Lon-L' : 'London Low'
var London_open_text = Short_text_London ? 'Lon-O' : 'London Open'
var NY_high_text = Short_text_NY ? 'NY-H' : 'New York High'
var NY_low_text = Short_text_NY ? 'NY-L' : 'New York Low'
var NY_open_text = Short_text_NY ? 'NY-O' : 'New York Open'
var Tokyo_high_text = Short_text_TKY ? 'TK-H' : 'Tokyo High'
var Tokyo_low_text = Short_text_TKY ? 'TK-L' : 'Tokyo Low'
var Tokyo_open_text = Short_text_TKY ? 'TK-O' : 'Tokyo Open'
//-----------------------------------------------------------------------------}
//Global variables
//-----------------------------------------------------------------------------{
color transparent = #ffffff00
length = 50
is_newbar(res) =>
t = time(res)
not na(t) and (na(t ) or t > t )
Show_MS(x, y, txt, css, dashed, down, lbl_size)=>
label.new(int(math.avg(x, bar_index)), y, txt, color = transparent, textcolor = css, style = down ? label.style_label_down : label.style_label_up, size = lbl_size)
line.new(x, y, bar_index, y, color = css, style = dashed ? line.style_dashed : line.style_solid)
f_barssince(_cond, _count) =>
_barssince = bar_index - ta.valuewhen(_cond, bar_index, _count)
_barssince
//Swings detection/measurements
calculate_swing_points(length)=>
var prev = 0
prev := high > ta.highest(length) ? 0 : low < ta.lowest(length) ? 1 : prev
t = prev == 0 and prev != 0 ? high : 0
b = prev == 1 and prev != 1 ? low : 0
var t_MS = 0, var int_t_MS = 0
var internal_y_up = 0., var internal_x_up = 0, var internal_y_dn = 0., var internal_x_dn = 0
var y_up = 0., var x_up = 0 , var y_dn = 0., var x_dn = 0
var crossed_up = true, var crossed_down = true
var internal_up_broke = true, var internal_dn_broke = true
var up_trailing = high, var down_trailing = low
var up_trailing_x = 0, var down_trailing_x = 0
var high_text = '', var low_text = ''
bullish_OB_Break = false
bearish_OB_Break = false
//---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
//--------------------------------------------------------------- Market Structure
//---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
bosConfType = 'Candle High'//input.string('Candle Close', 'BOS Confirmation', , tooltip='Choose whether candle close/wick above previous swing point counts as a BOS.')
MSS = true//input.bool(false, 'Show MSS', tooltip='Renames the first counter t_MS BOS to MSS' )
// showSwing = false//input.bool(true, 'Show Swing Points', tooltip='Show or hide HH, LH, HL, LL')
// Functions
lineStyle(x) =>
switch x
'Solid' => line.style_solid
'Dashed' => line.style_dashed
'Dotted' => line.style_dotted
pivot_high_found = ta.pivothigh(high, swingSize, swingSize)
pivot_low_found = ta.pivotlow(low, swingSize, swingSize)
var float prevHigh_s = na,var float prevLow_s = na,var int prevHighIndex_s = na,var int prevLowIndex_s = na
bool higher_highs = false, bool lower_highs = false, bool higher_lows = false, bool lower_lows = false
var int prevSwing_s = 0
if not na(pivot_high_found)
if pivot_high_found >= prevHigh_s
higher_highs := true
prevSwing_s := 2
else
lower_highs := true
prevSwing_s := 1
prevHigh_s := pivot_high_found
prevHighIndex_s := bar_index - swingSize
if not na(pivot_low_found)
if pivot_low_found >= prevLow_s
higher_lows := true
prevSwing_s := -1
else
lower_lows := true
prevSwing_s := -2
prevLow_s := pivot_low_found
prevLowIndex_s := bar_index - swingSize
//---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
//--------------------------------------------------------------- Fair Value Gaps
//---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// }
// ———————————————————— Global data {
//Using current bar data for HTF highs and lows instead of security to prevent future leaking
var htfH = open
var htfL = open
if close > htfH
htfH:= close
if close < htfL
htfL := close
//Security Data, used for HTF Bar Data reference
sClose = request.security(ticker.standard(syminfo.tickerid), i_tf, close , barmerge.gaps_off, barmerge.lookahead_on)
sHighP2 = request.security(ticker.standard(syminfo.tickerid), i_tf, high , barmerge.gaps_off, barmerge.lookahead_on)
sLowP2 = request.security(ticker.standard(syminfo.tickerid), i_tf, low , barmerge.gaps_off, barmerge.lookahead_on)
sOpen = request.security(ticker.standard(syminfo.tickerid), i_tf, open , barmerge.gaps_off, barmerge.lookahead_on)
sBar = request.security(ticker.standard(syminfo.tickerid), i_tf, bar_index, barmerge.gaps_off, barmerge.lookahead_on)
// }
//var keyword can be used to hold data in memory, with pinescript all data is lost including variables unless the var keyword is used to preserve this data
var bullishgapholder = array.new_box(0)
var bearishgapholder = array.new_box(0)
var bullishgapholder_fill = array.new_box(0)
var bearishgapholder_fill = array.new_box(0)
var bullish_high_holder = array.new_line(0)
var bearish_high_holder = array.new_line(0)
var bullish_low_holder = array.new_line(0)
var bearish_low_holder = array.new_line(0)
var bullishmidholder = array.new_line(0)
var bearishmidholder = array.new_line(0)
var bullishlabelholder = array.new_label(0)
var bearishlabelholder = array.new_label(0)
var transparentcolor = color.new(color.white,100)
var fvg_apper=false
var fvg_break=false
fvg_apper:=false
fvg_break:=false
// ———————————————————— Functions {
//function paramaters best declared with '_' this helps defer from variables in the function scope declaration and elsewhere e.g. close => _close
create_fvg_func(_upperlimit,_lowerlimit,_midlimit,_bar,_boxholder,_boxholder_fill,_midholder,_highholder,_lowholder,_labelholder,_boxcolor,_mtfboxcolor, _htf)=>
timeholder = str.tostring(i_tf)
offset = i_mtfos
boxbgcolor = _mtfboxcolor
bg_color = color.new(_mtfboxcolor,90)
if _htf == false
timeholder := str.tostring(timeframe.period)
offset := i_tfos
boxbgcolor := _boxcolor
array.push(_boxholder,box.new(_bar,_upperlimit,_bar+(timediff)*length_extend,_lowerlimit,border_color=fvg_color_fill? bg_color : na,bgcolor = fvg_color_fill? bg_color : na, extend = fvg_extend ? extend.right:extend.none,xloc = xloc.bar_time,text='',text_color=#787b86,text_halign=text.align_right,text_size=size.small))
array.push(_boxholder_fill,box.new(_bar,_upperlimit,_bar+(timediff)*length_extend,_lowerlimit,border_color=fvg_color_fill? bg_color : na ,bgcolor = fvg_color_fill? bg_color : na, extend = fvg_extend ? extend.right:extend.none,xloc = xloc.bar_time))
array.push(_midholder,line.new(_bar,(_lowerlimit+_upperlimit)/2.0,_bar+(timediff)*length_extend,_midlimit,color = i_midPointColor, extend = fvg_extend ? extend.right:extend.none,style=lineStyle(mid_style),width=1,xloc = xloc.bar_time))
array.push(_lowholder,line.new(_bar,_lowerlimit,_bar+(timediff)*length_extend,_lowerlimit,color = i_fillByMid?boxbgcolor:na, extend = fvg_extend ? extend.right:extend.none,width=1,xloc = xloc.bar_time))
array.push(_highholder,line.new(_bar,_upperlimit,_bar+(timediff)*length_extend,_upperlimit,color = i_fillByMid?boxbgcolor:na, extend = fvg_extend ? extend.right:extend.none,width=1,xloc = xloc.bar_time))
//checks for gap between current candle and 2 previous candle e.g. low of current candle and high of the candle before last, this is the fa
チャートパターン
Ghost Phase [Bit2Billions]📌 Ghost Phase — Geometry-Based Pattern Validation Engine
Ghost Phase is a closed-source chart-pattern indicator designed to **validate price patterns using shared geometric structure**, rather than detecting isolated formations.
Most pattern indicators scan for individual shapes (channels, wedges, triangles, harmonics) independently. This leads to overlapping drawings, conflicting interpretations, and unreliable signals when patterns do not align structurally.
Ghost Phase solves this by validating all patterns against a **single geometric interpretation of price swings**, ensuring that only structurally consistent patterns are displayed.
📌 Core Calculation Concept (Geometric Validation)
Ghost Phase does not search for patterns independently.
Instead, it first establishes **price geometry** by evaluating:
* Swing symmetry
* Angle consistency
* Range proportionality
* Expansion vs contraction behavior
Only after this geometry is confirmed does the script validate whether a pattern **fits** that structure.
Patterns that do not conform to the active geometry are filtered out.
This prevents random or overlapping pattern detection.
📌 Reason for Mashup (Why Multiple Pattern Types Exist)
Ghost Phase includes channels, wedges, triangles, harmonics, and trendlines **because they are not separate concepts**.
They are **different expressions of the same geometric structure**.
For example:
* Channels and trendlines define directional geometry
* Wedges and triangles represent compression within that geometry
* Harmonic patterns refine geometry using proportional symmetry
* Double tops/bottoms represent geometric failure points
Combining these is necessary to **validate geometry**, not to merge indicators.
This is not a mashup of tools — it is **one geometry engine expressing itself through multiple pattern types**.
📌 How the Components Work Together
All components in Ghost Phase reference the same internal geometry model:
1. **Swing Geometry Engine** establishes valid swing anchors using proportional distance and angle stability.
2. **Channel Geometry** defines the dominant directional framework.
3. **Compression Patterns (Wedges / Triangles)** are validated only if they exist within the active channel geometry.
4. **Harmonic Structures** are confirmed only when their ratios align with existing swing geometry.
5. **Double Tops / Bottoms** appear only at geometric exhaustion or failure points.
6. **Trendlines & Curved Geometry** adapt dynamically as swing geometry evolves.
Because all patterns share the same geometry:
* Patterns do not overlap randomly
* Signals do not contradict each other
* Visual clutter is reduced automatically
📌 What Problem This Script Solves
Traders commonly struggle with:
* Too many conflicting chart patterns
* Pattern indicators drawing everywhere
* Manual pattern drawing inconsistency
* Lack of structural hierarchy between patterns
* Difficulty validating which patterns matter
Ghost Phase solves this by:
* Filtering patterns that do not fit geometry
* Showing only structurally valid formations
* Maintaining consistent geometry across timeframes
* Reducing chart noise and decision fatigue
The result is **pattern validation**, not pattern flooding.
📌 How Traders Use Ghost Phase
Ghost Phase is **not an entry system**.
Traders use it to:
* Validate whether a visible pattern is structurally real
* Identify compression vs expansion phases
* Understand when geometry is breaking or holding
* Avoid low-quality or forced pattern setups
All outputs are contextual and interpretive.
📌 Why This Script Is Original
Ghost Phase does not rely on:
* Simple pivot matching
* Candle-count pattern scans
* Standalone harmonic ratio checks
Its originality lies in:
* Shared geometry across all patterns
* Structural filtering before pattern confirmation
* Angle and proportional validation
* Geometry-first logic rather than pattern-first scanning
This behavior cannot be replicated by combining public pattern indicators.
📌 Why This Script Is Invite-Only
Ghost Phase replaces multiple manual processes:
* Manual channel and trendline drawing
* Pattern confirmation and invalidation
* Harmonic structure validation
* Ongoing geometry adjustment
Its value lies in **how geometric consistency is enforced**, which requires proprietary logic and is therefore provided as a closed-source, invite-only script.
📌 Key Features & Components
1. Geometric Channels
* Ascending, Descending, and Ranging channels for trend visualization and directional bias.
* Real-time auto-detection ensures patterns are updated with evolving price action.
2. Wedges & Triangles
* Rising/Falling Wedges (Expanding & Contracting).
* Ascending/Descending Triangles (Expanding & Contracting).
* Diverging & Converging Triangles.
* Supports pattern-specific breakout and reversal identification.
3. Double Tops & Bottoms
* Automatic recognition of key reversal zones.
* Visual cues allow fast, rule-based entry and exit decisions.
4. Harmonic Patterns
* Cypher, Shark, Crab, Butterfly, Bat, and Gartley pattern recognition.
* Advanced visual mapping of harmonic structures for precise market setups.
5. Trendlines
* Standard and curved trendlines, including real-time Ghost Curve candidate detection.
* Helps identify both micro and macro directional trends efficiently.
6. Auto Pattern Detection & Clarity Tools
* Smart overlap-avoidance minimizes chart clutter.
* All patterns auto-drawn directly on the chart.
* Uses clear boxes, colors, and line types for quick interpretation and structured analysis.
📌 Visual Design & Chart Clarity Standards
* Only essential live labels are displayed; historical labels remain hidden.
* Organized, modular visuals with consistent color schemes and line types.
* Clean, structured charts reduce cognitive load and improve decision-making speed.
📌 Inputs & Settings
* Default settings pre-configured
* Simple Show/Hide toggles for modules
* Minimal exposed fields for ease of use
📌 Recommended Timeframes & Markets
* Works best on 15M, 1H, 4H, Daily, and higher
* Suitable across forex, crypto, indices, and liquid equities
* Pivot-based modules may show noise on illiquid assets
📌 Performance & Limitations
* May draw many objects → disable unused modules for speed
* Refresh the chart if historical buffer issues occur
* TradingView platform limitations handled internally
📌 License & Legal
* Proprietary © 2025
* Redistribution, resale, or disclosure prohibited
* Independently developed with proprietary extensions
* Any resemblance to other tools may result from public-domain concepts
📌 Respect & Transparency
* Built on widely recognized public trading concepts.
* Developed with respect for the TradingView community.
* Any overlaps or similarities can be addressed constructively.
📌 Disclaimer
* Educational purposes only
* Not financial advice
* Trading carries risk — always use paper testing and proper risk management
📌 FAQs
* Source code is not public
* Works best on 15m, 1H, 4H, Daily, Weekly charts
* Modules can be hidden/shown with toggles
* Alerts can be set up manually by users
* Supports multiple markets: forex, crypto, indices, and equities
📌 About Ghost Trading Suite
Author: BIT2BILLIONS
Project: Ghost Trading Suite © 2025
Indicators: Ghost Matrix, Ghost Protocol, Ghost Cipher, Ghost Shadow
Strategies: Ghost Robo, Ghost Robo Plus
Pine Version: V6
The Ghost Trading Suite is designed to simplify and automate many aspects of chart analysis. It helps traders identify market structure, divergences, support and resistance levels, and momentum efficiently, reducing manual charting time.
The suite includes several integrated tools — such as Ghost Matrix, Ghost Protocol, Ghost Cipher, Ghost Shadow, Ghost Robo, and Ghost Robo Plus — each combining analytical modules for enhanced clarity in trend direction, volatility, pivot detection, and momentum tracking.
Together, these tools form a cohesive framework that assists in visualizing market behavior, measuring momentum, detecting pivots, and analyzing price structure effectively.
This project focuses on providing adaptable and professional-grade tools that turn complex market data into clear, actionable insights for technical analysis.
Crafted with 💖 by BIT2BILLIONS for Traders. That's All Folks!
📌 Changelog
v1.0 – Core Release
* Added detection and visualization of ascending, descending, and ranging channels.
* Implemented expanding and contracting wedges with automatic labeling.
* Added diverging, converging, ascending, and descending triangles (expanding & contracting).
* Introduced double top and double bottom reversal pattern detection.
* Integrated harmonic patterns: Cypher, Shark, Crab, Butterfly, Bat, Gartley.
* Added trendline tools, including curved trendlines with real-time Ghost Curve candidate detection.
* Implemented auto pattern detection for triangles, wedges, and channels
HTF SMT in LTF [Tradeisto]Version 1.0.0
This marks the first official release of the HTF SMT in LTF indicator. This tool has been engineered to provide high-precision Smart Money Technique (SMT) divergence detection across multiple timeframes with a focus on real-time accuracy and visual clarity.
Primary Features
Time-Sync Execution: The indicator utilizes a master-clock architecture to synchronize secondary ticker price data with the exact timestamp of main ticker pivots. This ensures that divergences are calculated based on identical moments in time, eliminating the false signals common in standard SMT scripts.
8-Slot Multi-Timeframe Support: Integrated monitoring for the current chart timeframe plus 7 additional higher timeframe (HTF) slots. Each slot is independently toggleable and customizable.
Anticipatory SMT Discovery: Implemented a live detection layer that plots dotted lines as soon as a potential divergence forms. This allows for tactical anticipation of market turns before a pivot is mathematically confirmed.
Real-Time Invalidation: Live anticipatory lines are monitored continuously and will automatically be removed if price action breaks the divergence criteria before the candle close.
Higher Timeframe Priority: Built-in overlap prevention automatically filters redundant signals. When multiple timeframes trigger at the same price level, the higher timeframe is given visual priority to maintain chart cleanliness.
Wick-to-Wick Alignment: Advanced time-mapping ensures that higher timeframe SMT lines are drawn with absolute precision across the high and low wicks of lower timeframe charts.
Pre-Configured Defaults
90-Minute Focus: HTF Slot 7 is enabled by default and pre-set to the 90-minute timeframe for specialized intraday analysis.
Optimized UI: The indicator header remains uncluttered by omitting the shorttitle parameter.
Technical Implementation
Custom Type Architecture: The script uses advanced Pine Script v5 types for efficient state management and data storage.
Dynamic Requests: Optimized for performance using TradingView's dynamic request engine to handle multiple ticker inputs simultaneously.
Timestamp Uniqueness: Pivot identification is handled via Unix timestamps to correctly differentiate and process Double Tops and Double Bottoms.
JD Moon - HLOC BOXကျွန်တော် JD Moon ပါ၊
ဒီ Box with Pivot levels Indicator က Intraday Trader တွေအတွက် အချိန်ကုန်သက်သာအောင် တကူးတက ဆွဲစရာမလိုအောင် Price Action သမားတွေအတွက် အသုံးလိုတဲ့အရာမို့ ဖန်တီးထားတာပါ၊ အရမ်း ရိုးရှင်းပြီး အရမ်း အသုံးဝင်ပါတယ်။ တစ်ရက်အတွင်း စျေးနှုန်းအရွေ့ကို စောင့်ကြည့်ဖို့ပါ။ အထူးသဖြင့်ကျွန်တော့်အတွက် ဖန်တီးထားတာဖြစ်ပြီး လိုအပ်သူတွေ ကျွန်တော့်လို Chart တိုင်းမှာ လှိုင်းဆွဲဖို့ ငပျင်းလေးတွေ ယူသုံးနိုင်ပါတယ်။
Minty Probability ModelThis indicator shows a historical distribution of outcomes based on similar past market conditions.
Green = average outcome
Blue = historical upside extreme
Red = historical downside extreme
//==================== INPUTS ====================
// Pattern Length
// The number of recent bars used to define the “current market fingerprint”.
// 20 bars is good for days
// raise it for smoother predictions
// default = 20
// Lookback Bars
// How far back the script searches for historical analogs.
// 800 daily bars is outside 2021 squeeze for GME
// increase for inclusion, decrease for more relevance
// default = 800
// Forward Bars
// The future window length used to measure outcomes.
// <10 for momentum trades
// 40+ for big swing plays
// default = 15
// Top Matches
// How many historical analogs are averaged.
// 6 still shows spikes
// lower to 3 to explore fringe chances - moass?
// raise over ~15 to remove spikes
// default = 6
// Return Weight
// Raise → Echo chamber like behavior
// Lower → Structure over noise
// default = 1
// Volume Weight
// High → favors accumulation/distribution patterns
// Low → ignores big volume spikes
// default = .6
// ATR Weight
// High → separates calm vs chaos
// Low → mixes regimes (dangerous)
// default = .8
// Trend Weight
// High → trend-following bias
// Low → mean-reversion bias
// default = .7
// RSI Weight
// High → value potential reversals of direction
// Low → expect momentum to continue
// default = .5
CryptoAntidote SpecialThis script looks for ranges and detects breakouts at key levels and draw signals - Always trade in the direction of trend and ignore opposite side signals.
Full alerts options are also available.
Enjoy!!
UTC-5 Time MarkersFor model 110 of DTT use flout with this as a bias and you will catch high wr high rr trades for this certain time window of continuation or reversal
RACHERO (Z-Div)RACHERO (Z-Div) (Rachero Preview – Limited Version) is a proprietary market-pressure indicator that highlights unusual participation and momentum shifts often preceding key price moves. It emphasizes normal versus extreme conditions and marks early inflection zones where price behavior becomes unstable, helping traders anticipate potential reversals or strong continuations with minimal clutter.
NL Session High/Low ticks (16:30-17:30) - 5mthis is a 5 minut chart open and close off the new york open highs and lows
ICT Killzones/Opening Prices/RELS/REHSThis TradingView indicator delivers clean, enhanced plotting of key trading session Highs and Lows (Asian, London, New York, and/or any custom sessions) in true ICT/SMC style — with thoughtful adjustments to cut noise, highlight high-probability levels, and give you full control for faster, clearer analysis.
Core features:
Plots Session Highs and Session Lows as customizable horizontal lines with optional labels, colors, styles, thickness, and fade-out for older levels
Marks Quality Highs and Quality Lows — visually distinguishing more reliable/significant extremes (e.g., unmitigated, displacement-backed, or liquidity-magnet levels based on ICT criteria)
Detects and highlights Relative Equal Highs and Relative Equal Lows — those subtle but powerful liquidity pools where price fails to push new extremes on retests, often acting as draws for sweeps or reversal confirmations
Customizable Key Opening Price Points — mark and highlight critical opens (e.g., midnight, 8:30 AM, NY open, 4H candle opens, or any user-defined times) as lines or labels to frame premium/discount zones, order blocks, or intraday bias shifts
100% customizable settings: session times/timezones, quality/relative equality thresholds (tolerance for 'relative' matching), mitigation/sweep removal, lookback periods, line behavior on breach, label visibility, and more — dial it in exactly how you trade without chart clutter
Built for ICT traders targeting liquidity grabs, PD Arrays, session reversals, or clean intraday structure. No more default-tool overload or guessing on relative levels — this gives precision, reduces visual fatigue, and lets you focus on high-edge setups.
If you're tired of noisy charts but still want deep ICT alignment (session extremes + relative equals + key opens), this one's designed to actually help you trade better. Solid upgrade path from basic session tools
CapitalFlowsResearch: Sensitivity BandsCapitalFlowsResearch: Sensitivity Bands — Expected-Move Projection from Cross-Asset Beta
CapitalFlowsResearch: Sensitivity Bands builds on the idea of cross-asset sensitivity by turning beta into a set of projected price boundaries around the prior day’s close. Instead of showing beta as a standalone number, this tool translates it into real price levels that represent the expected magnitude of movement—up or down—given a typical shock in a chosen market driver.
The script measures how strongly the price asset has been responding to moves in the driver over a rolling window, then uses that relationship to calculate a dynamic “band width.” That width is applied symmetrically around the previous daily close to create two horizontal bands: an upper range and a lower range. These lines update intraday, offering a real-time sense of whether current price action is unfolding within normal sensitivity limits or pushing into statistically unusual territory.
Traders can choose how the driver’s changes are interpreted (basis points, absolute moves, or percent changes), and optionally replace the rolling band with a running mean to emphasise longer-term structural sensitivity. The resulting overlay acts much like an expected-move model—similar in spirit to options-derived ranges, but powered by beta dynamics rather than implied volatility.
In practice, Sensitivity Bands serves as a clean framework for contextualising market movement:
Inside the bands: price behaviour aligns with typical cross-asset sensitivity.
Touching a band: movement is strong but still consistent with historical response.
Breaking a band: indicates a regime shift, a driver disconnect, or unusually high momentum.
All of this is achieved without exposing the underlying beta calculations or normalisation logic.
FVG + Manip (optimized)
This indicator detects **Fair Value Gaps (FVGs)** using a **3-candle confirmation rule**, draws each FVG as a **boxed zone** on the chart (optionally with a **50% midpoint dashed line**), then monitors price action to:
1. flag a **“reaction”** when price touches the zone **and the candle body closes completely outside the zone**, and
2. **delete** the zone once it has been **fully filled** (either by wick or by body, depending on user settings).
Additionally, it colors the candle **green or red** only when a **manipulative candle** occurs *and* a matching **FVG reaction** is detected (bullish or bearish).
---
## Inputs and User Settings
### 1) FVG fill (“close”) method
**`closeMethod`** can be:
* **BODY**: the FVG is considered filled only when the **candle body** fully fills it.
* **WICK**: the FVG is considered filled when the **wick** fully fills it.
This setting affects when zones are deleted.
### 2) Manipulative candle detection mode
**`manipMode`** can be:
* **BASE**
* **BASE + BREAK**
* **DISPLACEMENT**
If **DISPLACEMENT** is selected, it also uses:
* **`dispPct`** = minimum body size as a % of candle range (0–1).
Example: `0.5` means the candle body must be at least **50%** of its full range.
### 3) Visual styling
You can set:
* Bull and bear FVG fill/border colors
* Fill transparency
* Border thickness
* Whether to show the **50% midpoint line**
* Midline colors and thickness
---
## Candle Measurements (for displacement logic)
For each candle it computes:
* **bodyHigh** = max(open, close)
* **bodyLow** = min(open, close)
* **bodySize** = abs(close − open)
* **rangeSize** = max(high − low, minimum tick)
* **hasDisp** = true if `bodySize >= rangeSize * dispPct`
So in DISPLACEMENT mode, a candle qualifies only if its body is “big enough” relative to its range.
---
## Manipulative Candle Logic
The script defines “manipulative” candles separately for bullish and bearish directions.
### BASE mode
* **Bullish (c1Green):**
The candle makes an equal/lower low vs the previous candle (`low <= low `) and closes bullish (`close > open`).
* **Bearish (c1Red):**
The candle makes an equal/higher high vs the previous candle (`high >= high `) and closes bearish (`close < open`).
### BASE + BREAK mode
* **Bullish (c2Green):**
It makes a lower low (`low < low `) and closes back above the previous low (`close > low `), and is bullish (`close > open`).
* **Bearish (c2Red):**
It makes a higher high (`high > high `) and closes back below the previous high (`close < high `), and is bearish (`close < open`).
### DISPLACEMENT mode
Same as BASE + BREAK, but also requires **hasDisp**:
* **Bullish (c3Green):** `c2Green and hasDisp`
* **Bearish (c3Red):** `c2Red and hasDisp`
Finally:
* **manipGreen** is true if the selected mode’s bullish condition is true
* **manipRed** is true if the selected mode’s bearish condition is true
---
## FVG Detection (3-candle confirmed)
It defines an FVG using candles `0`, `1`, and `2` (current candle = 0):
### Bullish FVG confirmed
```pine
bullFvgConfirmed = low > high
```
Meaning the **current candle’s low** is above the **high of two candles ago** → an “upward gap” across 3 candles.
### Bearish FVG confirmed
```pine
bearFvgConfirmed = high < low
```
Meaning the **current candle’s high** is below the **low of two candles ago** → a “downward gap”.
---
## Zone Creation and Drawing
When an FVG is confirmed, the script creates:
* a **box** representing the zone
* an optional **dashed midpoint line** at 50%
### Bullish zone geometry
* **Top = current low**
* **Bottom = high **
The box starts at the current bar and extends right by:
* **`extendBars = 500`**
### Bearish zone geometry
* **Top = low **
* **Bottom = current high**
### Midline (50%)
Midpoint is:
```pine
mid = (zTop + zBot) / 2
```
A dashed line is drawn across the same 500-bar extension.
If `showMidline` is false, the line is made effectively invisible.
---
## Storage / Object Management (maxKeep)
The script stores:
* bull boxes + their midlines
* bear boxes + their midlines
It keeps at most:
* **`maxKeep = 120`** zones per direction
When exceeded, it deletes the oldest box and its line to stay within limits.
---
## Zone Monitoring: Reaction + Deletion
Every bar, it loops through all stored zones and checks:
### A) “Touch” condition (common)
```pine
touches = (high >= zBot) and (low <= zTop)
```
This means the candle range overlaps the zone at least partially.
---
### B) Reaction rules (strict: body must be outside)
The script’s comment says:
**Reaction requires body OUTSIDE zone (never inside).**
#### Bullish reaction
```pine
if touches and (bodyLow > zTop)
bullReactNow := true
```
So price touched the zone, but the **entire candle body is above the zone** (bodyLow is above the zone top).
This is a “tap + rejection upward” style reaction.
#### Bearish reaction
```pine
if touches and (bodyHigh < zBot)
bearReactNow := true
```
Touched the zone, but the **entire candle body is below the zone** (bodyHigh is below zone bottom).
This is a “tap + rejection downward” reaction.
---
### C) Deletion rules (zone “filled”)
#### Bullish FVG fill
* Wick fill:
```pine
filledW = (low <= zBot)
```
* Body fill:
```pine
filledB = (bodyLow <= zBot)
```
Delete if:
* `closeMethod == WICK` and `filledW`
* OR `closeMethod == BODY` and `filledB`
#### Bearish FVG fill
* Wick fill:
```pine
filledW = (high >= zTop)
```
* Body fill:
```pine
filledB = (bodyHigh >= zTop)
```
Delete if:
* `closeMethod == WICK` and `filledW`
* OR `closeMethod == BODY` and `filledB`
When deleting, it removes:
* the box
* its corresponding midpoint line
* the entries in the arrays
---
## Final Candle Coloring (no overlap)
At the end, it colors candles only if:
* there is a **manipulative candle**, and
* there is a **reaction** in the same direction, and
* the opposite reaction is not simultaneously active
### Bullish candle coloring
```pine
greenFinal = manipGreen and bullReactNow and not bearReactNow
```
→ candle becomes **lime**
### Bearish candle coloring
```pine
redFinal = manipRed and bearReactNow and not bullReactNow
```
→ candle becomes **red**
If neither condition is met, `barcolor(na)` leaves candles unchanged.
---
## In short (one-liner)
This script draws 3-candle FVG zones, keeps them extended forward, deletes them only when fully filled (by wick/body setting), and highlights candles only when a chosen “manipulative” candle pattern happens at the same time as a strict “touch + body rejection” reaction from a bull/bear FVG.
If you want, I can also write a clean “user manual” style description (what signals mean, how to use settings, typical setups for scalping vs swing) in English.
ASIA + ALERT (Touch after 09:00)This script is a pure indicator designed to analyze price action around the Asian session and provide contextual market structure information.
It does not open trades and does not manage positions.
1. Asia Session Box (Core Reference)
The script identifies the Asian session from 23:00 to 07:00 (Rome time).
During this period it:
Tracks the highest high and lowest low.
Draws a visual box on the chart that expands in real time.
This Asia range becomes the main reference framework for the rest of the logic.
2. Yellow Candles (Imbalance / FVG Detection)
The script detects “yellow candles” using a Fair Value Gap–style logic:
Bullish imbalance or bearish imbalance patterns.
Only yellow candles formed outside the Asian session are stored.
These candles represent potential supply or demand origins.
3. Zone Creation (After Asia Ends)
When the Asian session ends (07:00):
The script scans the stored yellow candles.
It creates price zones based on their position relative to the Asia range:
LONG zones → yellow candles below the Asia low
SHORT zones → yellow candles above the Asia high
The user can choose:
To use only the first valid yellow candle, or
To also include the second valid yellow candle (optional).
Zones are drawn as boxes that extend to the right, acting as areas of interest.
4. Zone Touch Alert (After 09:00 Only)
The script can trigger one single alert:
Only after 09:00 (Rome time).
Only when price actually touches the zone entry level:
LONG → touch of the upper boundary of the long zone.
SHORT → touch of the lower boundary of the short zone.
Once a zone is touched:
It can be marked as consumed, preventing further alerts (optional).
The zone changes visual style to indicate it is no longer active.
5. Trend Table (Multi-Timeframe Context)
A compact table is displayed in the top-right corner of the chart.
It shows BULL / BEAR / NA for the following selectable timeframes:
M1, M3, M5, M15, H1, H4, Daily
Trend direction is determined using market structure pivots:
Break above the last pivot high → BULL
Break below the last pivot low → BEAR
No break → NA
All table colors and timeframes are fully customizable.
6. What This Script Is Meant For
Session-based market structure analysis
Supply & demand context
Multi-timeframe directional bias
Precise zone interaction alerts
Discretionary trading support
7. What This Script Does NOT Do
❌ No trades
❌ No backtesting
❌ No risk management
❌ No entries or exits
It is designed to support decision-making, not to automate trading.
Advanced Harmonic Pattern Detector v6Advanced Harmonic Pattern Detector and Backtesting Suite (Pine Script v6)
Overview
The Advanced Harmonic Pattern Detector and Backtesting Suite is an original TradingView indicator designed to identify harmonic price patterns using Fibonacci-based ratio validation. The script automatically detects harmonic structures in real time, plots their defining price legs, and highlights potential reversal zones derived from Fibonacci confluence.
In addition to pattern visualization, the indicator includes an integrated backtesting module that allows traders to evaluate historical pattern performance directly on the chart using configurable trade parameters.
The indicator is applicable across multiple asset classes, including forex, crypto, stocks, indices, and futures, and can be used on any timeframe.
Supported Harmonic Patterns
The indicator detects both bullish and bearish variations of the following patterns:
Gartley
Bat
Alternate Bat
Butterfly
Crab
Deep Crab
Shark
AB=CD
Three-Drive
Five-Zero
Each pattern is validated using predefined Fibonacci ratio relationships between the XA, AB, BC, and CD legs. Ratio tolerances are pattern-specific to balance accuracy and practical signal frequency.
Pattern Detection Logic
The detection engine is built around objective price-structure analysis and includes:
Automatic swing high and swing low identification
Fibonacci ratio validation for each pattern leg
Support for both retracement-based and extension-based patterns
Pattern confirmation using completed price data only
Once a pattern is confirmed, it is fixed on the chart and does not repaint.
Potential Reversal Zones (PRZ)
For each validated pattern, the indicator calculates and plots a Potential Reversal Zone based on Fibonacci confluence across relevant pattern legs. These zones are displayed directly on the chart and are intended to help traders anticipate areas where price may react, rather than signaling guaranteed reversals.
Bullish and bearish patterns are visually distinguished to maintain clarity during live analysis.
Integrated Backtesting and Performance Analysis
The indicator includes a built-in backtesting component that allows traders to simulate pattern-based trades using historical data. Features include:
Pattern-triggered trade simulation
User-defined stop-loss and take-profit levels
Adjustable risk-to-reward parameters
Trade count, win rate, and summary statistics
Results displayed in an on-chart performance table
This functionality enables traders to evaluate harmonic pattern behavior statistically within the same tool used for analysis.
Customization and Controls
Users can customize the indicator by:
Enabling or disabling individual harmonic patterns
Toggling bullish and bearish detection independently
Adjusting Fibonacci tolerance thresholds
Configuring stop-loss and take-profit ratios
These options allow the script to be adapted to different markets, instruments, and trading approaches.
Intended Use
This indicator is designed as a technical analysis and decision-support tool for traders who incorporate harmonic patterns and Fibonacci structure into their analysis. It is not a buy or sell signal generator and should be used alongside broader market context and risk management.
Disclaimer
This indicator is intended for educational and analytical purposes only and does not constitute financial advice. Always apply proper risk management and confirm analysis with additional tools.
Engulfing Bar Paradigm [Blaz]Version 1.0 – Published Jan 2026: Initial release
1. Overview & Purpose
The Engulfing Bar Paradigm (EBP) is a multi-timeframe price-action tool built to help traders identify important engulfing candles on higher timeframes and use them to define daily market bias and structure.
At its core, the indicator detects strong high-timeframe engulfing candles. These are candles where price takes one side of the previous candle’s range and closes beyond its body, suggesting a shift in control. When this happens, it provides a structural reference that traders use to interpret directional context, making these candles useful for setting bias rather than reacting to short-term noise.
Once an EBP forms, the indicator automatically highlights and measures the key parts of that engulfing move. This helps traders understand how price is behaving after the displacement and how structure develops across lower timeframes.
The indicator is designed to work across multiple asset classes and timeframes, allowing traders to align intraday price action with higher-timeframe intent. It does not provide buy or sell signals. Instead, it offers a structured way to read the market, build bias, and make more informed decisions based on price behaviour and context.
2. Core Functionality & Key Features
The Engulfing Bar Play (EBP) is built around a mechanical and rule-based interpretation of engulfing price action, enhanced through multi-timeframe analysis and contextual structure mapping.
2.1. High-Timeframe Engulfing Detection
The indicator monitors a user-selected higher timeframe and automatically identifies valid bullish and bearish engulfing candles. These engulfing moves represent strong participation and often mark areas where control shifts in the market. Each detected EBP acts as a reference point for bias and subsequent price interaction.
2.2. Directional Bias Control
Users can choose to display bullish only, bearish only, or both types of setups. This helps traders stay aligned with their intended market bias and avoid distractions from opposing setups.
2.3. Engulfing Range Mapping
Once an EBP forms, the indicator plots the full engulfing range and divides it into four equal sections (quartiles). These levels help traders understand how price interacts within the range and where reactions are more likely to occur.
2.4. Fair Value Gaps (FVGs) Inside the EBP
The indicator detects Fair Value Gaps created during the engulfing move. These gaps highlight areas of imbalance where price may later react. Traders can choose whether to display mitigated and unmitigated gaps for cleaner analysis.
2.5. Expansion Projections
Optional projection levels extend beyond the engulfing range, helping traders frame potential continuation or expansion once price moves away from the structure. These levels are intended to support expectations, not predictions.
2.6. Session Liquidity Integration
EBPs can be filtered to appear only after session liquidity has been taken, allowing traders to focus on engulfing structures that occur after stop-runs or range sweeps. Multiple session windows are supported, with built-in checks to ensure logical use.
2.7. Advanced HTF Candle Visualisation
To improve clarity, the indicator includes a higher-timeframe candle display, showing multiple HTF candles directly on the chart. This helps traders stay aware of where price is trading within the broader context.
Displayed elements include:
HTF candle bodies and wicks
HTF open
HTF Fair Value Gaps
HTF Volume imbalances
Chosen EBP timeframe label
Clear time labels for orientation
2.8. Built-In Safeguards
The indicator automatically validates timeframe relationships and session settings. If an invalid configuration is detected, features are disabled and a warning is shown, helping traders maintain clean and reliable analysis.
3. How to Use the Indicator
3.1. Select the Higher Timeframe
Begin by choosing a higher timeframe for the EBP (such as Daily or 4H). This timeframe defines where the indicator will look for engulfing structures. The chosen timeframe should be equal to or higher than the chart timeframe.
3.2. Identify the Active Engulfing Structure
When a valid engulfing structure forms on the selected higher timeframe, the indicator highlights the engulfing range on the chart. This structure becomes the reference point for understanding current market conditions and directional bias.
3.3. Establish a Bias
Use the direction of the engulfing structure to frame bias for the session. A bullish engulfing structure suggests bullish intent, while a bearish structure suggests bearish intent. Bias filters can be used to display only the setups that align with your directional view.
3.4. Observe Price Interaction Within the Range
As price develops on lower timeframes, observe how it interacts with the engulfing range, its internal levels and FVGs. This helps traders assess whether price is respecting the structure, consolidating, or expanding away from it.
3.5. Use HTF Context for Intraday Navigation
The higher-timeframe candle display provides additional context by showing where current price sits relative to recent HTF opens, imbalances, and structure. This helps maintain alignment with the broader market narrative throughout the session.
3.6. Combine With Your Existing Execution Model
The EBP indicator can complement your existing strategy or execution model. It provides context and structure, allowing traders to make decisions with higher-timeframe awareness rather than reacting to short-term price fluctuations.
4. Protected Logic & Original Design
The Engulfing Bar Paradigm (EBP) is the result of original development and systematic engineering. While the concept of engulfing candles is widely known in technical analysis, the logic, structure, and implementation used in this indicator are original to this indicator’s design.
This indicator does not rely on simple candlestick comparisons. Instead, it applies a rule-based, multi-timeframe framework that evaluates engulfing behaviour within a broader structural context. The way engulfing structures are detected, filtered, measured, and visualised—along with how internal ranges, imbalances, projections, and higher-timeframe elements are handled—reflects an original design approach developed specifically for this indicator.
5. Disclaimer
This indicator is provided for educational and analytical purposes only. It does not constitute financial advice, investment recommendations, or trading signals. All trading and investment decisions remain solely the responsibility of the user.
Trading financial instruments involves substantial risk of loss. Past performance of any trading methodology or indicator does not guarantee future results. Users should conduct their own research and consider consulting with qualified financial professionals before making trading decisions.
The indicator's pattern detection is based on technical analysis principles and should be used as part of a comprehensive trading approach. No trading tool can guarantee profitable outcomes or eliminate market risk.
By using this indicator, users acknowledge they understand these risks and accept full responsibility for their trading decisions and outcomes.
Multi-Doji Strategy IndicatorMulti-Doji Strategy Indicator – Trend-Aligned Doji Retest Analysis
Overview
The Multi-Doji Strategy Indicator is an original TradingView tool designed to systematically analyze Doji candles within a defined market context. The indicator identifies multiple Doji variations, maps their structural price levels, and monitors retests of those levels in alignment with the prevailing trend.
Rather than treating Dojis as isolated reversal signals, the script focuses on Doji psychology, location, and follow-through. This approach allows traders to evaluate Doji-based continuation or reversal setups using repeatable, rule-based logic while maintaining a price-action–focused workflow.
Doji Detection Logic
The indicator detects four commonly used Doji types:
Standard Doji
Long-Legged Doji
Dragonfly Doji
Gravestone Doji
Users can define acceptable body size and wick proportions, allowing the script to filter insignificant candles and adapt to different instruments and timeframes.
For each validated Doji, the indicator:
Highlights the candle body for immediate visual reference
Projects upper and lower wick levels as potential reaction zones
These levels represent areas where supply or demand was previously rejected.
Trend Context
To reduce counter-trend signals, the indicator includes multiple trend evaluation methods:
Structural trend analysis based on swing highs and lows
Moving-average slope analysis
A hybrid mode requiring agreement between structure and moving averages
Trend sensitivity, swing parameters, and moving-average settings are fully adjustable, allowing traders to control how strict trend qualification must be before signals are considered.
Retest-Based Signal Logic
Once a Doji is confirmed and aligned with trend context, the indicator monitors price for controlled retracements:
In bullish conditions, it observes retests into the lower Doji wick zone
In bearish conditions, it observes retests into the upper Doji wick zone
When predefined retracement and validation conditions are met, the indicator marks the bar where the retest occurs. These signals are intended to highlight potential entry zones, not guaranteed outcomes.
Customization and Alerts
The indicator includes:
Optional visual markers for retest events
User-controlled colors, shapes, and visibility settings
Alert conditions for Doji retest signals, allowing monitoring without constant chart observation
Inputs are organized into logical sections for Doji detection, trend logic, and signal behavior to keep configuration clear and manageable.
Intended Use
The Multi-Doji Strategy Indicator is designed to support:
Doji-based continuation and reversal analysis
Trend-aligned trade filtering
Structured price-action decision-making
It is suitable for use across all major markets and timeframes, including stocks, forex, futures, and crypto.
Disclaimer
This indicator is intended for educational and analytical purposes only and does not constitute financial advice. Always apply proper risk management and confirm analysis with additional tools.
Auto Channel DetectorChannel Detector — Automatic Price Channel Identification
Channel Detector is an original TradingView indicator designed to systematically identify and visualize price channels using objective market structure logic. Instead of relying on manually drawn trendlines, the script analyzes structural swing highs and lows to detect sustained, parallel price movement and dynamically construct price channels as the market evolves.
The indicator determines channel validity by confirming aligned swing points that define both an upper and lower boundary. Once a channel is established, it plots:
A channel high based on validated swing resistance
A channel low based on validated swing support
A midline representing the statistical equilibrium of the channel
This midpoint is useful for evaluating mean reversion, momentum continuation, and reaction zones within the channel.
By continuously evaluating new price data, Channel Detector adapts to changing conditions and highlights both trending environments and controlled consolidations. Rising channels, falling channels, and horizontal structures are all detected using the same consistent logic, allowing traders to compare market behavior across different symbols and timeframes without subjective bias.
How traders can use this indicator
Identify structured trends and avoid trading against established channel direction
Anticipate potential breakout areas when price approaches channel boundaries
Use the midline as a dynamic area for pullbacks, reactions, or trade management
Add objective structure to discretionary price-action analysis
The indicator includes multiple customization options, allowing users to control line styles, colors, and visibility so the output remains clean and readable on any chart layout.
Channel Detector is intended for traders who value clarity, repeatable structure, and rule-based interpretation of price movement rather than manually drawn or purely subjective channels.
ALT FINAL ABCD PRO V6 (ALERT READY)🇺🇸 Strategy Guide: ALT FINAL ABCD PRO V6
1️⃣ Recommended Chart SetupTimeframes: 5m or 15mMarket: Altcoin USDT Perpetual FuturesHigher Timeframe (HTF): 1H (Default)⚠️ Warning: 1-minute charts are NOT recommended due to high market noise.
2️⃣ Strategy OverviewThis strategy trades only high-probability Bull Flag & Bear Flag setups based on BTC trend, BTC Dominance, and EMA 200 positioning.
3️⃣ Trade ConditionsCategoryLONG ConditionsSHORT ConditionsAsset PriceAbove EMA 200Below EMA 200BTC TrendAbove EMA 200 & VWAPBelow EMA 200 & VWAPDominanceBelow its EMA (Alt Season)Above its EMA (Risk-Off)HTF TrendBullish on 1H chartBearish on 1H chartPatternStrong Impulse + Tight ConsolidationStrong Impulse + Tight PullbackLiquidityVWAP Sweep & ReclaimVWAP Rejection from Above
4️⃣ EMA 200 Rule (Critical)Price Above EMA 200: LONG ONLYPrice Below EMA 200: SHORT ONLYPrice Near EMA 200: ❌ No Trade (Indecision zone)
5️⃣ Risk ManagementStop Loss (SL): ATR × 0.8Take Profit (TP): ATR × 1.3Recommended Leverage: Max 3–5xStrict Rules: No averaging down, No counter-trend trades.
Indicator PackThis indicator suite generates automated signals based on technical analysis, including price action, momentum, and volume behavior. It is designed to help traders interpret market conditions faster and more consistently through visual markers and a dashboard-style view. Signals are provided for informational and educational purposes only and should not be used as a standalone trading system. This script is not financial advice and not a buy/sell recommendation. Always confirm with your own analysis and risk management. You are solely responsible for all trading decisions and outcomes.
VSA Patterns & Liquidity SweepDescription:
Overview This script creates a synergy between Volume Spread Analysis (VSA) and Institutional Liquidity concepts. The primary problem with standard VSA pattern detection is that high-volume rejection candles often appear randomly during strong trends, leading to false reversal signals.
To solve this, this indicator combines a custom Liquidity Persistence Algorithm with Strict VSA Pattern Recognition. The logic dictates that a VSA Reversal pattern (like a Shakeout or Upthrust) is statistically significant only if it occurs immediately following a "Sweep" of a key structural pivot (Liquidity Zone).
CONCEPTS & CALCULATIONS
1. The Liquidity Filter (Structure) Instead of using standard support/resistance, this script detects "Resting Liquidity" using Swing Highs and Swing Lows (ta.pivothigh / ta.pivotlow).
Persistence Logic: A unique feature of this script is "Level Persistence." When price pierces a pivot level, the level does not disappear immediately. It remains active for a user-defined period (default 5 bars). This accounts for "Stop Hunts" or "Double Taps" where price lingers beyond a level before reversing.
The Filter: The script records the timestamp of the last "Sweep" (when price breached a pivot). If a VSA pattern forms, the script calculates the delta between the Pattern Bar and the Last Sweep Bar. If the gap is within the tolerance threshold (e.g., 3 bars), the pattern is validated.
2. VSA Pattern Recognition (Volume & Shape) The script detects four specific VSA anomalies. These are not standard candlestick patterns; they are defined by rigid Volume and Wick-to-Body ratios:
Shakeout (SO): Detects a "Smart Money" trap where price is driven down to trigger stops and then reversed.
Logic: Requires rising volume (Vol > Vol > Vol ) + a massive lower wick (default >40% of range) + a small upper wick.
Upthrust (UT): The bearish inverse of a Shakeout.
Logic: High volume rejection of higher prices with a long upper wick (>40% of range).
Two Bar Reversal (TBR): A reversal pattern that compares the current bar's close/low against the previous bar's high/close.
Logic: Strict checks on Close > High (Bullish) combined with volume validation.
Engulfing Volume Reversal (EVR): A custom variation of the engulfing candle.
Logic: It requires the engulfing wick to exceed the body size by a ratio of 0.5 (configurable), ensuring the move is volatility-driven, not just a small candle engulfing a smaller candle.
HOW TO USE
Wait for Liquidity Lines: The script automatically plots Red (Resistance) and Teal (Support) lines from pivots.
Watch for Sweeps: Wait for price to trade through these lines (the line will turn dashed or fade, indicating a sweep).
Pattern Confirmation:
Diamonds (SO/UT): Indicate high-volatility rejections.
Triangles (TBR): Indicate immediate structure shifts.
Squares (EVR): Indicate volume-backed engulfing moves.
Alerts: The script includes a "Preview" mode for live trading but alerts are hard-coded to fire only on Bar Close to prevent repainting/false signals.
SETTINGS
Candle Shape: Users can relax or tighten the definition of a "Long Wick" (default 40%) to fit different asset volatilities (e.g., Crypto vs. Forex).
Liquidity Persistence: Adjust how long a level remains "active" after being broken.
Liquidity Filter On/Off: Traders can disable the filter to see raw VSA patterns for backtesting purposes.
CRT Dashboard Scanner | Daily or Weekly CRT
CRT Dashboard Scanner — D1/W1 CRT (OANDA)
This indicator is a simple scanner dashboard that checks a predefined list of OANDA FX pairs and displays only the pairs where a CRT candle has formed on the selected higher timeframe.
What it shows
A clean table dashboard with:
Symbol
CRT direction
↑ Bullish CRT (CRT LOW)
↓ Bearish CRT (CRT HIGH)
Core logic (no repaint)
The scan is based on your CRT candle definition.
It uses only the last closed candle of the selected timeframe (confirmed HTF data), so the dashboard does not repaint.
Timeframe selection (D1 or W1) — why they are separated
Daily and Weekly CRT signals represent different market context:
D1 CRT is more frequent and useful for short-to-medium term opportunities.
W1 CRT is slower, more selective, and often reflects higher-level directional context.
They are separated because scanning both at the same time across many symbols would require significantly more data requests and would hit TradingView’s performance limits. Keeping the scan to one HTF at a time ensures:
faster loading
stable performance
clean, readable results
How to use
Select Scan timeframe: D1 or W1
Watch the table for symbols that print a CRT candle
Open the chart of the symbol and apply your trading plan / confirmation process
Want alerts and multi-timeframe confluence?
This scanner is intentionally lightweight and dashboard-focused.
For more features, alerts, and multi-timeframe bias confluence, check my other indicator: Smart Bias Toolkit.
Mister Blueprint Pro Release v1.24 [ChartWhizzperer]Mister Blueprint Pro® — Initial Release v1.24
Clean direction. Precise entries. Disciplined execution.
Built for lower timeframes & Range Charts (50R, 100R & 200R)
Badges: Indices • FX • high-liquidity assets | Webhook-ready (PineConnector-compatible) | Multilingual (EN/DE/ES/FR/JA/ZH/AR/KO/RU/VI/HI/TR)
────────────────────────────────────────
What it is — and what it does
────────────────────────────────────────
Mister Blueprint Pro® is a modular execution framework engineered for high-liquidity assets and active market phases.
Designed for lower timeframes and Range Charts, it helps you separate clean participation from low-quality conditions — and
translates decisions into clear, automation-ready signals.
No clutter. No confusion. Just a focused toolkit for structure, timing, and execution.
────────────────────────────────────────
Modules (what they do)
────────────────────────────────────────
1) DynamicRange-Trendcloud
Defines the active trading direction and provides a clean structure layer to stay aligned with the dominant move.
Helps reduce “signal vs. structure” conflicts by keeping entries tied to market context.
2) Smart Stacking
Enables controlled position building with strict quality focus.
Adds exposure only when conditions justify it — with safeguards that prevent repeated or noisy add-ons.
Built to prioritise the single best moment instead of chasing frequency.
3) Momentum Engine (optional)
Adds an additional participation layer for active phases when price expands and momentum is present.
Includes a selectable trading profile (aggressive / balanced) to match your execution style.
Optional candle colouring provides fast visual feedback for momentum states.
4) Neutral Candle Filter (optional)
Prevents entries during neutral / indecisive momentum phases.
Keeps you selective on lower timeframes by waiting for a clearer participation state before executing.
5) Session Filter Plus (optional)
Lets you define trading sessions and keeps execution disciplined by restricting signals to your active windows.
Provides background session shading for instant orientation.
When a session is OFF, alerts/webhooks stay silent.
6) Support & Resistance Level (visual module)
Plots clean, dynamic support/resistance zones derived from live price structure.
Helps map key areas for decision-making and trade management without overwhelming the chart.
7) Close-All + Global Kill Switch
Provides dedicated Close-All signals for long and short.
Prefer manual exits? The Global Kill Switch disables all Close-All output instantly, so you keep full exit control.
8) Multilingual Interface
Human-facing labels available in:
EN / DE / ES / FR / JA / ZH / AR / KO / RU / VI / HI / TR
────────────────────────────────────────
Real-time signals & webhook automation
────────────────────────────────────────
Mister Blueprint Pro® emits real-time signals via TradingView alerts and webhook interfaces.
The production API is intentionally minimal for clean automation workflows:
• Mister Blueprint Buy → OPEN_LONG
• Mister Blueprint Sell → OPEN_SHORT
• Mister Blueprint Close All (Long) → CLOSE_LONG
• Mister Blueprint Close All (Short) → CLOSE_SHORT
These signals can be routed directly through a webhook endpoint (e.g., PineConnector) for execution, logging, or monitoring.
────────────────────────────────────────
Who it’s for
────────────────────────────────────────
Built for traders who operate in high-liquidity markets and active phases — and who need a framework that stays clean,
fast, and automation-ready on lower timeframes and Range Charts.
If you value context-first execution, disciplined scaling, and webhook signals that don’t get in your way, this is for you.
────────────────────────────────────────
Quick start (recommended)
────────────────────────────────────────
• Use lower timeframes and/or Range Charts (50R, 100R, 200R or higher).
• Start with DynamicRange-Trendcloud as the backbone.
• Add Smart Stacking for controlled scaling.
• Enable Momentum Engine when you want extra participation in active phases.
• Use Neutral Candle Filter for stricter selectivity.
• Activate Session Filter Plus to limit signals to your trading windows.
• Prefer manual exits? Switch on the Global Kill Switch.
────────────────────────────────────────
Note
────────────────────────────────────────
No hype. No holy grails.
A precise execution framework for structure, timing, and participation — built for markets that move.
MISTER BLUEPRINT PRO® is a registered European Union trade mark (EUTM No. 019205166).
Invite-only distribution
This script is offered exclusively by invitation to protect independently developed methods, reduce unauthorised redistribution,
and ensure controlled onboarding, support, and quality assurance.
Disclaimer
Signals and alerts are provided for informational purposes only and do not constitute financial advice or a recommendation to buy or sell.
Trading involves substantial risk and may result in the total loss of capital. Execution via third-party tools may differ from alerts.
Past performance is not indicative of future results.






















