SMC
SMC
0
at [Link]
// Join us [Link]
// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0
at [Link]
// © BigBeluga
//
//@version=5
indicator("Price Action Smart Money Concepts [BigBeluga]", "Price Action Smart
Money Concepts [BigBeluga]", overlay = true, max_bars_back = 5000, max_boxes_count
= 500, max_labels_count = 500, max_lines_count = 500, max_polylines_count = 100)
plot(na)
_
='
------------
–––––––––––––––––––––––––– INPUTS
–––––––––––––––––––––––––––
------------
'//{
windowsis = [Link](true, "Window ", inline
= "kla", group = "MARKET STRUCTURE")
mswindow = [Link](5000, "", tooltip = "Limit market structure calculation to
improve memory speed time", group = "MARKET STRUCTURE", inline = "kla", minval =
1000)
showSwing = [Link] ( true ,
"Swing ", inline = "scss", group = "MARKET
STRUCTURE")
swingLimit = [Link] (100, "", tooltip = "[INPUT] Limit swing structure to
tot bars back", inline = "scss", group = "MARKET STRUCTURE", minval = 10, maxval =
200)
swingcssup = [Link] (#089981, "", inline = "scss", group = "MARKET
STRUCTURE")
swingcssdn = [Link] (#f23645, "", inline = "scss", group = "MARKET
STRUCTURE")
type alert
bool b = false // If condition has been met or not
string d = na // Bullish or Bearish direction
string n = na // Name of alert
if [Link]
for i in a
if i
b := true
break
for i = 0 to [Link]() - 1
[Link]([Link]())
//}
_
='
------------
–––––––––––––––––––––––––– UDT
–––––––––––––––––––––––––––
------------
'//{
type hqlzone
box pbx
box ebx
box lbx
label plb
label elb
label lbl
type Zphl
line top
line bottom
label top_label
label bottom_label
bool stopcross
bool sbottomcross
bool itopcross
bool ibottomcross
string txtup
string txtdn
float topy
float bottomy
float topx
float bottomx
float tup
float tdn
int tupx
int tdnx
float itopy
float itopx
float ibottomy
float ibottomx
float uV
float dV
type entered
bool normal = false
bool breaker = false
type store
line [] ln
label [] lb
box [] bx
linefill[] lf
type structure
int zn
float zz
float bos
float choch
int loc
int temp
int trend
int start
float main
int xloc
bool upsweep
bool dnsweep
string txt = na
type drawms
int x1
int x2
float y
string txt
color css
string style
type ob
bool bull
float top
float btm
float avg
int loc
color css
float vol
int dir
int move
int blPOS
int brPOS
int xlocbl
int xlocbr
bool isbb = false
int bbloc
type FVG
float top = na
float btm = na
int loc = bar_index
bool isbb = false
int bbloc = na
bool israid = false
float raidy = na
int raidloc = na
int raidx2 = na
bool active = false
color raidcs = na
type SFP
float y
int loc
float ancor
type sfpbuildlbl
int x
float y
string style
color css
string txt
type sfpbuildline
int x1
int x2
float y
color css
float ancor
int loc
type equalbuild
int x1
float y1
int x2
float y2
color css
string style
type equalname
int x
float y
string txt
color css
string style
type ehl
float pt
int t
float pb
int b
type sellbuyside
float top
float btm
int loc
color css
string txt
float vol
type timer
bool start = false
int count = 0
//}
_
='
------------
–––––––––––––––––––––––––– SETUP
–––––––––––––––––––––––––––
------------
'//{
if [Link]
for obj in [Link]
[Link]()
for obj in [Link]
[Link]()
for obj in [Link]
[Link]()
for obj in [Link]
[Link]()
[Link]()
[Link]()
[Link]()
[Link]()
invcol = #ffffff00
hl () => [high, low]
min = 99999999.
max = 0.
idx = 0
if use_max
for i = 0 to (bar_index - loc)
max := [Link](high[i], max)
min := max == high[i] ? low[i] : min
idx := max == high[i] ? i : idx
else
for i = 0 to (bar_index - loc)
min := [Link](low[i], min)
max := min == low[i] ? high[i] : max
idx := min == low[i] ? i : idx
idx
indexHighTF = [Link] ? 1 : 0
indexCurrTF = [Link] ? 0 : 1
method find(structure ms, bool use_max, bool sweep, bool useob) =>
min = 99999999.
max = 0.
idx = 0
if not sweep
if ((bar_index - [Link]) - 1) > 0
if use_max
for i = 0 to (bar_index - [Link]) - 1
max := [Link](high[i], max)
min := max == high[i] ? low[i] : min
idx := max == high[i] ? i : idx
if useob
if high[idx + 1] > high[idx]
max := high[idx + 1]
min := low [idx + 1]
idx := idx + 1
else
for i = 0 to (bar_index - [Link]) - 1
min := [Link](low[i], min)
max := min == low[i] ? high[i] : max
idx := min == low[i] ? i : idx
if useob
if low[idx + 1] < low[idx]
max := high[idx + 1]
min := low [idx + 1]
idx := idx + 1
else
if use_max
for i = 0 to (bar_index - [Link])
max := [Link](high[i], max)
min := max == high[i] ? low[i] : min
idx := max == high[i] ? i : idx
if useob
if high[idx + 1] > high[idx]
max := high[idx + 1]
min := low [idx + 1]
idx := idx + 1
else
for i = 0 to (bar_index - [Link])
min := [Link](low[i], min)
max := min == low[i] ? high[i] : max
idx := min == low[i] ? i : idx
if useob
if low[idx + 1] < low[idx]
max := high[idx + 1]
min := low [idx + 1]
idx := idx + 1
else
if ((bar_index - [Link]) - 1) > 0
if use_max
for i = 0 to (bar_index - [Link]) - 1
max := [Link](high[i], max)
min := max == high[i] ? low[i] : min
idx := max == high[i] ? i : idx
if useob
if high[idx + 1] > high[idx]
max := high[idx + 1]
min := low [idx + 1]
idx := idx + 1
else
for i = 0 to (bar_index - [Link]) - 1
min := [Link](low[i], min)
max := min == low[i] ? high[i] : max
idx := min == low[i] ? i : idx
if useob
if low[idx + 1] < low[idx]
max := high[idx + 1]
min := low [idx + 1]
idx := idx + 1
else
if use_max
for i = 0 to (bar_index - [Link])
max := [Link](high[i], max)
min := max == high[i] ? low[i] : min
idx := max == high[i] ? i : idx
if useob
if high[idx + 1] > high[idx]
max := high[idx + 1]
min := low [idx + 1]
idx := idx + 1
else
for i = 0 to (bar_index - [Link])
min := [Link](low[i], min)
max := min == low[i] ? high[i] : max
idx := min == low[i] ? i : idx
if useob
if low[idx + 1] < low[idx]
max := high[idx + 1]
min := low [idx + 1]
idx := idx + 1
idx
method fnOB(ob[] block, bool bull, float cords, int idx) =>
switch bull
true =>
[Link] := false
[Link] := false
[Link](
[Link](
true
, cords
, low [idx]
, [Link](cords, low[idx])
, time [idx]
, obupcs
, volume[idx]
, close [idx] > open[idx] ? 1 : -1
, 1
, 1
, 1
, time [idx]
)
)
false =>
[Link] := false
[Link] := false
[Link](
[Link](
false
, high [idx]
, cords
, [Link](cords, high[idx])
, time [idx]
, obdncs
, volume[idx]
, close [idx] > open[idx] ? 1 : -1
, 1
, 1
, 1
, time [idx]
)
)
false =>
if obmiti == "Close" ? [Link](close, open) > [Link] :
obmiti == "Wick" ? high > [Link] : obmiti == "Avg" ? high > [Link] : na
[Link](4, [Link](true, "Bearish", "OB
Mitigated\n"))
[Link] := true
[Link] := time
if not obshowbb
[Link](i)
else
switch [Link]
true =>
if obmiti == "Close" ? [Link](close, open) > [Link] :
obmiti == "Wick" ? high > [Link] : obmiti == "Avg" ? high > [Link] : na
[Link](i)
false =>
if obmiti == "Close" ? [Link](close, open) < [Link] :
obmiti == "Wick" ? low < [Link] : obmiti == "Avg" ? low < [Link] : na
[Link](i)
if [Link]() > 1
for i = [Link]() - 1 to 1
stuff = [Link](i)
current = [Link](0)
v = wichlap == "Recent" ? i : 0
switch
[Link] > [Link] and [Link] < [Link] =>
[Link](v)
[Link] < [Link] and [Link] > [Link] =>
[Link](v)
[Link] > [Link] and [Link] < [Link] =>
[Link](v)
[Link] < [Link] and [Link] > [Link] =>
[Link](v)
if [Link]() > 1
for i = [Link]() - 1 to 1
stuff = [Link](i)
current = [Link](0)
switch
[Link] > [Link] and [Link] < [Link] =>
[Link](i)
[Link] < [Link] and [Link] > [Link] =>
[Link](i)
[Link] > [Link] and [Link] < [Link] =>
[Link](i)
[Link] < [Link] and [Link] > [Link] =>
[Link](i)
-1 =>
switch [Link]
1 => [Link] := [Link] + 1, [Link] := 2
2 => [Link] := [Link] + 1, [Link] := 3
3 => [Link] := [Link] + 1, [Link] := 1
else
[Link]([Link] (top = [Link], bottom = [Link], left = [Link] ,
right = [Link] , border_color = na , bgcolor = [Link] , xloc =
xloc.bar_time))
[Link]([Link] (top = [Link], bottom = [Link], left = [Link] ,
right = time , border_color = [Link] , bgcolor = [Link] ? bbup : bbdn , xloc =
xloc.bar_time, border_width = 2))
[Link]([Link] (top = [Link], bottom = [Link], left = time ,
right = time + 1 , border_color = [Link] , bgcolor = [Link] ? bbup : bbdn , xloc =
xloc.bar_time, extend = [Link]))
if obshowactivity
[Link]([Link] (top = [Link], bottom = [Link], left = [Link] ,
right = [Link], border_color = na , bgcolor = obactup, xloc =
xloc.bar_time))
[Link]([Link] (top = [Link], bottom = [Link], left = [Link] ,
right = [Link], border_color = na , bgcolor = obactdn, xloc =
xloc.bar_time))
if showline
[Link]([Link](
x1 = [Link]
, x2 = time
, y1 = [Link]
, y2 = [Link]
, color = [Link]([Link], 0)
, xloc = xloc.bar_time
, style = line.style_dashed
)
)
if showmetric
if i == [Link](oblast - 1, [Link]() - 1)
float tV = 0
float[] dV = [Link]<float>()
seq = [Link](oblast - 1, [Link]() - 1)
for j = 0 to seq
cV = [Link](j)
tV += [Link]
if j == seq
for y = 0 to seq
[Link](
[Link](
([Link](y).vol / tV) * 100)
)
ids = [Link](y)
[Link]([Link](
bar_index - 1
, [Link]
, textcolor = [Link]([Link], 0)
, style = label.style_label_left
, size = [Link]()
, color = #ffffff00
, text =
[Link](
[Link]([Link](y).vol, 3), format =
[Link]) + " (" + [Link]([Link](y)) + "%)"
)
)
//}
_
='
------------
–––––––––––––––––––––––––– FUNCTION
–––––––––––––––––––––––––––
------------
'//{
mapping() =>
var float up = na
var float dn = na
var float point = na
var int trend = 0
var int idx = na
var int sum = na
var int project = na
var [Link][] charts = [Link]<[Link]>()
if na(up)
up := high
idx := bar_index
if na(dn)
dn := low
idx := bar_index
if high > up
if trend == -1
id = IDMIDX(false, idx)
[Link](
[Link].from_time(
time[id]
, low [id]
)
)
idx := bar_index
point := low [id]
sum := time[id]
up := high
dn := low
project := time
trend := 1
if low < dn
if trend == 1
id = IDMIDX(true, idx)
[Link](
[Link].from_time(
time[id]
, high[id]
)
)
idx := bar_index
point := high[id]
sum := time[id]
up := high
dn := low
project := time
trend := -1
if [Link]
var line ln = na
var polyline pl = na
[Link]()
[Link]()
ln := na
pl := na
ln := [Link](
x1 = sum
, x2 = project
, y1 = point
, y2 = trend == 1 ? up : dn
, xloc = xloc.bar_time
, color = [Link]
)
pl := [Link](
charts
, line_color = mappingcss
, xloc = xloc.bar_time
, line_style = [Link]()
)
posLIQ() =>
ph = [Link](high, 5, 5)
pl = [Link] (low , 5, 5)
if ph
[Link](0, ph)
if pl
[Link](0, pl)
if high > [Link](0) and close < [Link](0) and upallow and high > high[1]
[Link](10, [Link](true, "Bearish", "Liquidity Print\n"))
upallow := false
printup := true
if low < [Link](0) and close > [Link](0) and dnallow and low < low[1]
[Link](10, [Link](true, "Bullish", "Liquidity Print\n"))
dnallow := false
printdn := true
[printup, printdn]
structure(color upcss, color dncss, bool draw, bool internal, int limit) =>
var structure ms = [Link](start = 0)
var ob [] blob = [Link]< ob >()
var ob [] brob = [Link]< ob >()
var drawms [] bldw = [Link]< drawms >()
var drawms [] brdw = [Link]< drawms >()
var sellbuyside[] sellside = [Link]<sellbuyside>()
var sellbuyside[] buyside = [Link]<sellbuyside>()
bool crossup = false
bool crossdn = false
var float up = na
var float dn = na
idbull = [Link](false, false, true)
idbear = [Link](true , false, true)
btmP = obmode == "Length" ? (high[idbear] - 1 * atr[idbear]) <
low [idbear] ? low [idbear] : (high[idbear] - 1 * atr[idbear]) : low [idbear]
topP = obmode == "Length" ? (low [idbull] + 1 * atr[idbull]) >
high[idbull] ? high[idbull] : (low [idbull] + 1 * atr[idbull]) : high[idbull]
atr = [Link] (200)
buy = low + atr
sel = high - atr
ph = [Link](high, mslen, mslen)
pl = [Link] (low , mslen, mslen)
var int [] phn = [Link]< int >(1, na)
var int [] pln = [Link]< int >(1, na)
var float[] php = [Link]<float>(1, na)
var float[] plp = [Link]<float>(1, na)
if internal
[Link]()
[Link]()
if ph
[Link](bar_index[mslen])
[Link](high[mslen])
if pl
[Link](bar_index[mslen])
[Link](low[mslen])
if [Link]() > 0
if high > [Link](0)
[Link]()
[Link]()
if [Link]() > 0
if low < [Link](0)
[Link]()
[Link]()
if na(up)
up := high
if na(dn)
dn := low
if high > up
up := high
dn := low
crossup := true
if low < dn
up := high
dn := low
crossdn := true
if [Link] == 0
ms := [Link](bar_index, na, high, low , bar_index,
bar_index, 0, 1, na, bar_index)
if draw
[Link]([Link](time, time, high , "CHoCH" , upcss,
line.style_dashed))
[Link]([Link](time, time, low , "CHoCH" , dncss,
line.style_dashed))
[Link] := false
[Link] := false
if [Link] == 1
switch
low <= [Link] and close >= [Link] and buildsweep =>
[Link](2, [Link](true, "Bearish", "CHoCH Sweep\n"))
[Link] := true
[Link] := low
[Link] := bar_index
if draw
dw = [Link](0)
dw.x2 := time
[Link] := line.style_dotted
[Link] := "x"
[Link](
[Link](
time
, time
, low
, "CHoCH"
, dncss
, line.style_dashed
)
)
high >= [Link] and close <= [Link] and buildsweep =>
[Link](2, [Link](true, "Bullish", "CHoCH Sweep\n"))
[Link] := true
[Link] := high
[Link] := bar_index
if draw
dw = [Link](0)
dw.x2 := time
[Link] := line.style_dotted
[Link] := "x"
[Link](
[Link](
time
, time
, high
, "CHoCH"
, upcss
, line.style_dashed
)
)
if [Link] == 2
switch [Link]
-1 =>
if low <= [Link]
[Link] := low
[Link] := bar_index
if bar_index % mslen * 2 == 0
if not na([Link]) and msmode == "Adjusted Points" and
[Link]() > 0
if [Link](0) < [Link]
// [Link] := [Link](0)
[Link] := [Link](0)
[Link] := [Link](0)
[Link] := [Link](0)
[Link] := [Link](0)
if draw
choch = [Link](0)
choch.x1 := time [bar_index - [Link](0)]
choch.x2 := time
choch.y := [Link](0)
if na([Link])
if crossup and close > open and close[1] > open[1]
[Link] := [Link]
[Link] := [Link]
[Link] := [Link]
if draw
[Link](
[Link](
time[bar_index - [Link]]
, time
, low [bar_index - [Link]]
, "BOS"
, dncss
, line.style_dashed
)
)
if draw
choch = [Link](0)
choch.x2 := time
switch
low <= [Link] and close >= [Link] and not na([Link]) and
buildsweep =>
[Link](3, [Link](true, "Bearish", "BOS Sweep\n"))
[Link] := true
[Link] := low
if draw
dw = [Link](0)
dw.x2 := time
[Link] := line.style_dotted
[Link] := "x"
[Link](
[Link](
time
, time
, low
, "BOS"
, dncss
, line.style_dashed
)
)
if showside
id = [Link](true, true, true)
btm = (high[id] - atr[id]) > low[id] ? (high[id] -
atr[id]) : low[id]
[Link](
[Link](
high[id]
, btm
, time[id]
, sidesidecss
, "Sell Side"
, volume[id]
)
)
[Link] := false
[Link] := bar_index
bralert
switch
high >= [Link] and close <= [Link] and buildsweep =>
[Link](2, [Link](true, "Bullish", "CHoCH Sweep\
n"))
[Link] := true
[Link] := high
[Link] := bar_index
if draw
dw = [Link](0)
dw.x2 := time
[Link] := line.style_dotted
[Link] := "x"
[Link](
[Link](
time
, time
, high
, "CHoCH"
, upcss
, line.style_dashed
)
)
close >= [Link] =>
[Link](0, [Link](true, "Bullish", "CHoCH\n"))
[Link] := "choch"
[Link] := [Link]
[Link] := bar_index
[Link] := true
[Link] := 0
[Link](true, topP, idbull)
id = [Link](false, false, false)
switch
na([Link]) =>
[Link] := low[id]
if draw
[Link](
[Link](
time
, time
, low
, "BOS"
, dncss
, line.style_dashed
)
)
choch = [Link](0)
choch.x1 := time[bar_index - [Link]]
=> [Link] := [Link]//low[id + 1] < low[id] ? low[id +
1] : low[id]
[Link] := na
[Link] := high
[Link] := 1
[Link] := bar_index
[Link] := bar_index
[Link] := [Link]
if draw
dw = [Link](0)
dw.x2 := time
[Link] := "CHoCH"
[Link] := internal ? line.style_dashed :
line.style_solid
choch = [Link](0)
choch.x2 := time
choch.y := [Link]
[Link] := "CHoCH"
if showside
id = [Link](false, true, true)
top = (low[id] + atr[id]) < high[id] ? (low[id] +
atr[id]) : high[id]
[Link](
[Link](
low[id]
, top
, time[id]
, buysidecss
, "Buy Side"
, volume[id]
)
)
[Link] := bar_index
[Link] := false
1 =>
if high >= [Link]
[Link] := high
[Link] := bar_index
if na([Link])
if crossdn and close < open and close[1] < open[1]
[Link] := [Link]
[Link] := [Link]
[Link] := [Link]
if draw
[Link](
[Link](
time[bar_index - [Link]]
, time
, high[bar_index - [Link]]
, "BOS"
, upcss
, line.style_dashed
)
)
if bar_index % mslen * 2 == 0
if not na([Link]) and msmode == "Adjusted Points" and
[Link]() > 0
if [Link](0) > [Link]
// [Link] := [Link](0)
[Link] := [Link](0)
[Link] := [Link](0)
[Link] := [Link](0)
[Link] := [Link](0)
// [Link] := [Link](0)
if draw
choch = [Link](0)
choch.x1 := time [bar_index - [Link](0)]
choch.x2 := time
choch.y := [Link](0)
if draw
choch = [Link](0)
choch.x2 := time
switch
high >= [Link] and close <= [Link] and not na([Link]) and
buildsweep =>
[Link](3, [Link](true, "Bullish", "BOS Sweep\n"))
[Link] := true
[Link] := high
if draw
dw = [Link](0)
dw.x2 := time
[Link] := line.style_dotted
[Link] := "x"
[Link](
[Link](
time
, time
, high
, "BOS"
, upcss
, line.style_dashed
)
)
if showside
id = [Link](false, true, true)
top = (low[id] + atr[id]) < high[id] ? (low[id] +
atr[id]) : high[id]
[Link](
[Link](
low[id]
, top
, time[id]
, buysidecss
, "Buy Side"
, volume[id]
)
)
[Link] := bar_index
blalert
switch
low <= [Link] and close >= [Link] and buildsweep =>
[Link](2, [Link](true, "Bearish", "CHoCH Sweep\
n"))
[Link] := true
[Link] := low
[Link] := bar_index
if draw
dw = [Link](0)
dw.x2 := time
[Link] := line.style_dotted
[Link] := "x"
[Link](
[Link](
time
, time
, low
, "CHoCH"
, dncss
, line.style_dashed
)
)
if showside
id = [Link](true, true, true)
btm = (high[id] - atr[id]) > low[id] ? (high[id] -
atr[id]) : low[id]
[Link](
[Link](
high[id]
, btm
, time[id]
, sidesidecss
, "Sell Side"
, volume[id]
)
)
[Link] := bar_index
if [Link]() > 0
ob = [Link](0)
if low < [Link]
[Link](5, [Link](true, "Bullish", "Price Inside OB\n"))
if [Link]() > 0
ob = [Link](0)
if high > [Link]
[Link](5, [Link](true, "Bearish", "Price Inside OB\n"))
if showside
if [Link]() > 0
side = [Link](0)
if low < [Link]
if [Link] == false
if [Link]() > 0
side = [Link](0)
if high > [Link]
if [Link] == false
if sidemode == "Area"
[Link](
[Link](
top = [Link]
, bottom = [Link]
, left = [Link]
, right = time
, border_color = na
, bgcolor = [Link]
, xloc = xloc.bar_time
)
)
[Link](
[Link](
x1 = [Link]
, x2 = time
, y1 = [Link]
, y2 = [Link]
, xloc = xloc.bar_time
, color = [Link]([Link], 0)
, style = line.style_solid
)
)
[Link](
[Link](
x1 = bar_index
, x2 = bar_index + 10
, y1 = [Link]
, y2 = [Link]
, xloc = xloc.bar_index
, color = [Link]([Link], 0)
, style = line.style_dotted
)
)
[Link](
[Link](
x = bar_index
, y = [Link]
, color = #ffffff00
, style = label.style_label_up
, textcolor = [Link]([Link], 0)
, size = [Link]()
, text = "Buyside - " +
[Link]([Link](([Link] / sum) * 100)) + "%"
)
)
if [Link]() > 0
side = [Link](0)
float sum = [Link]
if [Link]() > 0 and [Link]() > 0
sum := [Link](0).vol + [Link](0).vol
if sidemode == "Area"
[Link](
[Link](
top = [Link]
, bottom = [Link]
, left = [Link]
, right = time
, border_color = na
, bgcolor = [Link]
, xloc = xloc.bar_time
)
)
[Link](
[Link](
x1 = [Link]
, x2 = time
, y1 = [Link]
, y2 = [Link]
, xloc = xloc.bar_time
, color = [Link]([Link], 0)
, style = line.style_solid
)
)
[Link](
[Link](
x1 = bar_index
, x2 = bar_index + 10
, y1 = [Link]
, y2 = [Link]
, xloc = xloc.bar_index
, color = [Link]([Link], 0)
, style = line.style_dotted
)
)
[Link](
[Link](
x = bar_index
, y = [Link]
, color = #ffffff00
, style = label.style_label_down
, textcolor = [Link]([Link], 0)
, size = [Link]()
, text = "Sellside - "+
[Link]([Link](([Link] / sum) * 100)) + "%"
)
)
if [Link]() > 0
ob = [Link](0)
if not [Link]
if low < [Link]
blalert
if [Link] == false
[Link] := true
else
if high > [Link]
blalert
if [Link] == false
[Link] := true
if [Link]() > 0
ob = [Link](0)
if not [Link]
if high > [Link]
bralert
if [Link] == false
[Link] := true
else
if low < [Link]
bralert
if [Link] == false
[Link] := true
if [Link]() > 0
for [i, metric] in blob
[Link]()
if [Link]() > 0
for [i, metric] in brob
[Link]()
if [Link]
if [Link]() > 0
for i = 0 to [Link](oblast - 1, [Link]() - 1)
obs = [Link](i)
display(obs, blob, i)
if [Link]() > 0
for i = 0 to [Link](oblast - 1, [Link]() - 1)
obs = [Link](i)
display(obs, brob, i)
if msbubble
[Link](
[Link](
x = obj.x1
, y = obj.y
, xloc = xloc.bar_time
, color = [Link]([Link], 80)
, style = label.style_circle
, size = [Link]
)
)
for i = 0 to [Link]() - 1
obj = [Link](i)
if i <= limit
[Link](
[Link](
x1 = obj.x1
, x2 = obj.x2
, y1 = obj.y
, y2 = obj.y
, color = [Link]
, style = [Link]
, xloc = xloc.bar_time
)
)
[Link](
[Link](
x = int([Link]([Link](0).get_x1(),
[Link](0).get_x2()))
, y = obj.y
, xloc = xloc.bar_time
, color = #ffffff00
, style = label.style_label_up
, textcolor = [Link]
, size = [Link]()
, text = [Link]
)
)
if msbubble
[Link](
[Link](
x = obj.x1
, y = obj.y
, xloc = xloc.bar_time
, color = [Link]([Link], 80)
, style = label.style_circle
, size = [Link]
)
)
ms
//}
_
='
------------
–––––––––––––––––––––––––– EXECUTION
–––––––––––––––––––––––––––
------------
'//{
structure ms = na
if windowsis
if (bar_index > last_bar_index - mswindow)
ms := structure(swingcssup , swingcssdn , showSwing , false, swingLimit)
if windowsis == false
ms := structure(swingcssup , swingcssdn , showSwing , false, swingLimit)
color css = na
switch [Link]
-1 =>
if [Link] <= zonethresh
if high > [Link] and close < [Link]
[Link] := 0
if close > [Link]
[Link](11, [Link](true, "Bullish", "Sweep Area\n"))
[Link] := false
[Link] := 0
float[] pp = [Link]<float>()
for i = 0 to bar_index - [Link]
[Link](low[i])
1 =>
if [Link] <= zonethresh
if low < [Link] and close > [Link]
[Link] := 0
if close < [Link]
[Link](11, [Link](true, "Bearish", "Sweep Area\n"))
[Link] := false
[Link] := 0
float[] pp = [Link]<float>()
for i = 0 to bar_index - [Link]
[Link](high[i])
[Link] += 1
if showMapping
mapping()
if lvl_weekly
mtfphl(pwh, pwl, 'W', css_w, s_w)
if lvl_monthly
mtfphl(pmh, pml, 'M', css_m, s_m)
if lvl_quartely
mtfphl(pqh, pql, 'Q', css_q, s_q)
if lvl_yearly
mtfphl(pyh, pyl, 'Y', css_y, s_y)
zhl(len)=>
upper = [Link](len)
lower = [Link](len)
[top, btm]
[top , btm ] = zhl(zonelen)
// upphl(trend) =>
// if top
// [Link] := true
// [Link] := top > [Link] ? "HH" : "HL"
// [Link] := volume[zonelen]
// if showhl
// [Link]([Link][1])
// [Link] := [Link](
// bar_index- zonelen
// , top
// , bar_index
// , top
// , color = swingcssdn)
// [Link] := top
// [Link] := bar_index - zonelen
// [Link] := top
// [Link] := bar_index - zonelen
// line.set_xy1(
// [Link]
// , [Link]
// , [Link]
// )
// line.set_xy2(
// [Link]
// , bar_index+ 20
// , [Link]
// )
// label.set_x(
// lbl
// , bar_index+ 20
// )
// label.set_y(
// lbl
// , [Link]
// )
// dnphl(trend) =>
// if btm
// [Link] := true
// [Link] := btm > [Link] ? "LH" : "LL"
// [Link] := volume[zonelen]
// if showhl
// [Link]([Link][1])
// [Link] := [Link](
// bar_index- 50
// , btm
// , bar_index
// , btm
// , color = swingcssup
// )
// [Link] := btm
// [Link] := bar_index- zonelen
// [Link] := btm
// [Link] := bar_index- zonelen
// line.set_xy1(
// [Link]
// , [Link]
// , [Link]
// )
// line.set_xy2(
// [Link]
// , bar_index+ 20
// , [Link]
// )
// label.set_x(
// lbl
// , bar_index+ 20
// )
// label.set_y(
// lbl
// , [Link]
// )
// midphl() =>
// if showpdzone
// avg = [Link]([Link], [Link])
// [Link].set_lefttop(int([Link]([Link], [Link]))
, [Link])
// [Link].set_rightbottom(bar_index+ 20 , 0.95 *
[Link] + 0.05 * [Link])
//}
// // _
='
// // ------------
// // –––––––––––––––––––––––––– ANYALERT
–––––––––––––––––––––––––––
// // ------------
'//{
// This source code is subject to the terms of the Mozilla Public License 2.0 at
[Link]
// © LudoGH68
//@version=5
//// indicator("SMC Structures and FVG", overlay = true)
import LudoGH68/Drawings_public/1 as d
getLineStyle(lineOption) =>
lineOption == "┈" ? line.style_dotted : lineOption == "╌" ? line.style_dashed :
line.style_solid
get_structure_highest_bar(lookback) =>
for i = 0 to lookback - 1 by 1
if high[i+1] > high[i+2] and high[i] <= high[i+1] and ((i+1) * -1) >=
maxBar
idx := (i+1) * -1
//break
get_structure_lowest_bar(lookback) =>
for i = 0 to lookback - 1 by 1
if low[i+1] < low[i+2] and low[i] >= low[i+1] and ((i+1) * -1) >=
minBar
idx := (i+1) * -1
//break
is_structure_high_broken(_highStructBreakPrice, _structureHigh,
_structureHighStartIndex, _structureDirection) =>
var bool res = false
res
box.set_right(value, bar_index)
box.set_right(value, bar_index)
// Arrays variable
var array<line> structureLines = array.new_line(0)
var array<label> structureLabels = array.new_label(0)
var array<box> fvgBoxes = array.new_box(0)
var array<bool> fvgTypes = array.new_bool(0)
var array<bool> isFvgMitigated = array.new_bool(0)
//
===================================================================================
=======
// FAIR VALUE GAP FINDER PROCESSING
//
===================================================================================
=======
//
//
// Define FVG type
isBullishFVG = high[3] < low[1]
isBearishFVG = low[3] > high[1]
// Draw FVG
FVGDraw(fvgBoxes, fvgTypes, isFvgMitigated)
//
//
//
===================================================================================
=======