Traduction Breaker Block de LuxAlgo
Forums › ProRealTime forum Français › Support ProBuilder › Traduction Breaker Block de LuxAlgo
- This topic has 0 replies, 1 voice, and was last updated 2 days ago by Alai-n.
Viewing 1 post (of 1 total)
-
-
01/15/2025 at 12:00 PM #242615
Bonjour, dans la continuation du développement du concept ICT-SMC. Ce serait vraiment bien de traduire ce code et de le rajouter à la bibliothèque!
Bonne journée
Breaker Block by LuxAlgo123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787// This work is licensed under a Attribution-NonCommercial-ShareAlike 4.0 International (CC Dy-NC-SA 4.0) https://creativecommons.org/licenses/Dy-nc-sa/4.0/// © LuxAlgo//@version=5indicator("Breaker Blocks with Signals [LuxAlgo]", max_lines_count=500, max_boxes_count=500, max_labels_count=500, max_bars_back=3000, overlay=true)//------------------------------------------------------------------------------//Settings//-----------------------------------------------------------------------------{shZZ = falselen = input.int ( 5 , title=' Length' , inline='MS' , group='Market Structure', minval=1, maxval=10 )//Breaker blockbreakerCandleOnlyBody = input.bool ( false , title='Use only candle body' , group='Breaker Block' )breakerCandle_2Last = input.bool ( false , title='Use 2 candles instead of 1' , group='Breaker Block', tooltip='In the same direction')tillFirstBreak = input.bool ( true , title='Stop at first break of center line' , group='Breaker Block' )//PD arrayonlyWhenInPDarray = input.bool ( false , title='Only when E is in Premium/Discount Array', group='PD array' )showPDarray = input.bool ( false , title='show Premium/Discount Zone' , group='PD array' )showBreaks = input.bool ( false , title='Highlight Swing Breaks' , group='PD array' )showSPD = input.bool ( true , title='Show Swings/PD Arrays' , group='PD array' )PDtxtCss = input.color ( color.silver, 'Text Color' , group='PD array' )PDSCss = input.color ( color.silver, 'Swing Line Color', group='PD array' )//Take profitiTP = input.bool ( false , title='Enable TP' , inline='RR' , group='TP' )tpCss = input.color ( #2157f3, title='' , inline='RR', group='TP' )R1a = input.float ( 1 , title='R:R 1', minval= 1, maxval=1, inline='RR1', group='TP' )R2a = input.float ( 2 , title= ':' , minval=.2, step= .1, inline='RR1', group='TP' )R1b = input.float ( 1 , title='R:R 2', minval= 1, maxval=1, inline='RR2', group='TP' )R2b = input.float ( 3 , title= ':' , minval=.2, step= .1, inline='RR2', group='TP' )R1c = input.float ( 1 , title='R:R 3', minval= 1, maxval=1, inline='RR3', group='TP' )R2c = input.float ( 4 , title= ':' , minval=.2, step= .1, inline='RR3', group='TP' )//ColorscBBplusA = input.color (color.rgb(12, 181, 26, 93), title=' ' , inline='bl' , group='Colours +BB Last Swings' )cBBplusB = input.color (color.rgb(12, 181, 26, 85), title='' , inline='bl' , group='Colours +BB Last Swings' )cSwingBl = input.color (color.rgb(255, 82, 82, 85), title=' ' , inline='bl' , group='Colours +BB Last Swings' )cBB_minA = input.color (color.rgb(255, 17, 0, 95), title=' ' , inline='br' , group='Colours -BB Last Swings' )cBB_minB = input.color (color.rgb(255, 17, 0, 85), title='' , inline='br' , group='Colours -BB Last Swings' )cSwingBr = input.color (color.rgb(0, 137, 123, 85), title=' ' , inline='br' , group='Colours -BB Last Swings' )_arrowup = '▲'_arrowdn = '▼'_c = '●'_x = '❌'//-----------------------------------------------------------------------------}//General Calculations//-----------------------------------------------------------------------------{per = last_bar_index - bar_index <= 2000mx = math.max(close , open )mn = math.min(close , open )atr = ta.atr (10 )n = bar_indexhi = highlo = lowmCxSize = 50//-----------------------------------------------------------------------------}//User Defined Types//-----------------------------------------------------------------------------{type ZZint [] dint [] xfloat [] yline [] lbool [] btype mssint dirline [] l_mssBlline [] l_mssBrline [] l_bosBlline [] l_bosBrlabel[] lbMssBllabel[] lbMssBrlabel[] lbBosBllabel[] lbBosBrtype blockint dirbool Brokenbool Mitigatedbox BB_boxAbox BB_boxBline BB_linebox FVG_boxline line_1line line_2bool Broken_1bool Broken_2box PDa_boxAbox PDa_boxBbox PDa_box1line PDaLine1label PDaLab_1box PDa_box2line PDaLine2label PDaLab_2bool PDbroken1bool PDbroken2line TP1_lineline TP2_lineline TP3_linebool TP1_hitbool TP2_hitbool TP3_hitbool scalplabel HLlabel[] aLabels//-----------------------------------------------------------------------------}//Variables//-----------------------------------------------------------------------------{BBplus = 0, signUP = 1, cnclUP = 2, LL1break = 3, LL2break = 4, SW1breakUP = 5, SW2breakUP = 6, tpUP1 = 7, tpUP2 = 8, tpUP3 = 9, BB_endBl =10BB_min =11, signDN =12, cnclDN =13, HH1break =14, HH2break =15, SW1breakDN =16, SW2breakDN =17, tpDN1 =18, tpDN2 =19, tpDN3 =20, BB_endBr =21signals =array.from(false // BBplus, false // signUP, false // cnclUP, false // LL1break, false // LL2break, false // SW1breakUP, false // SW2breakUP, false // tpUP1, false // tpUP2, false // tpUP3, false // BB_endBl, false // BB_min, false // signDN, false // cnclDN, false // HH1break, false // HH2break, false // SW1breakDN, false // SW2breakDN, false // tpDN1, false // tpDN2, false // tpDN3, false // BB_endBr)var block [] aBlockBl = array.new< block >( )var block [] aBlockBr = array.new< block >( )var ZZ aZZ =ZZ.new(array.new < int >(mCxSize, 0),array.new < int >(mCxSize, 0),array.new < float >(mCxSize, na),array.new < line >(mCxSize, na),array.new < bool >(mCxSize, na))var 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 >())var block BB = block.new(BB_boxA = box.new (na, na, na, na, border_color=color(na)), BB_boxB = box.new (na, na, na, na, border_color=color(na), text_size=size.small, text_halign=text.align_right, text_font_family=font.family_monospace), BB_line = line.new (na, na, na, na, style=line.style_dashed, color=color.silver), PDa_box1 = box.new (na, na, na, na, border_color=color(na)), PDaLine1 = line.new (na, na, na, na, color=PDSCss), PDaLab_1 = label.new(na, na, color=color(na)), PDa_box2 = box.new (na, na, na, na, border_color=color(na)), PDaLine2 = line.new (na, na, na, na, color=PDSCss), PDaLab_2 = label.new(na, na, color=color(na)), line_1 = line.new (na, na, na, na, color=PDSCss), line_2 = line.new (na, na, na, na, color=PDSCss), TP1_line = line.new (na, na, na, na, color=tpCss), TP2_line = line.new (na, na, na, na, color=tpCss), TP3_line = line.new (na, na, na, na, color=tpCss), HL = label.new(na, na, color=color(na), textcolor=PDtxtCss, yloc=yloc.price), aLabels = array.new<label>(1, label(na)))//-----------------------------------------------------------------------------}//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()if shZZaZZ.l.unshift(line.new(x1, y1, x2, y2, color= col)), aZZ.l.pop().delete()method io_box(box[] aB, box b) => aB.unshift(b), aB.pop().delete()method setLine(line ln, int x1, float y1, int x2, float y2) => ln.set_xy1(x1, y1), ln.set_xy2(x2, y2)method notransp(color css) => color.rgb(color.r(css), color.g(css), color.b(css))createLab(string s, float y, color c, string t, string sz = size.small) =>label.new(n, y, style=s == 'c' ? label.style_label_center: s == 'u' ? label.style_label_up: label.style_label_down, textcolor=c, color=color(na), size=sz, text=t)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= nasz = 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)if shZZaZZ.l.get(0).set_xy2(x2, y2)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)if shZZaZZ.l.get(0).set_xy2(x2, y2)iH = aZZ.d.get(2) == 1 ? 2 : 1iL = aZZ.d.get(2) == -1 ? 2 : 1switch// MSS Bullishclose > aZZ.y.get(iH) and aZZ.d.get(iH) == 1 and MSS.dir < 1 and per =>Ex = aZZ.x.get(iH -1), Ey = aZZ.y.get(iH -1)Dx = aZZ.x.get(iH ), Dy = aZZ.y.get(iH ), DyMx = mx[n - Dx]Cx = aZZ.x.get(iH +1), Cy = aZZ.y.get(iH +1)Bx = aZZ.x.get(iH +2), By = aZZ.y.get(iH +2), ByMx = mx[n - Bx]Ax = aZZ.x.get(iH +3), Ay = aZZ.y.get(iH +3), AyMn = mn[n - Ax]_y = math.max(ByMx, DyMx)mid = AyMn + ((_y - AyMn) / 2) // 50% fib A- min(B, D)isOK = onlyWhenInPDarray ? Ay < Cy and Ay < Ey and Ey < mid : truefloat green1prT = nafloat green1prB = nafloat avg = naif Ey < Cy and Cx != Dx and isOK// latest HH to 1 HH further -> search first green barfor i = n - Dx to n - Cxif close[i] > open[i]// reset previous swing box'sBB.PDa_box1.set_lefttop(na, na), BB.PDaLine1.set_xy1(na, na), BB.PDaLab_1.set_xy(na, na)BB.PDa_box2.set_lefttop(na, na), BB.PDaLine2.set_xy1(na, na), BB.PDaLab_2.set_xy(na, na)green1idx = n - igreen1prT := breakerCandleOnlyBody ? mx[i] : high[i]green1prB := breakerCandleOnlyBody ? mn[i] : low [i]if breakerCandle_2Lastif close[i +1] > open[i +1]green2prT = breakerCandleOnlyBody ? mx[i +1] : high[i +1]green2prB = breakerCandleOnlyBody ? mn[i +1] : low [i +1]if green2prT > green1prT or green2prB < green1prBgreen1idx -= 1green1prT := math.max(green1prT, green2prT)green1prB := math.min(green1prB, green2prB)// Breaker Block +avg := math.avg(green1prB, green1prT)while BB.aLabels.size() > 0BB.aLabels.pop().delete()BB.PDa_boxA.delete(), BB.PDa_boxB.delete(), BB.dir := 1BB.BB_boxA.set_left (green1idx)BB.BB_boxA.set_top (green1prT)BB.BB_boxA.set_right ( n )BB.BB_boxA.set_bottom (green1prB)BB.BB_boxA.set_bgcolor(cBBplusA )BB.BB_boxB.set_left ( n )BB.BB_boxB.set_top (green1prT)BB.BB_boxB.set_right ( n + 8)BB.BB_boxB.set_bottom (green1prB)BB.BB_boxB.set_bgcolor(cBBplusB )BB.BB_boxB.set_text('+BB')BB.BB_boxB.set_text_color(cBBplusB.notransp())BB.BB_boxB.set_text_valign(text.align_bottom)BB.BB_line.set_xy1(n, avg), BB.BB_line.set_xy2(n , avg)if showSPDBB.line_1.set_xy1(Cx, Cy), BB.line_1.set_xy2(n , Cy), BB.Broken_1 := falseBB.line_2.set_xy1(Ex, Ey), BB.line_2.set_xy2(n , Ey), BB.Broken_2 := falseBB.HL.set_xy(Ex, Ey), BB.HL.set_style(label.style_label_up), BB.HL.set_text('LL')BB.TP1_hit := falseBB.TP2_hit := falseBB.TP3_hit := falseBB.Broken := falseBB.Mitigated := falseBB.scalp := falseBB.PDbroken1 := falseBB.PDbroken2 := falseif onlyWhenInPDarray and showPDarrayBB.PDa_boxA := box.new(Ax, mid, Ex +1, AyMn, bgcolor=color.rgb(132, 248, 171, 90), border_color=color(na), text = 'Discount PD Array', text_size = size.small, text_color = color.rgb(132, 248, 171, 25), text_halign = text.align_right, text_valign = text.align_center, text_font_family = font.family_monospace) // , text_wrap= text.wrap_autoBB.PDa_boxB := box.new(Ax, _y, Ex +1, mid, bgcolor=color.rgb(248, 153, 132, 90), border_color=color(na))// Previous swingscnt = 0, hh1 = highfor c = 0 to sz -2getX = aZZ.x.get(c)getY = aZZ.y.get(c)if getY > hh1 and aZZ.d.get(c) == 1 and showSPDgetY2 = (high[n - getX] - mn[n - getX]) / 4switch cnt0 =>BB.PDa_box1.set_lefttop (getX, getY )BB.PDaLine1.set_xy1 (getX, getY )BB.PDa_box1.set_rightbottom(n , getY - getY2)BB.PDaLine1.set_xy2 (n , getY )BB.PDa_box1.set_bgcolor ( cSwingBl )BB.PDaLab_1.set_xy ( getX, getY )BB.PDaLab_1.set_size ( size.small )BB.PDaLab_1.set_textcolor ( PDtxtCss )BB.PDaLab_1.set_text ('Premium PD Array')BB.PDaLab_1.set_style(label.style_label_lower_left)cnt := 1hh1 := getY1 =>if getY - getY2 > hh1BB.PDa_box2.set_lefttop (getX, getY )BB.PDaLine2.set_xy1 (getX, getY )BB.PDa_box2.set_rightbottom(n , getY - getY2)BB.PDaLine2.set_xy2 (n , getY )BB.PDa_box2.set_bgcolor ( cSwingBl )BB.PDaLab_2.set_xy ( getX, getY )BB.PDaLab_2.set_size ( size.small )BB.PDaLab_2.set_textcolor ( PDtxtCss )BB.PDaLab_2.set_text ('Premium PD Array')BB.PDaLab_2.set_style(label.style_label_lower_left)cnt := 2if cnt == 2breakI = green1prT - green1prBE1 = green1prT + (I * R2a / R1a)E2 = green1prT + (I * R2b / R1b)E3 = green1prT + (I * R2c / R1c)if iTPif not BB.TP1_hitBB.TP1_line.set_xy1(n, E1)BB.TP1_line.set_xy2(n + 20, E1)if not BB.TP2_hitBB.TP2_line.set_xy1(n, E2)BB.TP2_line.set_xy2(n + 20, E2)if not BB.TP3_hitBB.TP3_line.set_xy1(n, E3)BB.TP3_line.set_xy2(n + 20, E3)signals.set(BBplus, true)alert('+BB', alert.freq_once_per_bar_close)BB.aLabels.unshift(createLab('u', low, cBBplusB.notransp(), _arrowup, size.large))breakMSS.dir := 1// MSS Bearishclose < aZZ.y.get(iL) and aZZ.d.get(iL) == -1 and MSS.dir > -1 and per =>Ex = aZZ.x.get(iL -1), Ey = aZZ.y.get(iL -1)Dx = aZZ.x.get(iL ), Dy = aZZ.y.get(iL ), DyMn = mn[n - Dx]Cx = aZZ.x.get(iL +1), Cy = aZZ.y.get(iL +1)Bx = aZZ.x.get(iL +2), By = aZZ.y.get(iL +2), ByMn = mn[n - Bx]Ax = aZZ.x.get(iL +3), Ay = aZZ.y.get(iL +3), AyMx = mx[n - Ax]_y = math.min(ByMn, DyMn)//_x = _y == ByMn ? Bx : Dxmid = AyMx - ((AyMx - _y) / 2) // 50% fib A- min(B, D)isOK = onlyWhenInPDarray ? Ay > Cy and Ay > Ey and Ey > mid : true//float red_1_prT = nafloat red_1_prB = nafloat avg = naif Ey > Cy and Cx != Dx and isOK// latest LL to LL further -> search first red barfor i = n - Dx to n - Cxif close[i] < open[i]// reset previous swing box'sBB.PDa_box1.set_lefttop(na, na), BB.PDaLine1.set_xy1(na, na), BB.PDaLab_1.set_xy(na, na)BB.PDa_box2.set_lefttop(na, na), BB.PDaLine2.set_xy1(na, na), BB.PDaLab_2.set_xy(na, na)red_1_idx = n - ired_1_prT := breakerCandleOnlyBody ? mx[i] : high[i]red_1_prB := breakerCandleOnlyBody ? mn[i] : low [i]if breakerCandle_2Lastif close[i +1] < open[i +1]red_2_prT = breakerCandleOnlyBody ? mx[i +1] : high[i +1]red_2_prB = breakerCandleOnlyBody ? mn[i +1] : low [i +1]if red_2_prT > red_1_prT or red_2_prB < red_1_prBred_1_idx -= 1red_1_prT := math.max(red_1_prT, red_2_prT)red_1_prB := math.min(red_1_prB, red_2_prB)// Breaker Block -avg := math.avg(red_1_prB, red_1_prT)while BB.aLabels.size() > 0BB.aLabels.pop().delete()BB.PDa_boxA.delete(), BB.PDa_boxB.delete(), BB.dir := -1BB.BB_boxA.set_left (red_1_idx)BB.BB_boxA.set_top (red_1_prT)BB.BB_boxA.set_right ( n )BB.BB_boxA.set_bottom (red_1_prB)BB.BB_boxA.set_bgcolor(cBB_minA )BB.BB_boxB.set_left (n)BB.BB_boxB.set_top (red_1_prT)BB.BB_boxB.set_right ( n + 8)BB.BB_boxB.set_bottom (red_1_prB)BB.BB_boxB.set_bgcolor(cBB_minB )BB.BB_boxB.set_text('-BB')BB.BB_boxB.set_text_color(cBB_minB.notransp())BB.BB_boxB.set_text_valign(text.align_top)BB.BB_line.set_xy1(n, avg), BB.BB_line.set_xy2(n , avg)if showSPDBB.line_1.set_xy1(Cx, Cy), BB.line_1.set_xy2(n , Cy), BB.Broken_1 := falseBB.line_2.set_xy1(Ex, Ey), BB.line_2.set_xy2(n , Ey), BB.Broken_2 := falseBB.HL.set_xy(Ex, Ey), BB.HL.set_style(label.style_label_down), BB.HL.set_text('HH'), BB.HL.set_textcolor(PDtxtCss)BB.TP1_hit := falseBB.TP2_hit := falseBB.TP3_hit := falseBB.Broken := falseBB.Mitigated := falseBB.scalp := falseBB.PDbroken1 := falseBB.PDbroken2 := falseif onlyWhenInPDarray and showPDarrayBB.PDa_boxA := box.new(Ax, AyMx, Ex +1, mid, bgcolor=color.rgb(248, 153, 132, 90), border_color=color(na), text = 'Premium PD Array', text_size = size.small, text_color = color.rgb(248, 153, 132, 25), text_halign = text.align_right, text_valign = text.align_center, text_font_family = font.family_monospace) // , text_wrap= text.wrap_autoBB.PDa_boxB := box.new(Ax, mid , Ex +1, _y, bgcolor=color.rgb(132, 248, 171, 90), border_color=color(na))// Previous swingscnt = 0, ll1 = lowfor c = 0 to sz -2getX = aZZ.x.get(c)getY = aZZ.y.get(c)if getY < ll1 and aZZ.d.get(c) == -1 and showSPDgetY2 = (mx[n - getX] - low[n - getX]) / 4switch cnt0 =>BB.PDa_box1.set_lefttop (getX, getY + getY2)BB.PDaLine1.set_xy1 (getX, getY )BB.PDa_box1.set_rightbottom( n , getY )BB.PDaLine1.set_xy2 ( n , getY )BB.PDa_box1.set_bgcolor ( cSwingBr )BB.PDaLab_1.set_xy ( getX, getY )BB.PDaLab_1.set_size ( size.small )BB.PDaLab_1.set_textcolor ( PDtxtCss )BB.PDaLab_1.set_text ('Discount PD Array')BB.PDaLab_1.set_style(label.style_label_upper_left)cnt := 1ll1 := getY1 =>if getY + getY2 < ll1BB.PDa_box2.set_lefttop (getX, getY + getY2)BB.PDaLine2.set_xy1 (getX, getY )BB.PDa_box2.set_rightbottom( n , getY )BB.PDaLine2.set_xy2 ( n , getY )BB.PDa_box2.set_bgcolor ( cSwingBr )BB.PDaLab_2.set_xy ( getX, getY )BB.PDaLab_2.set_size ( size.small )BB.PDaLab_2.set_textcolor ( PDtxtCss )BB.PDaLab_2.set_text ('Discount PD Array')BB.PDaLab_2.set_style(label.style_label_upper_left)cnt := 2if cnt == 2breakI = red_1_prT - red_1_prBE1 = red_1_prB - (I * R2a / R1a)E2 = red_1_prB - (I * R2b / R1b)E3 = red_1_prB - (I * R2c / R1c)if iTPif not BB.TP1_hitBB.TP1_line.set_xy1(n, E1)BB.TP1_line.set_xy2(n + 20, E1)if not BB.TP2_hitBB.TP2_line.set_xy1(n, E2)BB.TP2_line.set_xy2(n + 20, E2)if not BB.TP3_hitBB.TP3_line.set_xy1(n, E3)BB.TP3_line.set_xy2(n + 20, E3)signals.set(BB_min, true)alert('-BB', alert.freq_once_per_bar_close)BB.aLabels.unshift(createLab('d', high, cBB_minB.notransp(), _arrowdn, size.large))breakMSS.dir := -1//-----------------------------------------------------------------------------}//Calculations//-----------------------------------------------------------------------------{draw(len, tpCss)lft = BB.BB_boxB.get_left ()top = BB.BB_boxB.get_top ()btm = BB.BB_boxB.get_bottom()avg = BB.BB_line.get_y2 ()l_1 = BB.line_1.get_y2 ()l_2 = BB.line_2.get_y2 ()TP1 = BB.TP1_line.get_y2 ()TP2 = BB.TP2_line.get_y2 ()TP3 = BB.TP3_line.get_y2 ()switch BB.dir1 =>if not BB.Mitigatedif close < btmBB.Mitigated := truesignals.set(BB_endBl, true)alert('+BB Mitigated', alert.freq_once_per_bar_close)BB.aLabels.unshift(createLab('u', low, color.yellow, _c))BB.BB_boxB.set_right(n)BB.BB_line.set_x2 (n)elseBB.BB_boxB.set_right(n + 8)BB.BB_line.set_x2 (n + 8)BB.TP1_line.set_x2 (n)BB.TP2_line.set_x2 (n)BB.TP3_line.set_x2 (n)if n > BB.BB_boxB.get_left()if not BB.Brokenif BB.scalpif not BB.TP1_hit and open < TP1 and high > TP1BB.TP1_hit := truesignals.set(tpUP1, true)alert('TP UP 1', alert.freq_once_per_bar)BB.aLabels.unshift(createLab('c', TP1, #ff00dd, _c))if not BB.TP2_hit and open < TP2 and high > TP2BB.TP2_hit := truesignals.set(tpUP2, true)alert('TP UP 2', alert.freq_once_per_bar)BB.aLabels.unshift(createLab('c', TP2, #ff00dd, _c))if not BB.TP3_hit and open < TP3 and high > TP3BB.TP3_hit := truesignals.set(tpUP3, true)alert('TP UP 3', alert.freq_once_per_bar)BB.aLabels.unshift(createLab('c', TP3, #ff00dd, _c))switchopen > avg and open < top and close > top =>BB.TP1_hit := falseBB.TP2_hit := falseBB.TP3_hit := falseBB.scalp := truesignals.set(signUP, true)alert('signal UP', alert.freq_once_per_bar_close)BB.aLabels.unshift(createLab('u', low, color.lime, _arrowup, size.normal))close < avg and close > btm =>BB.Broken := trueBB.scalp := falsesignals.set(cnclUP, true)alert('cancel UP', alert.freq_once_per_bar_close)BB.aLabels.unshift(createLab('u', low, color.orange, _x))else// resetif not tillFirstBreak and close > topBB.Broken := falseBB.scalp := truesignals.set(BBplus, true)alert('+BB (R)', alert.freq_once_per_bar_close)BB.aLabels.unshift(createLab('u', low, color.blue, 'R', size.normal))if not BB.Broken_1BB.line_1.set_x2(n)if close < l_1BB.Broken_1 := truesignals.set(LL1break, true)alert('LL 1 break', alert.freq_once_per_bar_close)if showBreaksBB.aLabels.unshift(createLab('c', low, #c00000, _c))if not BB.Broken_2BB.line_2.set_x2(n)if close < l_2BB.Broken_2 := truesignals.set(LL2break, true)alert('LL 2 break', alert.freq_once_per_bar_close)if showBreaksBB.aLabels.unshift(createLab('c', low, #c00000, _c))if not BB.PDbroken1BB.PDa_box1.set_right(n)BB.PDaLine1.set_x2 (n)if close > BB.PDa_box1.get_top() and n > BB.PDa_box1.get_left()BB.PDbroken1 := truesignals.set(SW1breakUP, true)alert('Swing UP 1 break', alert.freq_once_per_bar_close)if showBreaksBB.aLabels.unshift(createLab('c', high, #c00000, _c))if not BB.PDbroken2BB.PDa_box2.set_right(n)BB.PDaLine2.set_x2 (n)if close > BB.PDa_box2.get_top() and n > BB.PDa_box2.get_left()BB.PDbroken2 := truesignals.set(SW2breakUP, true)alert('Swing UP 2 break', alert.freq_once_per_bar_close)if showBreaksBB.aLabels.unshift(createLab('c', high, #c00000, _c))-1 =>if not BB.Mitigatedif close > topBB.Mitigated := truesignals.set(BB_endBr, true)alert('-BB Mitigated', alert.freq_once_per_bar_close)if showBreaksBB.aLabels.unshift(createLab('d', high, cBB_minB.notransp(), _c))BB.BB_boxB.set_right(n)BB.BB_line.set_x2 (n)elseBB.BB_boxB.set_right(n + 8)BB.BB_line.set_x2 (n + 8)BB.TP1_line.set_x2 (n)BB.TP2_line.set_x2 (n)BB.TP3_line.set_x2 (n)if n > BB.BB_boxB.get_left()if not BB.Brokenif BB.scalpif not BB.TP1_hit and open > TP1 and low < TP1BB.TP1_hit := truesignals.set(tpDN1, true)alert('TP DN 1', alert.freq_once_per_bar)BB.aLabels.unshift(createLab('c', TP1, #ff00dd, _c))if not BB.TP2_hit and open > TP2 and low < TP2BB.TP2_hit := truesignals.set(tpDN2, true)alert('TP DN 2', alert.freq_once_per_bar)BB.aLabels.unshift(createLab('c', TP2, #ff00dd, _c))if not BB.TP3_hit and open > TP3 and low < TP3BB.TP3_hit := truesignals.set(tpDN3, true)alert('TP DN 3', alert.freq_once_per_bar)BB.aLabels.unshift(createLab('c', TP3, #ff00dd, _c))switchopen < avg and open > btm and close < btm =>BB.TP1_hit := falseBB.TP2_hit := falseBB.TP3_hit := falseBB.scalp := truesignals.set(signDN, true)alert('signal DN', alert.freq_once_per_bar_close)BB.aLabels.unshift(createLab('d', high, color.orange, _arrowdn, size.normal))close > avg and close < top =>BB.Broken := trueBB.scalp := falsesignals.set(cnclDN, true)alert('cancel DN', alert.freq_once_per_bar_close)BB.aLabels.unshift(createLab('d', high, color.red , _x))else// resetif not tillFirstBreak and close < btmBB.Broken := falseBB.scalp := truesignals.set(BB_min, true)alert('-BB (R)', alert.freq_once_per_bar_close)BB.aLabels.unshift(createLab('d', high, color.blue, 'R', size.normal))if not BB.Broken_1BB.line_1.set_x2(n)if close > l_1BB.Broken_1 := truesignals.set(HH1break, true)alert('HH 1 break', alert.freq_once_per_bar_close)if showBreaksBB.aLabels.unshift(createLab('c', high, #c00000, _c))if not BB.Broken_2BB.line_2.set_x2(n)if close > l_2BB.Broken_2 := truesignals.set(HH2break, true)alert('HH 2 break', alert.freq_once_per_bar_close)if showBreaksBB.aLabels.unshift(createLab('c', high, #c00000, _c))if not BB.PDbroken1BB.PDa_box1.set_right(n)BB.PDaLine1.set_x2 (n)if close < BB.PDa_box1.get_bottom() and n > BB.PDa_box1.get_left()BB.PDbroken1 := truesignals.set(SW1breakDN, true)alert('Swing DN 1 break', alert.freq_once_per_bar_close)if showBreaksBB.aLabels.unshift(createLab('c', low, #c00000, _c))if not BB.PDbroken2BB.PDa_box2.set_right(n)BB.PDaLine2.set_x2 (n)if close < BB.PDa_box2.get_bottom() and n > BB.PDa_box2.get_left()BB.PDbroken2 := truesignals.set(SW2breakDN, true)alert('Swing DN 2 break', alert.freq_once_per_bar_close)if showBreaksBB.aLabels.unshift(createLab('c', low, #c00000, _c))//-----------------------------------------------------------------------------}//Alerts//-----------------------------------------------------------------------------{alertcondition(signals.get(BBplus ), ' 1. +BB' , '1. +BB' )alertcondition(signals.get(signUP ), ' 2. signal UP' , '2. signal UP' )alertcondition(signals.get(tpUP1 ), ' 3. TP UP 1' , '3. TP UP 1' )alertcondition(signals.get(tpUP2 ), ' 3. TP UP 2' , '3. TP UP 2' )alertcondition(signals.get(tpUP3 ), ' 3. TP UP 3' , '3. TP UP 3' )alertcondition(signals.get(cnclUP ), ' 4. cancel UP' , '4. cancel UP' )alertcondition(signals.get(BB_endBl ), ' 5. +BB Mitigated' , '5. +BB Mitigated' )alertcondition(signals.get(LL1break ), ' 6. LL 1 Break' , '6. LL 1 Break' )alertcondition(signals.get(LL2break ), ' 6. LL 2 Break' , '6. LL 2 Break' )alertcondition(signals.get(SW1breakUP), ' 7. Swing UP 1 Break', '7. Swing UP 1 Break')alertcondition(signals.get(SW2breakUP), ' 7. Swing UP 2 Break', '7. Swing UP 2 Break')alertcondition(signals.get(BB_min ), '1. -BB' , '1. -BB' )alertcondition(signals.get(signDN ), '2. signal DN' , '2. signal DN' )alertcondition(signals.get(tpDN1 ), '3. TP DN 1' , '3. TP DN 1' )alertcondition(signals.get(tpDN2 ), '3. TP DN 2' , '3. TP DN 2' )alertcondition(signals.get(tpDN3 ), '3. TP DN 3' , '3. TP DN 3' )alertcondition(signals.get(cnclDN ), '4. cancel DN' , '4. cancel DN' )alertcondition(signals.get(BB_endBr ), '5. -BB Mitigated' , '5. -BB Mitigated' )alertcondition(signals.get(HH1break ), '6. HH 1 Break' , '6. HH 1 Break' )alertcondition(signals.get(HH2break ), '6. HH 2 Break' , '6. HH 2 Break' )alertcondition(signals.get(SW1breakDN), '7. Swing DN 1 Break', '7. Swing DN 1 Break')alertcondition(signals.get(SW2breakDN), '7. Swing DN 2 Break', '7. Swing DN 2 Break')//-----------------------------------------------------------------------------} -
AuthorPosts
Viewing 1 post (of 1 total)