Conversion indicateur ICT Concepts (Tradingview)
Forums › ProRealTime forum Français › Support ProBuilder › Conversion indicateur ICT Concepts (Tradingview)
- This topic has 1 reply, 2 voices, and was last updated 11 months ago by steveb1983.
Viewing 2 posts - 1 through 2 (of 2 total)
-
-
05/29/2023 at 5:34 PM #215359
Bonjour à tous,
Je souhaiterais savoir s’il y avait des personnes compétentes et motivées pour convertir le code suivant.
Je trouve cette approche très intéressante et si je pouvais en profiter sur Prorealtime ce serait génial.
Je pense que cela pourrait intéresser d’autres membres aussi.
Voici le code.
Merci d’avance.
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144// This work is licensed under a Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0) https://creativecommons.org/licenses/by-nc-sa/4.0/// © LuxAlgo//@version=5indicator("ICT Concepts [LuxAlgo]", max_lines_count=500, max_boxes_count=500, max_labels_count=500, max_bars_back=3000, overlay=true)//-----------------------------------------------------------------------------}//Strings//-----------------------------------------------------------------------------{o = 'Options'sp1 = ' 'sp2 = ' 'hl = 'High / Low ' + sp1ny_ = 'New York' + sp1lo_ = 'London Open'lc_ = 'London Close'as_ = 'Asian'//-----------------------------------------------------------------------------}//Settings//-----------------------------------------------------------------------------{i_mode = input.string( 'Present' , title = 'Mode' , options =['Present', 'Historical'] )//Market Structure ShiftshowMS = input.bool ( true , title = '' , group = 'Market Structures', inline = 'MS' )len = input.int ( 5 , title = ' Length ' +sp2 , group = 'Market Structures', inline = 'MS' , minval = 3, maxval = 10 )iMSS = input.bool ( true , title = ' MSS' +sp1 , group = 'Market Structures', inline = 'M1' )cMSSbl = input.color (color.new(#00e6a1, 0), title = 'bullish' , group = 'Market Structures', inline = 'M1' )cMSSbr = input.color (color.new(#e60400, 0), title = 'bearish' , group = 'Market Structures', inline = 'M1' )iBOS = input.bool ( true , title = ' BOS' +sp1 , group = 'Market Structures', inline = 'BS' )cBOSbl = input.color (color.new(#00e6a1, 0), title = 'bullish' , group = 'Market Structures', inline = 'BS' )cBOSbr = input.color (color.new(#e60400, 0), title = 'bearish' , group = 'Market Structures', inline = 'BS' )//DisplacementsDispl = input.bool ( false , title = 'Show Displacement' , group = 'Displacement' )perc_Body = 0.36 // input.int( 36, minval=1, maxval=36) / 100bxBack = 10 // input.int( 10, minval=0, maxval=10)sVimbl = input.bool ( true , title = '' , group = 'Volume Imbalance' , inline = 'VI' )visVim = input.int ( 2 , title = " # Visible VI's "+sp1, group = 'Volume Imbalance' , inline = 'VI' , minval = 2, maxval = 100 )cVimbl = input.color (color.new(#06b2d0, 0), title = '' , group = 'Volume Imbalance' , inline = 'VI' )//Order BlocksshowOB = input.bool ( true , title = 'Show Order Blocks' , group = 'Order Blocks' )length = input.int ( 10 , title = 'Swing Lookback' , group = 'Order Blocks' , minval = 3 )showBull = input.int ( 1 , title = 'Show Last Bullish OB' , group = 'Order Blocks' , minval = 0 )showBear = input.int ( 1 , title = 'Show Last Bearish OB' , group = 'Order Blocks' , minval = 0 )useBody = input.bool ( true , title = 'Use Candle Body' )//OB StylebullCss = input.color (color.new(#3e89fa, 0), title = 'Bullish OB ' , group = 'Order Blocks' , inline = 'bullcss' )bullBrkCss = input.color (color.new(#4785f9, 85), title = 'Bullish Break ' , group = 'Order Blocks' , inline = 'bullcss' )bearCss = input.color (color.new(#FF3131, 0), title = 'Bearish OB' , group = 'Order Blocks' , inline = 'bearcss' )bearBrkCss = input.color (color.new(#f9ff57, 85), title = 'Bearish Break' , group = 'Order Blocks' , inline = 'bearcss' )showLabels = input.bool ( false, title = 'Show Historical Polarity Changes', group = 'Order Blocks' )//LiquidityshowLq = input.bool ( true , title = 'Show Liquidity' , group = 'Liquidity' )a = 10 / input.float ( 4 , title = 'margin' , group = 'Liquidity' , step = 0.1, minval = 2, maxval = 7 )visLiq = input.int ( 2 , title = '# Visible Liq. boxes' , group = 'Liquidity', minval = 1 , maxval = 50 , tooltip = 'In the same direction' )cLIQ_B = input.color (color.new(#fa451c, 0), title = 'Buyside Liquidity ' , group = 'Liquidity' )cLIQ_S = input.color (color.new(#1ce4fa, 0), title = 'Sellside Liquidity' , group = 'Liquidity' )//FVGshwFVG = input.bool ( true , title = 'Show FVGs' , group = 'Fair Value Gaps' )i_BPR = input.bool ( false , title = 'Balance Price Range' , group = 'Fair Value Gaps' )i_FVG = input.string( 'FVG' , title = o , group = 'Fair Value Gaps' , options=['FVG', 'IFVG'], tooltip = 'Fair Value Gaps\nor\nImplied Fair Value Gaps' )visBxs = input.int ( 2 , title = '# Visible FVG\'s' , group = 'Fair Value Gaps', minval = 1 , maxval = 20 , tooltip = 'In the same direction' )//FVG StylecFVGbl = input.color (color.new(#00e676, 0), title = 'Bullish FVG ' , group = 'Fair Value Gaps' , inline = 'FVGbl' )cFVGblBR = input.color (color.new(#808000, 0), title = 'Break' , group = 'Fair Value Gaps' , inline = 'FVGbl' )cFVGbr = input.color (color.new(#ff5252, 0), title = 'Bearish FVG ' , group = 'Fair Value Gaps' , inline = 'FVGbr' )cFVGbrBR = input.color (color.new(#FF0000, 0), title = 'Break' , group = 'Fair Value Gaps' , inline = 'FVGbr' )//NWOG/NDOGiNWOG = input.bool ( true , title = '' , inline='NWOG', group = 'NWOG/NDOG' )cNWOG1 = input.color (color.new(#ff5252, 28), title = 'NWOG ', inline='NWOG', group = 'NWOG/NDOG' )cNWOG2 = input.color (color.new(#b2b5be, 50), title = '' , inline='NWOG', group = 'NWOG/NDOG' )maxNWOG = input.int ( 3 , title = 'Show max', inline='NWOG', group = 'NWOG/NDOG' , minval = 0, maxval = 50 )iNDOG = input.bool ( false , title = '' , inline='NDOG', group = 'NWOG/NDOG' )cNDOG1 = input.color (color.new(#ff9800, 20), title = 'NDOG ', inline='NDOG', group = 'NWOG/NDOG' )cNDOG2 = input.color (color.new(#4dd0e1, 65), title = '' , inline='NDOG', group = 'NWOG/NDOG' )maxNDOG = input.int ( 1 , title = 'Show max', inline='NDOG', group = 'NWOG/NDOG' , minval = 0, maxval = 50 )//FibonacciiFib = input.string( 'NONE' , title = 'Fibonacci between last: ', group = 'Fibonacci', options=['FVG', 'BPR', 'OB', 'Liq', 'VI', 'NWOG', 'NONE'])iExt = input.bool ( false , title = 'Extend lines' , group = 'Fibonacci' )//KillzonesshowKZ = input.bool ( false , title = 'Show Killzones' , group = 'Killzones' )//New YorkshowNy = input.bool ( true , title = ny_ , inline = 'ny' , group = 'Killzones' ) and showKZnyCss = input.color (color.new(#ff5d00, 93), title = '' , inline = 'ny' , group = 'Killzones' )//London OpenshowLdno = input.bool ( true , title = lo_ , inline = 'lo' , group = 'Killzones' ) and showKZldnoCss = input.color (color.new(#00bcd4, 93), title = '' , inline = 'lo' , group = 'Killzones' )//London CloseshowLdnc = input.bool ( true , title = lc_ , inline = 'lc' , group = 'Killzones' ) and showKZldncCss = input.color (color.new(#2157f3, 93), title = '' , inline = 'lc' , group = 'Killzones' )//AsianshowAsia = input.bool ( true , title = as_ + sp2, inline = 'as' , group = 'Killzones' ) and showKZasiaCss = input.color (color.new(#e91e63, 93), title = '' , inline = 'as' , group = 'Killzones' )//-----------------------------------------------------------------------------}//General Calculations//-----------------------------------------------------------------------------{n = bar_indexhi = highlo = lowtf_msec = timeframe.in_seconds(timeframe.period) * 1000maxSize = 50atr = ta.atr(10)per = i_mode == 'Present' ? last_bar_index - bar_index <= 500 : trueperB = last_bar_index - bar_index <= 1000 ? true : falsexloc = iFib == 'OB' ? xloc.bar_time : xloc.bar_indexext = iExt ? extend.right : extend.noneplus = iFib == 'OB' ? tf_msec * 50 : 50mx = math.max(close , open)mn = math.min(close , open)body = math.abs(close - open)meanBody = ta.sma (body , len)max = useBody ? mx : highmin = useBody ? mn : lowblBrkConf = 0brBrkConf = 0r = color.r(chart.bg_color)g = color.g(chart.bg_color)b = color.b(chart.bg_color)isDark = r < 80 and g < 80 and b < 80//-----------------------------------------------------------------------------}//User Defined Types//-----------------------------------------------------------------------------{type ZZint [] dint [] xfloat [] ybool [] btype ln_dline lint dtype _2ln_lbline l1line l2label lbtype bx_lnbox bline ltype bx_ln_lbbox bxline lnlabel lbtype mssint dirline [] l_mssBlline [] l_mssBrline [] l_bosBlline [] l_bosBrlabel[] lbMssBllabel[] lbMssBrlabel[] lbBosBllabel[] lbBosBrtype liqbox bxbool brokenbool brokenTopbool brokenBtmline lntype obfloat top = nafloat btm = naint loc = bar_indexbool breaker = falseint break_loc = natype swingfloat y = naint x = nabool crossed = falsetype FVGbox boxbool activeint posvar mss MSS = mss.new(0, array.new < line >(), array.new < line >(), array.new < line >(), array.new < line >(), array.new < label >(), array.new < label >(), array.new < label >(), array.new < label >())//-----------------------------------------------------------------------------}//Variables//-----------------------------------------------------------------------------{maxVimb = 2var float friCp = na, var int friCi = na // Friday Close price/indexvar float monOp = na, var int monOi = na // Monday Open price/indexvar float prDCp = na, var int prDCi = na // Previous Day Open price/indexvar float cuDOp = na, var int cuDOi = na // Current Day Open price/indexvar _2ln_lb [] Vimbal = array.new< _2ln_lb >()var liq [] b_liq_B = array.new< liq >(1, liq.new(box(na), false, false, false, line(na)))var liq [] b_liq_S = array.new< liq >(1, liq.new(box(na), false, false, false, line(na)))var ob [] bullish_ob = array.new< ob >()var ob [] bearish_ob = array.new< ob >()var bx_ln [] bl_NWOG = array.new< bx_ln >()var bx_ln [] bl_NDOG = array.new< bx_ln >()var bx_ln_lb[] a_bx_ln_lb = array.new< bx_ln_lb >()var FVG [] bFVG_UP = array.new< FVG >()var FVG [] bFVG_DN = array.new< FVG >()var FVG [] bBPR_UP = array.new< FVG >()var FVG [] bBPR_DN = array.new< FVG >()var ZZ aZZ =ZZ.new(array.new < int >(maxSize, 0),array.new < int >(maxSize, 0),array.new < float >(maxSize, na),array.new < bool >(maxSize, na))var line _diag = line.new(na, na, na, na, color=color.new(color.silver, 50), style=line.style_dashed, xloc= xloc )var line _vert = line.new(na, na, na, na, color=color.new(color.silver, 50), style=line.style_dotted, xloc= xloc )var line _zero = line.new(na, na, na, na, color=color.new(color.silver, 5), style=line.style_solid , xloc= xloc, extend=ext)var line _0236 = line.new(na, na, na, na, color=color.new(color.orange, 25), style=line.style_solid , xloc= xloc, extend=ext)var line _0382 = line.new(na, na, na, na, color=color.new(color.yellow, 25), style=line.style_solid , xloc= xloc, extend=ext)var line _0500 = line.new(na, na, na, na, color=color.new(color.green , 25), style=line.style_solid , xloc= xloc, extend=ext)var line _0618 = line.new(na, na, na, na, color=color.new(color.yellow, 25), style=line.style_solid , xloc= xloc, extend=ext)var line _0786 = line.new(na, na, na, na, color=color.new(color.orange, 25), style=line.style_solid , xloc= xloc, extend=ext)var line _one_ = line.new(na, na, na, na, color=color.new(color.silver, 5), style=line.style_solid , xloc= xloc, extend=ext)var line _1618 = line.new(na, na, na, na, color=color.new(color.yellow, 25), style=line.style_solid , xloc= xloc, extend=ext)//-----------------------------------------------------------------------------}//Functions/methods//-----------------------------------------------------------------------------{method in_out(ZZ aZZ, int d, int x1, float y1, int x2, float y2, color col, bool b) =>aZZ.d.unshift(d), aZZ.x.unshift(x2), aZZ.y.unshift(y2), aZZ.b.unshift(b), aZZ.d.pop(), aZZ.x.pop(), aZZ.y.pop(), aZZ.b.pop()method timeinrange(string res, string sess) => not na(time(timeframe.period, res, sess))method setLine(line ln, int x1, float y1, int x2, float y2) => ln.set_xy1(x1, y1), ln.set_xy2(x2, y2)method clear_aLine(line[] l) =>if l.size() > 0for i = l.size() -1 to 0l.pop().delete()method clear_aLabLin(label[] l) =>if l.size() > 0for i = l.size() -1 to 0l.pop().delete()method clear_aLabLin(line[] l) =>if l.size() > 0for i = l.size() -1 to 0l.pop().delete()method notransp(color css) => color.rgb(color.r(css), color.g(css), color.b(css))method display(ob id, css, break_css, str)=>if showOBif id.breakera_bx_ln_lb.unshift(bx_ln_lb.new(box.new(id.loc, id.top, timenow + (tf_msec * 10), id.btm, na, bgcolor = break_css, extend = extend.none, xloc = xloc.bar_time), line (na), label(na)))elsey = str == 'bl' ? id.btm : id.tops = str == 'bl' ? label.style_label_up : label.style_label_downa_bx_ln_lb.unshift(bx_ln_lb.new(box(na), line.new(id.loc, y , id.loc + (tf_msec * 10), y, xloc = xloc.bar_time, color=css, width=2), label.new( id.loc + (tf_msec * 10), y, text = str == 'bl' ? '+OB' : '-OB', xloc = xloc.bar_time, style = s , color = color(na), textcolor=css, size = size.small)))swings(len)=>var os = 0var swing top = swing.new(na, na)var swing btm = swing.new(na, na)upper = ta.highest(len)lower = ta.lowest(len)os := high[len] > upper ? 0: low [len] < lower ? 1 : osif os == 0 and os[1] != 0top := swing.new(high[length], bar_index[length])if os == 1 and os[1] != 1btm := swing.new(low[length], bar_index[length])[top, btm]set_lab(i, str) =>style = str == 'Bl' ? label.style_label_down : label.style_label_uptxcol = str == 'Bl' ? color.lime : color.redlabel.new(math.round(math.avg(aZZ.x.get(i), n)), aZZ.y.get(i), text='BOS', style=style, color=color(na), textcolor=txcol, size=size.tiny)set_lin(i, str) =>color = str == 'Bl' ? color.lime : color.redline.new(aZZ.x.get(i), aZZ.y.get(i), n, aZZ.y.get(i), color=color, style=line.style_dotted)draw(left, col) =>//max_bars_back(time, 1000)var int dir= na, var int x1= na, var float y1= na, var int x2= na, var float y2= na//sz = aZZ.d.size( )x2 := bar_index -1ph = ta.pivothigh(hi, left, 1)pl = ta.pivotlow (lo, left, 1)if phdir := aZZ.d.get (0)x1 := aZZ.x.get (0)y1 := aZZ.y.get (0)y2 := nz(hi[1])//if dir < 1 // if previous point was a pl, add, and change direction ( 1)aZZ.in_out( 1, x1, y1, x2, y2, col, true)elseif dir == 1 and ph > y1aZZ.x.set(0, x2), aZZ.y.set(0, y2)//// liquidityif showLq and per and sz > 0count = 0st_P = 0.st_B = 0minP = 0.maxP = 10e6for i = 0 to math.min(sz, 50) -1if aZZ.d.get(i) == 1if aZZ.y.get(i) > ph + (atr/a)breakelseif aZZ.y.get(i) > ph - (atr/a) and aZZ.y.get(i) < ph + (atr/a)count += 1st_B := aZZ.x.get(i)st_P := aZZ.y.get(i)if aZZ.y.get(i) > minPminP := aZZ.y.get(i)if aZZ.y.get(i) < maxPmaxP := aZZ.y.get(i)if count > 2getB = b_liq_B.get(0)if st_B == getB.bx.get_left()getB.bx.set_top(math.avg(minP, maxP) + (atr/a))getB.bx.set_rightbottom(n +10, math.avg(minP, maxP) - (atr/a))elseb_liq_B.unshift(liq.new(box.new(st_B, math.avg(minP, maxP) + (atr/a), n +10, math.avg(minP, maxP) - (atr/a), text = 'Buyside liquidity', text_size = size.tiny, text_halign = text.align_left, text_valign = text.align_bottom, text_color = color.new(cLIQ_B, 25), bgcolor=color(na), border_color=color(na)), false, false, false, line.new(st_B, st_P, n -1, st_P, color = color.new(cLIQ_B, 0))))if b_liq_B.size() > visLiqgetLast = b_liq_B.pop()getLast.bx.delete()getLast.ln.delete()//if pldir := aZZ.d.get (0)x1 := aZZ.x.get (0)y1 := aZZ.y.get (0)y2 := nz(lo[1])//if dir > -1 // if previous point was a ph, add, and change direction (-1)aZZ.in_out(-1, x1, y1, x2, y2, col, true)elseif dir == -1 and pl < y1aZZ.x.set(0, x2), aZZ.y.set(0, y2)////Liquidityif showLq and per and sz > 0count = 0st_P = 0.st_B = 0minP = 0.maxP = 10e6for i = 0 to math.min(sz, 50) -1if aZZ.d.get(i) == -1if aZZ.y.get(i) < pl - (atr/a)breakelseif aZZ.y.get(i) > pl - (atr/a) and aZZ.y.get(i) < pl + (atr/a)count += 1st_B := aZZ.x.get(i)st_P := aZZ.y.get(i)if aZZ.y.get(i) > minPminP := aZZ.y.get(i)if aZZ.y.get(i) < maxPmaxP := aZZ.y.get(i)if count > 2getB = b_liq_S.get(0)if st_B == getB.bx.get_left()getB.bx.set_top(math.avg(minP, maxP) + (atr/a))getB.bx.set_rightbottom(n +10, math.avg(minP, maxP) - (atr/a))elseb_liq_S.unshift(liq.new(box.new(st_B, math.avg(minP, maxP) + (atr/a), n +10, math.avg(minP, maxP) - (atr/a), text = 'Sellside liquidity', text_size = size.tiny, text_halign = text.align_left, text_valign = text.align_bottom, text_color = color.new(cLIQ_S, 25), bgcolor=color(na), border_color=color(na)), false, false, false, line.new(st_B, st_P, n -1, st_P, color = color.new(cLIQ_S, 0))))if b_liq_S.size() > visLiqgetLast = b_liq_S.pop()getLast.bx.delete()getLast.ln.delete()////Market Structure Shiftif showMS//iH = aZZ.d.get(2) == 1 ? 2 : 1iL = aZZ.d.get(2) == -1 ? 2 : 1//switch// MSS Bullishclose > aZZ.y.get(iH) and aZZ.d.get(iH) == 1 and MSS.dir < 1 =>MSS.dir := 1if i_mode == 'Present'MSS.l_bosBl.clear_aLabLin(), MSS.l_bosBr.clear_aLabLin()MSS.lbBosBl.clear_aLabLin(), MSS.lbBosBr.clear_aLabLin()MSS.l_mssBl.clear_aLabLin(), MSS.l_mssBr.clear_aLabLin()MSS.lbMssBl.clear_aLabLin(), MSS.lbMssBr.clear_aLabLin()//MSS.l_mssBl.unshift(line.new (aZZ.x.get(iH), aZZ.y.get(iH), n, aZZ.y.get(iH), color=cMSSbl))MSS.lbMssBl.unshift(label.new(math.round(math.avg(aZZ.x.get(iH), n)), aZZ.y.get(iH), text ='MSS', style=label.style_label_down, size=size.tiny, color=color(na), textcolor=cMSSbl))// MSS Bearishclose < aZZ.y.get(iL) and aZZ.d.get(iL) == -1 and MSS.dir > -1 =>MSS.dir := -1if i_mode == 'Present'MSS.l_bosBl.clear_aLabLin(), MSS.l_bosBr.clear_aLabLin()MSS.lbBosBl.clear_aLabLin(), MSS.lbBosBr.clear_aLabLin()MSS.l_mssBl.clear_aLabLin(), MSS.l_mssBr.clear_aLabLin()MSS.lbMssBl.clear_aLabLin(), MSS.lbMssBr.clear_aLabLin()//MSS.l_mssBr.unshift(line.new (aZZ.x.get(iL), aZZ.y.get(iL), n, aZZ.y.get(iL), color=cMSSbr))MSS.lbMssBr.unshift(label.new(math.round(math.avg(aZZ.x.get(iL), n)), aZZ.y.get(iL), text ='MSS', style=label.style_label_up , size=size.tiny, color=color(na), textcolor=cMSSbr))// BOS BullishMSS.dir == 1 and close > aZZ.y.get(iH) and iBOS =>if MSS.l_bosBl.size() > 0if aZZ.y.get(iH) != MSS.l_bosBl.get(0).get_y2() andaZZ.y.get(iH) != MSS.l_mssBl.get(0).get_y2()MSS.l_bosBl.unshift(set_lin(iH, 'Bl')), MSS.lbBosBl.unshift(set_lab(iH, 'Bl'))elseif aZZ.y.get(iH) != MSS.l_mssBl.get(0).get_y2()MSS.l_bosBl.unshift(set_lin(iH, 'Bl')), MSS.lbBosBl.unshift(set_lab(iH, 'Bl'))// BOS BearishMSS.dir == -1 and close < aZZ.y.get(iL) and iBOS =>if MSS.l_bosBr.size() > 0if aZZ.y.get(iL) != MSS.l_bosBr.get(0).get_y2() andaZZ.y.get(iL) != MSS.l_mssBr.get(0).get_y2()MSS.l_bosBr.unshift(set_lin(iL, 'Br')), MSS.lbBosBr.unshift(set_lab(iL, 'Br'))elseif aZZ.y.get(iL) != MSS.l_mssBr.get(0).get_y2()MSS.l_bosBr.unshift(set_lin(iL, 'Br')), MSS.lbBosBr.unshift(set_lab(iL, 'Br'))if not iMSSMSS.l_mssBl.get(0).set_color(color(na)), MSS.lbMssBl.get(0).set_textcolor(color(na))MSS.l_mssBr.get(0).set_color(color(na)), MSS.lbMssBr.get(0).set_textcolor(color(na))//-----------------------------------------------------------------------------}//Calculations//-----------------------------------------------------------------------------{draw(len, color.yellow)if MSS.l_bosBl.size() > 200MSS.l_bosBl.pop().delete()MSS.lbBosBl.pop().delete()if MSS.l_bosBr.size() > 200MSS.l_bosBr.pop().delete()MSS.lbBosBr.pop().delete()//Killzonesny = time(timeframe.period, input.session('0700-0900', '', inline = 'ny', group = 'Killzones'), 'America/New_York') and showNyldn_open = time(timeframe.period, input.session('0700-1000', '', inline = 'lo', group = 'Killzones'), 'Europe/London' ) and showLdno // 0200-0500 UTC-5ldn_close = time(timeframe.period, input.session('1500-1700', '', inline = 'lc', group = 'Killzones'), 'Europe/London' ) and showLdnc // 1000-1200 UTC-5asian = time(timeframe.period, input.session('1000-1400', '', inline = 'as', group = 'Killzones'), 'Asia/Tokyo' ) and showAsia // 2000-0000 UTC-5//Pivotpointsph = ta.pivothigh(3, 1), lPh = fixnan(ph)pl = ta.pivotlow (3, 1), lPl = fixnan(pl)//CandlesL_body =high - mx < body * perc_Body andmn - low < body * perc_BodyL_bodyUP = body > meanBody and L_body and close > openL_bodyDN = body > meanBody and L_body and close < openbsNOTbodyUP = ta.barssince(not L_bodyUP)bsNOTbodyDN = ta.barssince(not L_bodyDN)bsIs_bodyUP = ta.barssince( L_bodyUP)bsIs_bodyDN = ta.barssince( L_bodyDN)lwst = math.min(lPh [bsNOTbodyUP[1]], low[bsNOTbodyUP[1]])hgst = math.max(high[bsNOTbodyDN[1]], lPl[bsNOTbodyDN[1]])//ImbalanceimbalanceUP = L_bodyUP[1] and (i_FVG == 'FVG' ? low > high[2] : low < high[2])imbalanceDN = L_bodyDN[1] and (i_FVG == 'FVG' ? high < low [2] : high > low [2])//Volume ImbalancevImb_Bl = open > close[1] and high[1] > low and close > close[1] and open > open[1] and high[1] < mnvImb_Br = open < close[1] and low [1] < high and close < close[1] and open < open[1] and low [1] > mxif sVimblif vImb_BlVimbal.unshift(_2ln_lb.new(line.new (n -1, mx[1], n +3, mx[1], color=cVimbl), line.new (n , mn , n +3, mn , color=cVimbl), label.new(n +3, math.avg (mx[1], mn), text='VI', color=color(na) , textcolor=cVimbl, style=label.style_label_left)))if vImb_BrVimbal.unshift(_2ln_lb.new(line.new (n -1, mn[1], n +3, mn[1], color=cVimbl), line.new (n , mx , n +3, mx , color=cVimbl), label.new(n +3, math.avg (mn[1], mx), text='VI', color=color(na) , textcolor=cVimbl, style=label.style_label_left)))if Vimbal.size() > visVimpop = Vimbal.pop()pop.l1.delete()pop.l2.delete()pop.lb.delete()//Fair Value Gapif barstate.isfirstfor i = 0 to visBxs -1bFVG_UP.unshift(FVG.new(box(na), false))bFVG_DN.unshift(FVG.new(box(na), false))if i_BPRbBPR_UP.unshift(FVG.new(box(na), false))bBPR_DN.unshift(FVG.new(box(na), false))if imbalanceUP and per and shwFVGif imbalanceUP[1]bFVG_UP.get(0).box.set_lefttop (n -2, low )bFVG_UP.get(0).box.set_rightbottom(n +8, high[2])elsebFVG_UP.unshift(FVG.new(box.new(n -2, i_FVG == 'FVG' ? low : high[2], n, i_FVG == 'FVG' ? high[2] : low, bgcolor = i_BPR ? color(na) : color.new(cFVGbl, 90), border_color= i_BPR ? color(na) : color.new(cFVGbl, 65), text_color = i_BPR ? color(na) : color.new(cFVGbl, 65), text_size=size.small, text=i_FVG), true))bFVG_UP.pop().box.delete()if imbalanceDN and per and shwFVGif imbalanceDN[1]bFVG_DN.get(0).box.set_lefttop (n -2, low[2])bFVG_DN.get(0).box.set_rightbottom(n +8, high )elsebFVG_DN.unshift(FVG.new(box.new(n -2, i_FVG == 'FVG' ? low[2] : high, n, i_FVG == 'FVG' ? high : low[2], bgcolor = i_BPR ? color(na) : color.new(cFVGbr, 90), border_color= i_BPR ? color(na) : color.new(cFVGbr, 65), text_color = i_BPR ? color(na) : color.new(cFVGbr, 65), text_size=size.small, text=i_FVG), true))bFVG_DN.pop().box.delete()//Balance Price Range (overlap of 2 latest FVG bull/bear)if i_BPR and bFVG_UP.size() > 0 and bFVG_DN.size() > 0bxUP = bFVG_UP.get(0)bxDN = bFVG_DN.get(0)bxUPbtm = bxUP.box.get_bottom()bxDNbtm = bxDN.box.get_bottom()bxUPtop = bxUP.box.get_top()bxDNtop = bxDN.box.get_top()left = math.min(bxUP.box.get_left (), bxDN.box.get_left ())right = math.max(bxUP.box.get_right(), bxDN.box.get_right())//if bxUPbtm < bxDNtop andbxDNbtm < bxUPbtmif left == bBPR_UP.get(0).box.get_left()if bBPR_UP.get(0).activebBPR_UP.get(0).box.set_right(right)elsebBPR_UP.unshift(FVG.new(box.new(left, bxDNtop, right, bxUPbtm, bgcolor = i_BPR ? color.new(cFVGbl, 90) : color(na), border_color= i_BPR ? color.new(cFVGbl, 65) : color(na), text_color = i_BPR ? color.new(cFVGbl, 65) : color(na), text_size=size.small, text= 'BPR'), true, close > bxUPbtm ? 1 : close < bxDNtop ? -1 : 0))bBPR_UP.pop().box.delete()//if bxDNbtm < bxUPtop andbxUPbtm < bxDNbtmif left == bBPR_DN.get(0).box.get_left()if bBPR_DN.get(0).activebBPR_DN.get(0).box.set_right(right)elsebBPR_DN.unshift(FVG.new(box.new(left, bxUPtop, right, bxDNbtm, bgcolor = i_BPR ? color.new(cFVGbr, 90) : color(na), border_color= i_BPR ? color.new(cFVGbr, 65) : color(na), text_color = i_BPR ? color.new(cFVGbr, 65) : color(na), text_size=size.small, text= 'BPR'), true, close > bxDNbtm ? 1 : close < bxUPtop ? -1 : 0))bBPR_DN.pop().box.delete()//FVG's breaksfor i = 0 to math.min(bxBack, bFVG_UP.size() -1)getUPi = bFVG_UP.get(i)if getUPi.activegetUPi.box.set_right(bar_index +8)if low < getUPi.box.get_top() and not i_BPRgetUPi.box.set_border_style(line.style_dashed)if low < getUPi.box.get_bottom()if not i_BPRgetUPi.box.set_bgcolor(color.new(cFVGblBR, 95))getUPi.box.set_border_style(line.style_dotted)getUPi.box.set_right(bar_index)getUPi.active := falsefor i = 0 to math.min(bxBack, bFVG_DN.size() -1)getDNi = bFVG_DN.get(i)if getDNi.activegetDNi.box.set_right(bar_index +8)if high > getDNi.box.get_bottom() and not i_BPRgetDNi.box.set_border_style(line.style_dashed)if high > getDNi.box.get_top()if not i_BPRgetDNi.box.set_bgcolor(color.new(cFVGbrBR, 95))getDNi.box.set_border_style(line.style_dotted)getDNi.box.set_right(bar_index)getDNi.active := falseif i_BPRfor i = 0 to math.min(bxBack, bBPR_UP.size() -1)getUPi = bBPR_UP.get(i)if getUPi.activegetUPi.box.set_right(bar_index +8)switch getUPi.pos-1 =>if high > getUPi.box.get_bottom()getUPi.box.set_border_style(line.style_dashed)if high > getUPi.box.get_top ()getUPi.box.set_bgcolor(color.new(cFVGblBR, 95))getUPi.box.set_border_style(line.style_dotted)getUPi.box.set_right(bar_index)getUPi.active := false1 =>if low < getUPi.box.get_top ()getUPi.box.set_border_style(line.style_dashed)if low < getUPi.box.get_bottom()getUPi.box.set_bgcolor(color.new(cFVGblBR, 95))getUPi.box.set_border_style(line.style_dotted)getUPi.box.set_right(bar_index)getUPi.active := falsefor i = 0 to math.min(bxBack, bBPR_DN.size() -1)getDNi = bBPR_DN.get(i)if getDNi.activegetDNi.box.set_right(bar_index +8)switch getDNi.pos-1 =>if high > getDNi.box.get_bottom()getDNi.box.set_border_style(line.style_dashed)if high > getDNi.box.get_top ()getDNi.box.set_bgcolor(color.new(cFVGbrBR, 95))getDNi.box.set_border_style(line.style_dotted)getDNi.box.set_right(bar_index)getDNi.active := false1 =>if low < getDNi.box.get_top ()getDNi.box.set_border_style(line.style_dashed)if low < getDNi.box.get_bottom()getDNi.box.set_bgcolor(color.new(cFVGbrBR, 95))getDNi.box.set_border_style(line.style_dotted)getDNi.box.set_right(bar_index)getDNi.active := false//NWOG/NDOGif barstate.isfirstfor i = 0 to maxNWOG -1bl_NWOG.unshift(bx_ln.new(box(na), line(na)))for i = 0 to maxNDOG -1bl_NDOG.unshift(bx_ln.new(box(na), line(na)))if dayofweek == dayofweek.fridayfriCp := close, friCi := nif ta.change(dayofweek)if dayofweek == dayofweek.monday and iNWOGmonOp := open , monOi := nbl_NWOG.unshift(bx_ln.new(box.new(friCi , math.max (friCp , monOp ), monOi , math.min (friCp , monOp ), bgcolor = color ( na ), border_color = cNWOG2, extend = extend.right ),line.new(monOi , math.avg (friCp , monOp ), monOi +1 , math.avg (friCp , monOp ), color = cNWOG1, style = line.style_dotted, extend = extend.right )))bl = bl_NWOG.pop(), bl.b.delete(), bl.l.delete()if iNDOGcuDOp := open , cuDOi := nprDCp := close[1], prDCi := n -1//bl_NDOG.unshift(bx_ln.new(box.new(prDCi , math.max (prDCp , cuDOp ), cuDOi , math.min (prDCp , cuDOp ), bgcolor = color ( na ), border_color = cNDOG2, extend = extend.right ),line.new(cuDOi , math.avg (prDCp , cuDOp ), cuDOi +1 , math.avg (prDCp , cuDOp ), color = cNDOG1, style = line.style_dotted, extend = extend.right )))bl = bl_NDOG.pop(), bl.b.delete(), bl.l.delete()//Liquidityfor i = 0 to b_liq_B.size() -1x = b_liq_B.get(i)if not x.brokenx.bx.set_right(n +3)x.ln.set_x2 (n +3)if not x.brokenTopif close > x.bx.get_top ()x.brokenTop := trueif not x.brokenBtmif close > x.bx.get_bottom()x.brokenBtm := trueif x.brokenBtmx.bx.set_bgcolor(color.new(cLIQ_B, 90))x.ln.delete()if x.brokenTopx.broken := truex.bx.set_right(n)for i = 0 to b_liq_S.size() -1x = b_liq_S.get(i)if not x.brokenx.bx.set_right(n +3)x.ln.set_x2 (n +3)if not x.brokenTopif close < x.bx.get_top ()x.brokenTop := trueif not x.brokenBtmif close < x.bx.get_bottom()x.brokenBtm := trueif x.brokenTopx.bx.set_bgcolor(color.new(cLIQ_S, 90))x.ln.delete()if x.brokenBtmx.broken := truex.bx.set_right(n)//Order Blocks[top, btm] = swings(length)if showOB and perif close > top.y and not top.crossedtop.crossed := trueminima = max[1]maxima = min[1]loc = time[1]for i = 1 to (n - top.x)-1minima := math.min(min[i], minima)maxima := minima == min[i] ? max[i] : maximaloc := minima == min[i] ? time[i] : locbullish_ob.unshift(ob.new(maxima, minima, loc))if bullish_ob.size() > 0for i = bullish_ob.size()-1 to 0element = bullish_ob.get(i)if not element.breakerif math.min(close, open) < element.btmelement.breaker := trueelement.break_loc := timeelseif close > element.topbullish_ob.remove(i)else if i < showBull and top.y < element.top and top.y > element.btmblBrkConf := 1//Set labelif blBrkConf > blBrkConf[1] and showLabelslabel.new(top.x, top.y, '▼', color = na, textcolor = bearCss.notransp(), style = label.style_label_down, size = size.tiny)if showOB and perif close < btm.y and not btm.crossedbtm.crossed := trueminima = min[1]maxima = max[1]loc = time[1]for i = 1 to (n - btm.x)-1maxima := math.max(max[i], maxima)minima := maxima == max[i] ? min[i] : minimaloc := maxima == max[i] ? time[i] : locbearish_ob.unshift(ob.new(maxima, minima, loc))if bearish_ob.size() > 0for i = bearish_ob.size()-1 to 0element = bearish_ob.get(i)if not element.breakerif math.max(close, open) > element.topelement.breaker := trueelement.break_loc := timeelseif close < element.btmbearish_ob.remove(i)else if i < showBear and btm.y > element.btm and btm.y < element.topbrBrkConf := 1//Set labelif brBrkConf > brBrkConf[1] and showLabelslabel.new(btm.x, btm.y, '▲', color = na, textcolor = bullCss.notransp(), style = label.style_label_up, size = size.tiny)//-----------------------------------------------------------------------------}//Set Order Blocks//-----------------------------------------------------------------------------{if barstate.islast and showOBif a_bx_ln_lb.size() > 0for i = a_bx_ln_lb.size() -1 to 0item = a_bx_ln_lb.remove(i)item.bx.delete()item.ln.delete()item.lb.delete()//Bullishif showBull > 0blSz = bullish_ob.size()if blSz > 0for i = 0 to math.min(showBull, bullish_ob.size()) -1get_ob = bullish_ob.get(i)get_ob.display(bullCss, bullBrkCss, 'bl')//Bearishif showBear > 0brSz = bearish_ob.size()if brSz > 0for i = 0 to math.min(showBear, bearish_ob.size()) -1get_ob = bearish_ob.get(i)get_ob.display(bearCss, bearBrkCss, 'br')//-----------------------------------------------------------------------------}//Fibonacci//-----------------------------------------------------------------------------{if barstate.islastx1 = 0, y1 = 0., x2 = 0, y2 = 0., box up = na, box dn = naswitch iFib'FVG' =>if bFVG_UP.size() > 0 and bFVG_DN.size() > 0up := bFVG_UP.get(0).boxdn := bFVG_DN.get(0).boxdnFirst = up.get_left() > dn.get_left()dnBottm = up.get_top () > dn.get_top ()x1 := dnFirst ? dn.get_left () : up.get_left ()x2 := dnFirst ? up.get_right () : dn.get_right ()y1 := dnFirst ?dnBottm ? dn.get_bottom() : dn.get_top () :dnBottm ? up.get_top () : up.get_bottom()y2 := dnFirst ?dnBottm ? up.get_top () : up.get_bottom() :dnBottm ? dn.get_bottom() : dn.get_top ()'BPR' =>if bBPR_UP.size() > 0 and bBPR_DN.size() > 0up := bBPR_UP.get(0).boxdn := bBPR_DN.get(0).boxdnFirst = up.get_left() > dn.get_left()dnBottm = up.get_top () > dn.get_top ()x1 := dnFirst ? dn.get_left () : up.get_left ()x2 := dnFirst ? up.get_right () : dn.get_right ()y1 := dnFirst ?dnBottm ? dn.get_bottom() : dn.get_top () :dnBottm ? up.get_top () : up.get_bottom()y2 := dnFirst ?dnBottm ? up.get_top () : up.get_bottom() :dnBottm ? dn.get_bottom() : dn.get_top ()'OB' =>oSz = a_bx_ln_lb.size()if oSz > 1xA = nz(a_bx_ln_lb.get(oSz -1).ln.get_x1 (), a_bx_ln_lb.get(oSz -1).bx.get_left ())xB = nz(a_bx_ln_lb.get(oSz -2).ln.get_x1 (), a_bx_ln_lb.get(oSz -2).bx.get_left ())AFirst = xB > xA//yAT = nz(a_bx_ln_lb.get(oSz -1).ln.get_y1 (), a_bx_ln_lb.get(oSz -1).bx.get_top ())yAB = nz(a_bx_ln_lb.get(oSz -1).ln.get_y1 (), a_bx_ln_lb.get(oSz -1).bx.get_bottom())yBT = nz(a_bx_ln_lb.get(oSz -2).ln.get_y1 (), a_bx_ln_lb.get(oSz -2).bx.get_top ())yBB = nz(a_bx_ln_lb.get(oSz -2).ln.get_y1 (), a_bx_ln_lb.get(oSz -2).bx.get_bottom())ABottom = yAB < yBB//x1 := AFirst ? xA : xBx2 := AFirst ? xB : xAy1 := AFirst ?ABottom ? yAB : yAT :ABottom ? yBT : yBBy2 := AFirst ?ABottom ? yBT : yBB :ABottom ? yAB : yAT'Liq' =>if b_liq_B.size() > 0 and b_liq_S.size() > 0xA = nz(b_liq_B.get(0).ln.get_x1 (), b_liq_B.get(0).bx.get_left ())xB = nz(b_liq_S.get(0).ln.get_x1 (), b_liq_S.get(0).bx.get_left ())AFirst = xB > xA//yAT = nz(b_liq_B.get(0).ln.get_y1 (), b_liq_B.get(0).bx.get_top ())yAB = nz(b_liq_B.get(0).ln.get_y1 (), b_liq_B.get(0).bx.get_bottom())yBT = nz(b_liq_S.get(0).ln.get_y1 (), b_liq_S.get(0).bx.get_top ())yBB = nz(b_liq_S.get(0).ln.get_y1 (), b_liq_S.get(0).bx.get_bottom())ABottom = yAB < yBB//x1 := AFirst ? xA : xBx2 := AFirst ? xB : xAy1 := AFirst ?ABottom ? yAB : yAT :ABottom ? yBT : yBBy2 := AFirst ?ABottom ? yBT : yBB :ABottom ? yAB : yAT'VI' =>if Vimbal.size() > 1AxA = Vimbal.get(1).l2.get_x1(), AxB = Vimbal.get(1).l1.get_x1()BxA = Vimbal.get(0).l2.get_x1(), BxB = Vimbal.get(0).l1.get_x1()AyA = Vimbal.get(1).l2.get_y1(), AyB = Vimbal.get(1).l1.get_y1()ByA = Vimbal.get(0).l2.get_y1(), ByB = Vimbal.get(0).l1.get_y1()ABt = math.min(ByA, ByB) > math.min(AyA, AyB)x1 := math.max(AxA, AxB)x2 := math.max(BxA, BxB)y1 := ABt ? math.min(AyA, AyB) : math.max(AyA, AyB)y2 := ABt ? math.max(ByA, ByB) : math.min(ByA, ByB)'NWOG' =>if bl_NWOG.size() > 1up := bl_NWOG.get(0).bdn := bl_NWOG.get(1).bdnFirst = up.get_left() > dn.get_left()dnBottm = up.get_top () > dn.get_top ()x1 := dnFirst ? dn.get_left () : up.get_left ()x2 := dnFirst ? up.get_right() : dn.get_right()y1 := dnFirst ?dnBottm ? dn.get_bottom() : dn.get_top () :dnBottm ? up.get_top () : up.get_bottom()y2 := dnFirst ?dnBottm ? up.get_top () : up.get_bottom() :dnBottm ? dn.get_bottom() : dn.get_top ()//if iFib != 'NONE'rt = math.max(x1, x2)lt = math.min(x1, x2)tp = math.max(y1, y2)bt = math.min(y1, y2)_0 = rt == x1 ? y1 : y2_1 = rt == x1 ? y2 : y1//df = _1 - _0m0236 = df * 0.236m0382 = df * 0.382m0500 = df * 0.500m0618 = df * 0.618m0786 = df * 0.786m1618 = df * 1.618//_diag.setLine(x1, y1 , x2 , y2 )_vert.setLine(rt, _0 , rt , _0 + m1618)_zero.setLine(rt, _0 , rt + plus, _0 )_0236.setLine(rt, _0 + m0236, rt + plus, _0 + m0236)_0382.setLine(rt, _0 + m0382, rt + plus, _0 + m0382)_0500.setLine(rt, _0 + m0500, rt + plus, _0 + m0500)_0618.setLine(rt, _0 + m0618, rt + plus, _0 + m0618)_0786.setLine(rt, _0 + m0786, rt + plus, _0 + m0786)_one_.setLine(rt, _1 , rt + plus, _1 )_1618.setLine(rt, _0 + m1618, rt + plus, _0 + m1618)//-----------------------------------------------------------------------------}//Displacement//-----------------------------------------------------------------------------{plotshape(sDispl ? per ?L_bodyUP ? low : na : na : na, title = 'Displacement UP', style = shape.labelup, color = color.lime, location = location.belowbar)plotshape(sDispl ? per ?L_bodyDN ? high : na : na : na, title = 'Displacement DN', style = shape.labeldown, color = color.red, location = location.abovebar)//-----------------------------------------------------------------------------}//background - Killzones//-----------------------------------------------------------------------------{bgcolor (per ? ny ? nyCss : na : na, editable = false)bgcolor (per ? ldn_open ? ldnoCss : na : na, editable = false)bgcolor (per ? ldn_close ? ldncCss : na : na, editable = false)bgcolor (per ? asian ? asiaCss : na : na, editable = false)//-----------------------------------------------------------------------------}01/04/2024 at 9:07 PM #225971bonjour
avez vous trouver une solution pour cette indicateur ?
steve
-
AuthorPosts
Viewing 2 posts - 1 through 2 (of 2 total)
Find exclusive trading pro-tools on
Similar topics: