1
1
0
International (CC Dy-NC-SA 4.0) [Link]
// © LuxAlgo
//@version=5
indicator("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 = false
len = [Link] ( 5 ,
title=' Length' , inline='MS' , group='Market Structure'
, minval=1, maxval=10
)
//Breaker block
breakerCandleOnlyBody = [Link] ( false , title='Use only candle body'
, group='Breaker Block' )
breakerCandle_2Last = [Link] ( false , title='Use 2 candles instead of 1'
, group='Breaker Block', tooltip='In the same direction')
tillFirstBreak = [Link] ( true , title='Stop at first break of
center line' , group='Breaker Block' )
//PD array
onlyWhenInPDarray = [Link] ( false , title='Only when E is in
Premium/Discount Array', group='PD array' )
showPDarray = [Link] ( false , title='show Premium/Discount Zone'
, group='PD array' )
showBreaks = [Link] ( false , title='Highlight Swing Breaks'
, group='PD array' )
showSPD = [Link] ( true , title='Show Swings/PD Arrays'
, group='PD array' )
PDtxtCss = [Link] ( [Link], 'Text Color' , group='PD
array' )
PDSCss = [Link] ( [Link], 'Swing Line Color', group='PD
array' )
//Take profit
iTP = [Link] ( false , title='Enable
TP' , inline='RR' , group='TP'
)
tpCss = [Link] ( #2157f3, title='' ,
inline='RR', group='TP' )
R1a = [Link] ( 1 , title='R:R 1', minval= 1,
maxval=1, inline='RR1', group='TP' )
R2a = [Link] ( 2 , title= ':' , minval=.2,
step= .1, inline='RR1', group='TP' )
R1b = [Link] ( 1 , title='R:R 2', minval= 1,
maxval=1, inline='RR2', group='TP' )
R2b = [Link] ( 3 , title= ':' , minval=.2,
step= .1, inline='RR2', group='TP' )
R1c = [Link] ( 1 , title='R:R 3', minval= 1,
maxval=1, inline='RR3', group='TP' )
R2c = [Link] ( 4 , title= ':' , minval=.2,
step= .1, inline='RR3', group='TP' )
//Colors
cBBplusA = [Link] ([Link](12, 181, 26, 93)
,
title=' ' , inline='bl' , group='Colours
+BB Last Swings' )
cBBplusB = [Link] ([Link](12, 181, 26, 85)
,
title='' , inline='bl' , group='Colours
+BB Last Swings' )
cSwingBl = [Link] ([Link](255, 82, 82, 85)
,
title=' ' , inline='bl' , group='Colours
+BB Last Swings' )
cBB_minA = [Link] ([Link](255, 17, 0, 95)
,
title=' ' , inline='br' , group='Colours -
BB Last Swings' )
cBB_minB = [Link] ([Link](255, 17, 0, 85)
,
title='' , inline='br' , group='Colours -
BB Last Swings' )
cSwingBr = [Link] ([Link](0, 137, 123, 85)
,
title=' ' , inline='br' , group='Colours -
BB Last Swings' )
_arrowup = '▲'
_arrowdn = '▼'
_c = '●'
_x = '❌'
//-----------------------------------------------------------------------------}
//General Calculations
//-----------------------------------------------------------------------------{
per = last_bar_index - bar_index <= 2000
mx = [Link](close , open )
mn = [Link](close , open )
atr = [Link] (10 )
n = bar_index
hi = high
lo = low
mCxSize = 50
//-----------------------------------------------------------------------------}
//User Defined Types
//-----------------------------------------------------------------------------{
type ZZ
int [] d
int [] x
float [] y
line [] l
bool [] b
type mss
int dir
line [] l_mssBl
line [] l_mssBr
line [] l_bosBl
line [] l_bosBr
label[] lbMssBl
label[] lbMssBr
label[] lbBosBl
label[] lbBosBr
type block
int dir
bool Broken
bool Mitigated
box BB_boxA
box BB_boxB
line BB_line
box FVG_box
line line_1
line line_2
bool Broken_1
bool Broken_2
box PDa_boxA
box PDa_boxB
box PDa_box1
line PDaLine1
label PDaLab_1
box PDa_box2
line PDaLine2
label PDaLab_2
bool PDbroken1
bool PDbroken2
line TP1_line
line TP2_line
line TP3_line
bool TP1_hit
bool TP2_hit
bool TP3_hit
bool scalp
label HL
label[] aLabels
//-----------------------------------------------------------------------------}
//Variables
//-----------------------------------------------------------------------------{
BBplus = 0, signUP = 1, cnclUP = 2, LL1break = 3, LL2break = 4, SW1breakUP = 5
, SW2breakUP = 6, tpUP1 = 7, tpUP2 = 8, tpUP3 = 9, BB_endBl =10
BB_min =11, signDN =12, cnclDN =13, HH1break =14, HH2break =15, SW1breakDN =16
, SW2breakDN =17, tpDN1 =18, tpDN2 =19, tpDN3 =20, BB_endBr =21
signals =
[Link](
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 ZZ aZZ =
[Link](
[Link] < int >(mCxSize, 0),
[Link] < int >(mCxSize, 0),
[Link] < float >(mCxSize, na),
[Link] < line >(mCxSize, na),
[Link] < bool >(mCxSize, na))
//-----------------------------------------------------------------------------}
//Functions/methods
//-----------------------------------------------------------------------------{
method in_out(ZZ aZZ, int d, int x1, float y1, int x2, float y2, color col, bool b)
=>
[Link](d), [Link](x2), [Link](y2), [Link](b),
[Link](), [Link](), [Link](), [Link]()
if shZZ
[Link]([Link](x1, y1, x2, y2, color= col)), [Link]().delete()
method setLine(line ln, int x1, float y1, int x2, float y2) => ln.set_xy1(x1, y1),
ln.set_xy2(x2, y2)
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 = [Link]( )
x2 := bar_index -1
ph = [Link](hi, left, 1)
pl = [Link] (lo, left, 1)
if ph
dir := [Link] (0)
x1 := [Link] (0)
y1 := [Link] (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)
else
if dir == 1 and ph > y1
[Link](0, x2), [Link](0, y2)
if shZZ
[Link](0).set_xy2(x2, y2)
if pl
dir := [Link] (0)
x1 := [Link] (0)
y1 := [Link] (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)
else
if dir == -1 and pl < y1
[Link](0, x2), [Link](0, y2)
if shZZ
[Link](0).set_xy2(x2, y2)
iH = [Link](2) == 1 ? 2 : 1
iL = [Link](2) == -1 ? 2 : 1
switch
// MSS Bullish
close > [Link](iH) and [Link](iH) == 1 and [Link] < 1 and per =>
float green1prT = na
float green1prB = na
float avg = na
green1idx = n - i
green1prT := breakerCandleOnlyBody ? mx[i] : high[i]
green1prB := breakerCandleOnlyBody ? mn[i] : low [i]
if breakerCandle_2Last
if 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 < green1prB
green1idx -= 1
green1prT := [Link](green1prT, green2prT)
green1prB := [Link](green1prB, green2prB)
// Breaker Block +
avg := [Link](green1prB, green1prT)
while [Link]() > 0
[Link]().delete()
BB.PDa_boxA.delete(), BB.PDa_boxB.delete(), [Link] := 1
BB.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([Link]())
BB.BB_boxB.set_text_valign(text.align_bottom)
if showSPD
BB.line_1.set_xy1(Cx, Cy), BB.line_1.set_xy2(n , Cy),
BB.Broken_1 := false
BB.line_2.set_xy1(Ex, Ey), BB.line_2.set_xy2(n , Ey),
BB.Broken_2 := false
[Link].set_xy(Ex, Ey),
[Link].set_style(label.style_label_up), [Link].set_text('LL')
BB.TP1_hit := false
BB.TP2_hit := false
BB.TP3_hit := false
[Link] := false
[Link] := false
[Link] := false
BB.PDbroken1 := false
BB.PDbroken2 := false
// Previous swings
cnt = 0, hh1 = high
for c = 0 to sz -2
getX = [Link](c)
getY = [Link](c)
if getY > hh1 and [Link](c) == 1 and showSPD
getY2 = (high[n - getX] - mn[n - getX]) / 4
switch cnt
0 =>
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
( [Link] )
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 := 1
hh1 := getY
1 =>
if getY - getY2 > hh1
BB.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
( [Link] )
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 := 2
if cnt == 2
break
I = green1prT - green1prB
E1 = green1prT + (I * R2a / R1a)
E2 = green1prT + (I * R2b / R1b)
E3 = green1prT + (I * R2c / R1c)
if iTP
if not BB.TP1_hit
BB.TP1_line.set_xy1(n, E1)
BB.TP1_line.set_xy2(n + 20, E1)
if not BB.TP2_hit
BB.TP2_line.set_xy1(n, E2)
BB.TP2_line.set_xy2(n + 20, E2)
if not BB.TP3_hit
BB.TP3_line.set_xy1(n, E3)
BB.TP3_line.set_xy2(n + 20, E3)
[Link](BBplus, true)
alert('+BB', alert.freq_once_per_bar_close)
[Link](createLab('u', low, [Link](),
_arrowup, [Link]))
break
[Link] := 1
// MSS Bearish
close < [Link](iL) and [Link](iL) == -1 and [Link] > -1 and per =>
Ex = [Link](iL -1), Ey = [Link](iL -1)
Dx = [Link](iL ), Dy = [Link](iL ), DyMn = mn[n - Dx]
Cx = [Link](iL +1), Cy = [Link](iL +1)
Bx = [Link](iL +2), By = [Link](iL +2), ByMn = mn[n - Bx]
Ax = [Link](iL +3), Ay = [Link](iL +3), AyMx = mx[n - Ax]
_y = [Link](ByMn, DyMn)
//_x = _y == ByMn ? Bx : Dx
mid = 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 = na
float red_1_prB = na
float avg = na
if Ey > Cy and Cx != Dx and isOK
// latest LL to LL further -> search first red bar
for i = n - Dx to n - Cx
if close[i] < open[i]
// reset previous swing box's
BB.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 - i
red_1_prT := breakerCandleOnlyBody ? mx[i] : high[i]
red_1_prB := breakerCandleOnlyBody ? mn[i] : low [i]
if breakerCandle_2Last
if 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_prB
red_1_idx -= 1
red_1_prT := [Link](red_1_prT, red_2_prT)
red_1_prB := [Link](red_1_prB, red_2_prB)
// Breaker Block -
avg := [Link](red_1_prB, red_1_prT)
while [Link]() > 0
[Link]().delete()
BB.PDa_boxA.delete(), BB.PDa_boxB.delete(), [Link] := -1
BB.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)
if showSPD
BB.line_1.set_xy1(Cx, Cy), BB.line_1.set_xy2(n , Cy),
BB.Broken_1 := false
BB.line_2.set_xy1(Ex, Ey), BB.line_2.set_xy2(n , Ey),
BB.Broken_2 := false
[Link].set_xy(Ex, Ey),
[Link].set_style(label.style_label_down), [Link].set_text('HH'),
[Link].set_textcolor(PDtxtCss)
BB.TP1_hit := false
BB.TP2_hit := false
BB.TP3_hit := false
[Link] := false
[Link] := false
[Link] := false
BB.PDbroken1 := false
BB.PDbroken2 := false
// Previous swings
cnt = 0, ll1 = low
for c = 0 to sz -2
getX = [Link](c)
getY = [Link](c)
if getY < ll1 and [Link](c) == -1 and showSPD
getY2 = (mx[n - getX] - low[n - getX]) / 4
switch cnt
0 =>
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
( [Link] )
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 := 1
ll1 := getY
1 =>
if getY + getY2 < ll1
BB.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
( [Link] )
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 := 2
if cnt == 2
break
I = red_1_prT - red_1_prB
E1 = red_1_prB - (I * R2a / R1a)
E2 = red_1_prB - (I * R2b / R1b)
E3 = red_1_prB - (I * R2c / R1c)
if iTP
if not BB.TP1_hit
BB.TP1_line.set_xy1(n, E1)
BB.TP1_line.set_xy2(n + 20, E1)
if not BB.TP2_hit
BB.TP2_line.set_xy1(n, E2)
BB.TP2_line.set_xy2(n + 20, E2)
if not BB.TP3_hit
BB.TP3_line.set_xy1(n, E3)
BB.TP3_line.set_xy2(n + 20, E3)
[Link](BB_min, true)
alert('-BB', alert.freq_once_per_bar_close)
[Link](createLab('d', high,
cBB_minB.notransp(), _arrowdn, [Link]))
break
[Link] := -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 [Link]
1 =>
if not [Link]
if close < btm
[Link] := true
[Link](BB_endBl, true)
alert('+BB Mitigated', alert.freq_once_per_bar_close)
BB.BB_boxB.set_right(n)
BB.BB_line.set_x2 (n)
else
BB.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 [Link]
if [Link]
if not BB.TP1_hit and open < TP1 and high > TP1
BB.TP1_hit := true
[Link](tpUP1, true)
alert('TP UP 1', alert.freq_once_per_bar)
[Link](createLab('c', TP1, #ff00dd, _c))
if not BB.TP2_hit and open < TP2 and high > TP2
BB.TP2_hit := true
[Link](tpUP2, true)
alert('TP UP 2', alert.freq_once_per_bar)
[Link](createLab('c', TP2, #ff00dd, _c))
if not BB.TP3_hit and open < TP3 and high > TP3
BB.TP3_hit := true
[Link](tpUP3, true)
alert('TP UP 3', alert.freq_once_per_bar)
[Link](createLab('c', TP3, #ff00dd, _c))
switch
open > avg and open < top and close > top =>
BB.TP1_hit := false
BB.TP2_hit := false
BB.TP3_hit := false
[Link] := true
[Link](signUP, true)
alert('signal UP', alert.freq_once_per_bar_close)
[Link](createLab('u', low, [Link],
_arrowup, [Link]))
close < avg and close > btm =>
[Link] := true
[Link] := false
[Link](cnclUP, true)
alert('cancel UP', alert.freq_once_per_bar_close)
[Link](createLab('u', low, [Link],
_x))
else
// reset
if not tillFirstBreak and close > top
[Link] := false
[Link] := true
[Link](BBplus, true)
alert('+BB (R)', alert.freq_once_per_bar_close)
[Link](createLab('u', low, [Link], 'R',
[Link]))
if not BB.Broken_1
BB.line_1.set_x2(n)
if close < l_1
BB.Broken_1 := true
[Link](LL1break, true)
alert('LL 1 break', alert.freq_once_per_bar_close)
if showBreaks
[Link](createLab('c', low, #c00000, _c))
if not BB.Broken_2
BB.line_2.set_x2(n)
if close < l_2
BB.Broken_2 := true
[Link](LL2break, true)
alert('LL 2 break', alert.freq_once_per_bar_close)
if showBreaks
[Link](createLab('c', low, #c00000, _c))
if not BB.PDbroken1
BB.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 := true
[Link](SW1breakUP, true)
alert('Swing UP 1 break', alert.freq_once_per_bar_close)
if showBreaks
[Link](createLab('c', high, #c00000, _c))
if not BB.PDbroken2
BB.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 := true
[Link](SW2breakUP, true)
alert('Swing UP 2 break', alert.freq_once_per_bar_close)
if showBreaks
[Link](createLab('c', high, #c00000, _c))
-1 =>
if not [Link]
if close > top
[Link] := true
[Link](BB_endBr, true)
alert('-BB Mitigated', alert.freq_once_per_bar_close)
if showBreaks
[Link](createLab('d', high, cBB_minB.notransp(),
_c))
BB.BB_boxB.set_right(n)
BB.BB_line.set_x2 (n)
else
BB.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 [Link]
if [Link]
if not BB.TP1_hit and open > TP1 and low < TP1
BB.TP1_hit := true
[Link](tpDN1, true)
alert('TP DN 1', alert.freq_once_per_bar)
[Link](createLab('c', TP1, #ff00dd, _c))
if not BB.TP2_hit and open > TP2 and low < TP2
BB.TP2_hit := true
[Link](tpDN2, true)
alert('TP DN 2', alert.freq_once_per_bar)
[Link](createLab('c', TP2, #ff00dd, _c))
if not BB.TP3_hit and open > TP3 and low < TP3
BB.TP3_hit := true
[Link](tpDN3, true)
alert('TP DN 3', alert.freq_once_per_bar)
[Link](createLab('c', TP3, #ff00dd, _c))
switch
open < avg and open > btm and close < btm =>
BB.TP1_hit := false
BB.TP2_hit := false
BB.TP3_hit := false
[Link] := true
[Link](signDN, true)
alert('signal DN', alert.freq_once_per_bar_close)
[Link](createLab('d', high, [Link],
_arrowdn, [Link]))
close > avg and close < top =>
[Link] := true
[Link] := false
[Link](cnclDN, true)
alert('cancel DN', alert.freq_once_per_bar_close)
[Link](createLab('d', high, [Link] ,
_x))
else
// reset
if not tillFirstBreak and close < btm
[Link] := false
[Link] := true
[Link](BB_min, true)
alert('-BB (R)', alert.freq_once_per_bar_close)
[Link](createLab('d', high, [Link], 'R',
[Link]))
if not BB.Broken_1
BB.line_1.set_x2(n)
if close > l_1
BB.Broken_1 := true
[Link](HH1break, true)
alert('HH 1 break', alert.freq_once_per_bar_close)
if showBreaks
[Link](createLab('c', high, #c00000, _c))
if not BB.Broken_2
BB.line_2.set_x2(n)
if close > l_2
BB.Broken_2 := true
[Link](HH2break, true)
alert('HH 2 break', alert.freq_once_per_bar_close)
if showBreaks
[Link](createLab('c', high, #c00000, _c))
if not BB.PDbroken1
BB.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 := true
[Link](SW1breakDN, true)
alert('Swing DN 1 break', alert.freq_once_per_bar_close)
if showBreaks
[Link](createLab('c', low, #c00000, _c))
if not BB.PDbroken2
BB.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 := true
[Link](SW2breakDN, true)
alert('Swing DN 2 break', alert.freq_once_per_bar_close)
if showBreaks
[Link](createLab('c', low, #c00000, _c))
//-----------------------------------------------------------------------------}
//Alerts
//-----------------------------------------------------------------------------{
alertcondition([Link](BBplus ), ' 1. +BB' , '1. +BB'
)
alertcondition([Link](signUP ), ' 2. signal UP' , '2. signal UP'
)
alertcondition([Link](tpUP1 ), ' 3. TP UP 1' , '3. TP UP 1'
)
alertcondition([Link](tpUP2 ), ' 3. TP UP 2' , '3. TP UP 2'
)
alertcondition([Link](tpUP3 ), ' 3. TP UP 3' , '3. TP UP 3'
)
alertcondition([Link](cnclUP ), ' 4. cancel UP' , '4. cancel UP'
)
alertcondition([Link](BB_endBl ), ' 5. +BB Mitigated' , '5. +BB Mitigated'
)
alertcondition([Link](LL1break ), ' 6. LL 1 Break' , '6. LL 1 Break'
)
alertcondition([Link](LL2break ), ' 6. LL 2 Break' , '6. LL 2 Break'
)
alertcondition([Link](SW1breakUP), ' 7. Swing UP 1 Break', '7. Swing UP 1
Break')
alertcondition([Link](SW2breakUP), ' 7. Swing UP 2 Break', '7. Swing UP 2
Break')
//-----------------------------------------------------------------------------}