0% found this document useful (0 votes)
2K views45 pages

SMC

This document contains a Pine Script™ code for a trading indicator called 'Price Action Smart Money Concepts [BigBeluga]', which is designed for analyzing market structure and volumetric order blocks. It includes various input options for customizing the display of market structure, liquidity concepts, and alerts for trading signals. The code is structured to allow users to adjust settings for visual representation and functionality according to their trading strategies.

Uploaded by

adams
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2K views45 pages

SMC

This document contains a Pine Script™ code for a trading indicator called 'Price Action Smart Money Concepts [BigBeluga]', which is designed for analyzing market structure and volumetric order blocks. It includes various input options for customizing the display of market structure, liquidity concepts, and alerts for trading signals. The code is structured to allow users to adjust settings for visual representation and functionality according to their trading strategies.

Uploaded by

adams
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.

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")

showInternal = [Link] ( false , "Internal", inline = "icss", group = "MARKET


STRUCTURE")
internalDate = [Link] (0, "", tooltip = "[INPUT] Start date of the internal
structure", inline = "icss", group = "MARKET STRUCTURE", confirm = false)
interncssup = [Link] ([Link], "", inline = "icss", group = "MARKET
STRUCTURE")
interncssdn = [Link] ([Link], "", inline = "icss", group = "MARKET
STRUCTURE")

showMapping = [Link] (false, "Mapping Structure ",


inline = "mapping", group = "MARKET STRUCTURE")
mappingStyle = [Link]("----", "", options = ["⎯⎯⎯⎯", "----"], inline =
"mapping", group = "MARKET STRUCTURE")
mappingcss = [Link] ([Link], "", tooltip = "Display Mapping
Structure", inline = "mapping", group = "MARKET STRUCTURE")
candlecss = [Link] (false, "Color Candles ",
tooltip = "Color candle based on trend detection system", group = "MARKET
STRUCTURE", inline = "txt")
mstext = [Link]("Tiny", "", options = ["Tiny", "Small", "Normal", "Large",
"Huge"], inline = "txt", group = "MARKET STRUCTURE")
showpdzone = [Link](false, "Premium/Discount ", "Show
Premium discount zone", "pd", "MARKET STRUCTURE")
zonelen = [Link](20, "", inline = "pd", group = "MARKET STRUCTURE", minval = 5)
fibcss = [Link](#fbc02d, "", inline = "pd", group = "MARKET STRUCTURE")
msmode = [Link]("Adjusted Points", "Algorithmic
Logic ", options = ["Extreme Points", "Adjusted
Points"], inline = "node", group = "MARKET STRUCTURE")
mslen = [Link](5, "", inline = "node", group = "MARKET STRUCTURE", minval = 2)
showhl = [Link](false, "Strong/Weak HL", "Display Volumetric Strong/Weak High
and low", "hl", "MARKET STRUCTURE")
buildsweep = [Link](true, "Build Sweep (x)", "Build sweep on market structure",
"znc", "MARKET STRUCTURE")
msbubble = [Link](true, "Bubbles", tooltip = "Display Circle Bubbles",
inline = "bubbles", group = "MARKET STRUCTURE")

obshow = [Link](true, "Show Last", tooltip = "Show Last number of orderblock",


group = "VOLUMETRIC ORDER BLOCKS", inline = "obshow")
oblast = [Link](5, "", group = "VOLUMETRIC ORDER BLOCKS", inline = "obshow",
minval = 0)
obupcs = [Link]([Link](#089981, 90), "", inline = "obshow", group =
"VOLUMETRIC ORDER BLOCKS")
obdncs = [Link]([Link](#f23645, 90), "", inline = "obshow", group =
"VOLUMETRIC ORDER BLOCKS")

obshowactivity = [Link](true, "Show Buy/Sell Activity ", inline =


"act", group = "VOLUMETRIC ORDER BLOCKS", tooltip = "Display internal buy and sell
activity")
obactup = [Link]([Link](#089981, 50), "", inline = "act", group =
"VOLUMETRIC ORDER BLOCKS")
obactdn = [Link]([Link](#f23645, 50), "", inline = "act", group =
"VOLUMETRIC ORDER BLOCKS")

obshowbb = [Link](false, "Show Breakers ", inline = "bb",


group = "VOLUMETRIC ORDER BLOCKS", tooltip = "Display Breakers")
bbup = [Link]([Link](#089981, 100), "", inline = "bb", group = "VOLUMETRIC
ORDER BLOCKS")
bbdn = [Link]([Link](#f23645, 100), "", inline = "bb", group = "VOLUMETRIC
ORDER BLOCKS")

obmode = [Link]("Length", "Construction ", options = ["Length", "Full"],


tooltip = "[Length] Use Length to adjust cordinate of the orderblocks\n[Full] Use
whole candle body", inline = "atr", group = "VOLUMETRIC ORDER BLOCKS")
len = [Link](5, "", inline = "atr", group = "VOLUMETRIC ORDER BLOCKS", minval =
1)

obmiti = [Link]("Close", "Mitigation Method ", options =


["Close", "Wick", "Avg"], tooltip = "Mitigation method for when to trigger order
blocks", group = "VOLUMETRIC ORDER BLOCKS")
obtxt = [Link]("Normal", "Metric Size ",
options = ["Tiny", "Small", "Normal", "Large", "Huge", "Auto"], tooltip = "Order
block Metrics text size" , inline = "txt", group = "VOLUMETRIC ORDER
BLOCKS")

showmetric = [Link](true, "Show Metrics", group = "VOLUMETRIC ORDER BLOCKS")


showline = [Link](true, "Show Mid-Line", group = "VOLUMETRIC ORDER BLOCKS")
overlap = [Link](true, "Hide Overlap", group = "VOLUMETRIC ORDER BLOCKS",
inline = "ov")
wichlap = [Link]("Recent", "", options = ["Recent", "Old"],inline = "ov",
group = "VOLUMETRIC ORDER BLOCKS")

devstyle = [Link]("⎯⎯⎯⎯", "", options = ["⎯⎯⎯⎯", "----"], inline = "dev",


group = "Swing Failure Pattern")
devcss = [Link]([Link], "", tooltip = "Display deviation projection for
SFP", inline = "dev", group = "Swing Failure Pattern")

// dev1 = [Link](2 , "First Projection ", group = "Swing Failure


Pattern", inline = "d", minval = 0)
// dev2 = [Link](2.5, "Second Projection ", group = "Swing Failure Pattern",
inline = "n", minval = 0)
devsize = [Link]("Small", "Text Size ", options = ["Tiny",
"Small", "Normal", "Large", "Huge", "Auto"], tooltip = "Text Size" ,
inline = "ak", group = "Swing Failure Pattern")

devlvl = [Link](true, "Show Level", group = "Swing Failure Pattern")


devfill = [Link](true, "Fill Area", group = "Swing Failure Pattern")

showside = [Link](false, "Buyside & Sellside", tooltip = "Display Liquidity


side", inline = "side", group = "LIQUIDITY CONCEPTS")
sidemode = [Link]("Area", "", ["Area", "Line"], inline = "side", group =
"LIQUIDITY CONCEPTS")
buysidecss = [Link]([Link](#009933, 80), "", inline = "side", group =
"LIQUIDITY CONCEPTS")
sidesidecss = [Link]([Link](#cc3300, 80), "", inline = "side", group =
"LIQUIDITY CONCEPTS")
showzone = [Link](false, "Sweep Area ", "Show Sweep liquidation zone",
"sz", "LIQUIDITY CONCEPTS")
zonethresh = [Link](10, "", inline = "sz", group = "LIQUIDITY CONCEPTS", minval
= 2)
upzone = [Link]([Link](#089981, 80), "", inline = "sz", group = "LIQUIDITY
CONCEPTS")
dnzone = [Link]([Link](#f23645, 80), "", inline = "sz", group = "LIQUIDITY
CONCEPTS")

// lvl_monday = [Link] (false


, "Monday" , inline = "q", group = "HIGHS & LOWS MTF")
lvl_daily = [Link] (false
, "Day " , inline = "1", group = "HIGHS & LOWS MTF")
lvl_weekly = [Link] (false
, "Week " , inline = "2", group = "HIGHS & LOWS MTF")
lvl_monthly = [Link] (false
, "Month " , inline = "3", group = "HIGHS & LOWS MTF")
lvl_quartely = [Link] (false
, "Quarterly" , inline = "c", group = "HIGHS & LOWS MTF")
lvl_yearly = [Link] (false
, "Year " , inline = "4", group = "HIGHS & LOWS MTF")

// css_monday = [Link] ([Link]


, "" , inline = "q", group = "HIGHS & LOWS MTF")
css_d = [Link] ([Link]
, "" , inline = "1", group = "HIGHS & LOWS MTF")
css_w = [Link] ([Link]
, "" , inline = "2", group = "HIGHS & LOWS MTF")
css_m = [Link] ([Link]
, "" , inline = "3", group = "HIGHS & LOWS MTF")
css_q = [Link] ([Link]
, "" , inline = "c", group = "HIGHS & LOWS MTF")
css_y = [Link] ([Link]
, "" , inline = "4", group = "HIGHS & LOWS MTF")

// s_monday = [Link] ('⎯⎯⎯'


, '' , inline = 'q', group = 'HIGHS & LOWS MTF'
, options = ['⎯⎯⎯', '----', '····'])
s_d = [Link] ('⎯⎯⎯⎯'
, '' , inline = '1', group = 'HIGHS & LOWS MTF'
, options = ['⎯⎯⎯⎯', '----', '····'])
s_w = [Link] ('⎯⎯⎯⎯'
, '' , inline = '2', group = 'HIGHS & LOWS MTF'
, options = ['⎯⎯⎯⎯', '----', '····'])
s_m = [Link] ('⎯⎯⎯⎯'
, '' , inline = '3', group = 'HIGHS & LOWS MTF'
, options = ['⎯⎯⎯⎯', '----', '····'])
s_q = [Link] ('⎯⎯⎯⎯'
, '' , inline = 'c', group = 'HIGHS & LOWS MTF'
, options = ['⎯⎯⎯⎯', '----', '····'])
s_y = [Link] ('⎯⎯⎯⎯'
, '' , inline = '4', group = 'HIGHS & LOWS MTF'
, options = ['⎯⎯⎯⎯', '----', '····'])

direc = [Link]("Bullish", "Direction", ['Bullish', 'Bearish', 'Both'], group


= "ANY ALERT", inline = "asd")

var array<bool> alertinputs =


[Link](
[Link](false, "CHoCH", inline = "1", group = "ANY ALERT"),
[Link](false, "BOS", inline = "2", group = "ANY ALERT"),
[Link](false, "CHoCH Sweep", inline = "3", group = "ANY
ALERT"),
[Link](false, "BOS Sweep", inline = "4", group = "ANY ALERT"),
[Link](false, "OB Mitigated", inline = "5", group = "ANY
ALERT"),
[Link](false, "Price Inside OB", inline = "6", group = "ANY
ALERT"),
[Link](false, "FVG Mitigated", inline = "7", group = "ANY
ALERT"),
[Link](false, "Raid Found", inline = "8", group = "ANY
ALERT"),
[Link](false, "Pirce Inside FVG", inline = "9", group = "ANY
ALERT"),
[Link](false, "SFP Created", inline = "10", group = "ANY
ALERT"),
[Link](false, "Liquidity Print", inline = "11", group = "ANY
ALERT"),
[Link](false, "Sweep Area", inline = "12", group = "ANY
ALERT")
)

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

method check(array<bool> a) =>


var bool b = false

if [Link]
for i in a
if i
b := true
break

method add(array<alert> a, int i) =>


alert c = [Link](i)

c.b ? c.d + ' ' + c.n : na

method buffer(array<bool> inputs) =>


array<alert> a = [Link]<alert>()

for i = 0 to [Link]() - 1
[Link]([Link]())

array<alert> blalerts = [Link]()


array<alert> bralerts = [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
–––––––––––––––––––––––––––
------------
'//{

var store bin = [Link](


[Link]< line >()
, [Link]< label >()
, [Link]< box >()
, [Link]<linefill>()
)

alert blalert = [Link]()


alert bralert = [Link]()

var entered blobenter = [Link]()


var entered brobenter = [Link]()

var entered blfvgenter = [Link]()


var entered brfvgenter = [Link]()

var entered blarea = [Link]()


var entered brarea = [Link]()

var timer lc = [Link] ()

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]

[pdh, pdl] = [Link]([Link] , 'D' , hl() , lookahead =


barmerge.lookahead_on)
[pwh, pwl] = [Link]([Link] , 'W' , hl() , lookahead =
barmerge.lookahead_on)
[pmh, pml] = [Link]([Link] , 'M' , hl() , lookahead =
barmerge.lookahead_on)
[pqh, pql] = [Link]([Link] , '3M' , hl() , lookahead =
barmerge.lookahead_on)
[pyh, pyl] = [Link]([Link] , '12M', hl() , lookahead =
barmerge.lookahead_on)

float atr = ([Link](200) / (5/len))


bool inZone = time >= internalDate
bool Session = inZone and not inZone[1]
//}
_
='
------------
–––––––––––––––––––––––––– UTILITY
–––––––––––––––––––––––––––
------------
'//{

method txSz(string s) =>


out = switch s
"Tiny" => [Link]
"Small" => [Link]
"Normal" => [Link]
"Large" => [Link]
"Huge" => [Link]
"Auto" => [Link]
out

method lstyle(string style) =>


out = switch style
'⎯⎯⎯⎯' => line.style_solid
'----' => line.style_dashed
'····' => line.style_dotted
mtfphl(h, l ,tf ,css, pdhl_style) =>
var line hl = [Link](
na
, na
, na
, na
, xloc = xloc.bar_time
, color = css
, style = lstyle(pdhl_style)
)
var line ll = [Link](
na
, na
, na
, na
, xloc = xloc.bar_time
, color = css
, style = lstyle(pdhl_style)
)
var label lbl = [Link](
na
, na
, xloc = xloc.bar_time
, text = [Link]('P{0}L', tf)
, color = invcol
, textcolor = css
, size = [Link]
, style = label.style_label_left
)
var label hlb = [Link](
na
, na
, xloc = xloc.bar_time
, text = [Link]('P{0}H', tf)
, color = invcol
, textcolor = css
, size = [Link]
, style = label.style_label_left
)
hy = [Link](h != h[1] , h , 1)
hx = [Link](h == high , time , 1)
ly = [Link](l != l[1] , l , 1)
lx = [Link](l == low , time , 1)
if [Link]
extension = time + (time - time[1]) * 20
line.set_xy1(hl , hx , hy)
line.set_xy2(hl , extension , hy)
label.set_xy(hlb, extension , hy)
line.set_xy1(ll , lx , ly)
line.set_xy2(ll , extension , ly)
label.set_xy(lbl, extension , ly)

method IDMIDX(bool use_max, int loc) =>

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

SFPcords(string tf) =>

indexHighTF = [Link] ? 1 : 0
indexCurrTF = [Link] ? 0 : 1

[h, h1, h2, l, l1, l2, c, v, t, n, t1] =


[Link](
""
, tf
, [
high [ indexHighTF]
, high [1 + indexHighTF]
, high [2 + indexHighTF]
, low [ indexHighTF]
, low [1 + indexHighTF]
, low [2 + indexHighTF]
, close [ indexHighTF]
, volume [ indexHighTF]
, time [ indexHighTF]
, bar_index[ indexHighTF]
, time [1 + indexHighTF]
]
, lookahead = barmerge.lookahead_off)

[h[indexCurrTF], h1[indexCurrTF], h2[indexCurrTF], l[indexCurrTF],


l1[indexCurrTF], l2[indexCurrTF], c[indexCurrTF], v[indexCurrTF], t[indexCurrTF],
n[indexCurrTF], t1[indexCurrTF]]

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]
)
)

method mitigated(ob[] block) =>


if [Link]
for [i, stuff] in block
if not [Link]
switch [Link]
true =>
if obmiti == "Close" ? [Link](close, open) < [Link] :
obmiti == "Wick" ? low < [Link] : obmiti == "Avg" ? low < [Link] : na
[Link](4, [Link](true, "Bullish", "OB
Mitigated\n"))
[Link] := true
[Link] := time
if not obshowbb
[Link](i)

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)

overlap(ob[] bull, ob[] bear) =>


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)
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]() > 0 and [Link]() > 0


for i = [Link]() - 1 to 0
stuff = [Link](i)
current = [Link](0)
v = wichlap == "Recent" ? 0 : i
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]() > 0 and [Link]() > 0


for i = [Link]() - 1 to 0
stuff = [Link](i)
current = [Link](0)
v = wichlap == "Recent" ? 0 : i
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)

overlapFVG(FVG[] blFVG, FVG[] brFVG) =>


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)

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)

if [Link]() > 0 and [Link]() > 0


for i = [Link]() - 1 to 0
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)

if [Link]() > 0 and [Link]() > 0


for i = [Link]() - 1 to 0
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)

method umt(ob metric) =>


switch [Link]
1 =>
switch [Link]
1 => [Link] := [Link] + 1, [Link] := 2
2 => [Link] := [Link] + 1, [Link] := 3
3 => [Link] := [Link] + 1, [Link] := 1

-1 =>
switch [Link]
1 => [Link] := [Link] + 1, [Link] := 2
2 => [Link] := [Link] + 1, [Link] := 3
3 => [Link] := [Link] + 1, [Link] := 1

if (time - time[1]) == (time[1] - time[2])


[Link] := [Link] + (time - time[1]) * [Link]
[Link] := [Link] + (time - time[1]) * [Link]

method display(ob id, ob[] full, int i) =>


if not [Link]
[Link]([Link] (top = [Link], bottom = [Link], left = [Link],
right = time , border_color = na , bgcolor = [Link], xloc =
xloc.bar_time))
[Link]([Link] (top = [Link], bottom = [Link], left = time ,
right = time + 1 , border_color = na , bgcolor = [Link], xloc =
xloc.bar_time, extend = [Link]))

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)

var float[] lUp = [Link]<float>(1, ph)


var float[] lDn = [Link]<float>(1, pl)

var bool upallow = true


var bool dnallow = true

bool printup = false


bool printdn = false

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

if ph and upallow == false


upallow := true

if pl and dnallow == false


dnallow := 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
)
)

close <= [Link] =>


[Link](0, [Link](true, "Bearish", "CHoCH\n"))
[Link] := "choch"
[Link] := true
[Link] := 0
[Link](true, topP, idbull)
[Link] := -1
[Link] := [Link]
[Link] := na
[Link] := 2
[Link] := bar_index
[Link] := low
[Link] := [Link]
[Link] := bar_index
if draw
dw = [Link](0)
dw.x2 := time
[Link] := internal ? line.style_dashed : line.style_solid

close >= [Link] =>


[Link](0, [Link](true, "Bullish", "CHoCH\n"))
[Link] := "choch"
[Link] := true
[Link] := 0
[Link](false, btmP, idbear)
[Link] := 1
[Link] := [Link]
[Link] := na
[Link] := 2
[Link] := bar_index
[Link] := high
[Link] := [Link]
[Link] := bar_index
if draw
dw = [Link](0)
dw.x2 := time
[Link] := internal ? line.style_dashed : line.style_solid

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 not na([Link]) and draw


dw = [Link](0)
dw.x2 := time

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

close <= [Link] and not na([Link]) =>


[Link](1, [Link](true, "Bearish", "BOS\n"))
[Link] := "bos"
[Link] := [Link]
[Link] := bar_index
[Link] := true
[Link] := 0
[Link](false, btmP, idbear)
id = [Link](true, false, false)
[Link] := bar_index
[Link] := na
[Link] := high [id]
[Link] := bar_index[id]
if draw
dw = [Link](0)
dw.x2 := time
[Link] := internal ? line.style_dashed :
line.style_solid
choch = [Link](0)
choch.x1 := time [id]
choch.x2 := time
choch.y := high [id]

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 not na([Link]) and draw


dw = [Link](0)
dw.x2 := time

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]
)
)

blarea .normal := false

[Link] := bar_index

close >= [Link] and not na([Link]) =>


[Link](1, [Link](true, "Bullish", "BOS\n"))
[Link] := "bos"
[Link] := [Link]
[Link] := bar_index
[Link] := true
[Link] := 0
[Link](true, topP, idbull)
id = [Link](false, false, false)
[Link] := bar_index
[Link] := na
[Link] := low [id]
[Link] := bar_index[id]
if draw
dw = [Link](0)
dw.x2 := time
[Link] := internal ? line.style_dashed :
line.style_solid
choch = [Link](0)
choch.x1 := time [id]
choch.x2 := time
choch.y := low [id]

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
)
)

close <= [Link] =>


[Link](0, [Link](true, "Bearish", "CHoCH\n"))
[Link] := "choch"
[Link] := [Link]
[Link] := bar_index
[Link] := true
[Link] := 0
[Link](false, btmP, idbear)
id = [Link](true, false, false)
switch
na([Link]) =>
[Link] := high[id]
if draw
[Link](
[Link](
time
, time
, high
, "BOS"
, upcss
, line.style_dashed
)
)
choch = [Link](0)
choch.x1 := time[bar_index - [Link]]
=> [Link] := [Link]//high[id + 1] > high[id] ?
high[id + 1] : high[id]
[Link] := na
[Link] := low
[Link] := -1
[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.y := [Link]
choch.x2 := time
[Link] := "CHoCH"

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]
)
)

brarea .normal := false

[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

blarea .normal := true

if close < [Link]


[Link](0)

if [Link]() > 0
side = [Link](0)
if high > [Link]

if [Link] == false

brarea .normal := true


if close > [Link]
[Link](0)

if [Link] and showside


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_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 obshow and oblast > 0


if [Link]
[Link]()
[Link]()
if overlap
overlap(blob, brob)

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 [Link] and draw and [Link]() > 0 and [Link]() > 0


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_down
, 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]
)
)

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)

if showInternal and inZone


structure ims = structure(interncssup, interncssdn, showInternal, true ,
swingLimit)

color css = na

method darkcss(color css, float factor) =>

blue = color.b(css) * (1 - factor)


red = color.r(css) * (1 - factor)
green = color.g(css) * (1 - factor)

[Link](red, green, blue, 0)

if windowsis ? (bar_index > last_bar_index - mswindow) : true


css := [Link] == 1 ? swingcssup : swingcssdn
css := ([Link] == "bos" ? css : [Link](0.3))
barcolor(candlecss ? css : na)

if [Link] and showzone and (windowsis ? (bar_index > last_bar_index - mswindow) :


true)

v = close > open ? volume : -volume

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])

[Link](top = [Link], bottom = [Link](), left = [Link] - 1, right


= bar_index + 1, border_color = na, bgcolor = dnzone)
[Link](x1 = [Link], x2 = bar_index, y1 = [Link], y2 = [Link],
color = swingcssdn, style = line.style_dotted)

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](top = [Link](), bottom = [Link], left = [Link] - 1, right


= bar_index + 1, border_color = na, bgcolor = upzone)
[Link](x1 = [Link], x2 = bar_index, y1 = [Link], y2 = [Link],
color = swingcssup, style = line.style_dotted)

if [Link] > zonethresh


[Link] := false
[Link] := 0

[Link] += 1

if showMapping
mapping()

[uLIQ, dLIQ] = posLIQ()


if lvl_daily
mtfphl(pdh, pdl, 'D', css_d, s_d)

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)

var phl = [Link](


na
, na
, [Link](na , na , color = invcol , textcolor = swingcssdn , style =
label.style_label_down , size = [Link] , text = "")
, [Link](na , na , color = invcol , textcolor = swingcssup , style =
label.style_label_up , size = [Link] , text = "")
, true
, true
, true
, true
, ""
, ""
, 0
, 0
, 0
, 0
, high
, low
, 0
, 0
, 0
, 0
, 0
, 0
, na
, na
)

zhl(len)=>

upper = [Link](len)
lower = [Link](len)

var float out = 0


out := high[len] > upper ? 0 : low[len] < lower ? 1 : out[1]

top = out == 0 and out[1] != 0 ? high[len] : 0


btm = out == 1 and out[1] != 1 ? low[len] : 0

[top, btm]
[top , btm ] = zhl(zonelen)

// upphl(trend) =>

// var label lbl = [Link](


// na
// , na
// , color = invcol
// , textcolor = swingcssdn
// , style = label.style_label_down
// , size = [Link]
// )

// 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

// if high > [Link]


// [Link] := volume

// [Link] := [Link](high, [Link])


// [Link] := [Link] == high ? bar_index: [Link]

// if [Link] and showhl

// 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]
// )

// dist = [Link]([Link] / ([Link] + [Link])) * 100


// label.set_text (lbl, trend < 0
// ? "Strong High | " + [Link]([Link], [Link]) + " (" +
[Link]([Link](dist,0)) + "%)"
// : "Weak High | " + [Link]([Link], [Link]) + " (" +
[Link]([Link](dist,0)) + "%)")

// dnphl(trend) =>

// var label lbl = [Link](


// na
// , na
// , color = invcol
// , textcolor = swingcssup
// , style = label.style_label_up
// , size = [Link]
// )

// 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

// if low < [Link]


// [Link] := volume

// [Link] := [Link](low, [Link])


// [Link] := [Link] == low ? bar_index: [Link]

// if [Link] and showhl

// 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]
// )

// dist = [Link]([Link] / ([Link] + [Link])) * 100


// label.set_text (lbl, trend > 0
// ? "Strong Low | " + [Link]([Link], [Link]) + " (" +
[Link]([Link](dist,0)) + "%)"
// : "Weak Low | " + [Link]([Link], [Link]) + " (" +
[Link]([Link](dist,0)) + "%)")

// midphl() =>
// if showpdzone
// avg = [Link]([Link], [Link])

// var line l = [Link](


// y1 = avg
// , y2 = avg
// , x1 = bar_index- zonelen
// , x2 = bar_index+ 20
// , color = [Link]
// , style = line.style_solid
// )

// var label lbl = [Link](


// x = bar_index+ 20
// , y = avg
// , text = "0.5"
// , style = label.style_label_left
// , color = invcol
// , textcolor = fibcss
// , size = [Link]
// )

// if [Link] and showpdzone

// more = ([Link] + bar_index+ 20) > ([Link] + bar_index+ 20) ?


[Link] : [Link]
// line.set_xy1(l , more , avg)
// line.set_xy2(l , bar_index+ 20, avg)
// label.set_x (lbl , bar_index+ 20 )
// label.set_y (lbl , avg )
// dist = [Link]((l.get_y2() - close) / close) * 100
// label.set_text (lbl, "0.5")
// hqlzone() =>

// if [Link] and showpdzone

// var hqlzone dZone = [Link](


// [Link](
// na
// , na
// , na
// , na
// , bgcolor = [Link](swingcssdn, 70)
// , border_color = na
// )
// , na
// , [Link](
// na
// , na
// , na
// , na
// , bgcolor = [Link](swingcssup, 70)
// , border_color = na
// )

// , [Link](na, na, text = "Premium" , color = invcol, textcolor =


swingcssdn, style = label.style_label_down, size = [Link])
// , na
// , [Link](na, na, text = "Discount" , color = invcol, textcolor =
swingcssup, style = label.style_label_up , size = [Link])
// )

// [Link].set_lefttop(int([Link]([Link], [Link]))
, [Link])
// [Link].set_rightbottom(bar_index+ 20 , 0.95 *
[Link] + 0.05 * [Link])

// [Link].set_lefttop(int([Link]([Link], [Link])), 0.95 *


[Link] + 0.05 * [Link])
// [Link].set_rightbottom(bar_index+ 20
, [Link])

// [Link].set_xy( int([Link]([Link]([Link], [Link]),


int(bar_index+ 20))) , [Link])
// [Link].set_xy( int([Link]([Link]([Link], [Link]),
int(bar_index+ 20))) , [Link])

// if windowsis ? (bar_index > last_bar_index - mswindow) : true


// upphl ([Link])
// dnphl ([Link])
// midphl()
// hqlzone()

//}

// // _
='
// // ------------
// // –––––––––––––––––––––––––– 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) =>

var int idx = 0


maxBar = bar_index > lookback ? [Link](high, lookback) :
[Link](high, bar_index + 1)

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

idx := idx == 0 ? maxBar : idx

get_structure_lowest_bar(lookback) =>

var int idx = 0


minBar = bar_index > lookback ? [Link](low, lookback) :
[Link](low, bar_index + 1)

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

idx := idx == 0 ? minBar : idx

is_structure_high_broken(_highStructBreakPrice, _structureHigh,
_structureHighStartIndex, _structureDirection) =>
var bool res = false

if (_highStructBreakPrice > _structureHigh and bar_index[1] >


_structureHighStartIndex) or (_structureDirection == 1 and _highStructBreakPrice >
_structureHigh)
res := true
else
res := false

res

// Fear Value Gap


isFvgToShow = input(true, title='Display FVG', group="Fear Value Gap")
bullishFvgColor = input([Link]([Link], 50), 'Bullish FVG Color',
group="Fear Value Gap")
bearishFvgColor = input([Link]([Link], 50), 'Bearish FVG Color', group="Fear
Value Gap")
mitigatedFvgColor = input([Link]([Link], 50), 'Mitigated FVG Color',
group="Fear Value Gap")
fvgHistoryNbr = [Link](5, 'Number of FVG to show', minval=1, maxval=50)
isMitigatedFvgToReduce = input(false, title='Reduce mitigated FVG', group="Fear
Value Gap")

// Draw FVG into graph


FVGDraw(_boxes, _fvgTypes, _isFvgMitigated) =>

// Loop into all values of the array


for [index, value] in _boxes

// Processing bullish FVG


if([Link](_fvgTypes, index))

// Check if FVG has been totally mitigated


if(low <= box.get_bottom(value))
[Link](_boxes, index)
[Link](_fvgTypes, index)
[Link](_isFvgMitigated, index)
[Link](value)
else
if(low < box.get_top((value)))
box.set_bgcolor(value, mitigatedFvgColor)

// Mitigated FVG Alert


if(not([Link](_isFvgMitigated, index)))
alert("FVG has been mitigated", alert.freq_once_per_bar)
[Link](_isFvgMitigated, index, true)

// Reduce FVG if needed


if(isMitigatedFvgToReduce)
box.set_top(value, low)

box.set_right(value, bar_index)

// Processing bearish FVG


else

// Check if FVG has been mitigated


if(high >= box.get_top(value))
[Link](_boxes, index)
[Link](_fvgTypes, index)
[Link](_isFvgMitigated, index)
[Link](value)
else
if(high > box.get_bottom((value)))
box.set_bgcolor(value, mitigatedFvgColor)

// Mitigated FVG Alert


if(not([Link](_isFvgMitigated, index)))
alert("FVG has been mitigated", alert.freq_once_per_bar)
[Link](_isFvgMitigated, index, true)

// Reduce FVG if needed


if(isMitigatedFvgToReduce)
box.set_bottom(value, high)

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]

// Bullish FVG process


if(isBullishFVG and isFvgToShow)

// Add FVG into FVG's array


box _box = [Link](left=bar_index - 2, top=low[1], right=bar_index[1],
bottom=high[3], border_style=line.style_solid, border_width=1,
bgcolor=bullishFvgColor, border_color=[Link]([Link], 100))
[Link](fvgBoxes, _box)
[Link](fvgTypes, true)
[Link](isFvgMitigated, false)

// Check if FVG to show is upper than user parameter


if([Link](fvgBoxes) > fvgHistoryNbr + 1)

// Delete the FVG and its index from arrays


[Link]([Link](fvgBoxes, 0))
[Link](fvgBoxes, 0)
[Link](fvgTypes, 0)
[Link](isFvgMitigated, 0)

// Bearish FVG process


if(isBearishFVG and isFvgToShow)

// Add FVG into FVG's array


box _box = [Link](left=bar_index - 2, top=low[3], right=bar_index[1],
bottom=high[1], border_style=line.style_solid, border_width=1,
bgcolor=bearishFvgColor, border_color=[Link]([Link], 100))
[Link](fvgBoxes, _box)
[Link](fvgTypes, false)
[Link](isFvgMitigated, false)
// Check if FVG to show is upper than user parameter
if([Link](fvgBoxes) > fvgHistoryNbr + 1)

// Delete the FVG and its index from arrays


[Link]([Link](fvgBoxes, 0))
[Link](fvgBoxes, 0)
[Link](fvgTypes, 0)
[Link](isFvgMitigated, 0)

// Draw FVG
FVGDraw(fvgBoxes, fvgTypes, isFvgMitigated)
//
//
//
===================================================================================
=======

// === Dashboard with Telegram Link ===


var table myTable = [Link](position.top_center, 1, 1, border_width=1,
frame_color=[Link], bgcolor=[Link])

// Add Telegram Message to Dashboard


[Link](myTable, 0, 0, "Join Telegram @simpleforextools", bgcolor=[Link],
text_color=[Link], text_size=[Link])

You might also like