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

SMC

Smart Money Concept
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)
3K views45 pages

SMC

Smart Money Concept
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
  • Inputs: Defines the necessary inputs for the script functions, illustrating user-configurable options.
  • Overview: Introduces the script license and metadata, setting the context for the Smart Money Concepts code.
  • Setup: Covers the initialization of data structures and preparation tasks necessary for executing code logic.
  • Utility: Contains utility methods necessary for the functioning of the script, providing reusable functions and calculations.
  • Execution: Focuses on the main operations of the script, laying out execution logic and procedural implementation for the code functionalities.

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

0
at [Link]
// � BigBeluga
//
//@version=5
indicator("BigBeluga - Smart Money Concepts", "BigBeluga - Smart Money Concepts
[1.0.0]",
overlay = true,
max_bars_back = 5000,
max_boxes_count = 500,
max_labels_count = 500,
max_lines_count = 500,
max_polylines_count = 100)

plot(na)

//
MSG = "MARKET STRUCTURE"
VBG = "VOLUMETRIC ORDER BLOCKS"
MST = "Limit market structure calculation to improve memory speed time"
SLT = "[INPUT] Limit swing structure to tot bars back"
IDT = "[INPUT] Start date of the internal structure"
CST = "Color candle based on trend detection system"
OBT = "Display internal buy and sell activity"
OBD = "Show Last number of orderblock"
OBMT = "[Length] Use Length to adjust cordinate of the orderblocks\n[Full] Use
whole candle body"
_
='
------------
��������������������������� INPUTS
����������������������������
------------
'//{
bool windowsis = [Link](true, "Window", inline="kla", group=MSG)
int mswindow = [Link](5000, "", tooltip=MST,group=MSG, inline="kla",
minval=1000)

bool showSwing = [Link](true, "Swing", inline="scss", group=MSG)


int swingLimit = [Link](100, "", tooltip=SLT, inline="scss", group=MSG,
minval=10, maxval=200)

color swingcssup = [Link](#089981, "", inline="scss", group=MSG)


color swingcssdn = [Link](#f23645, "", inline="scss", group=MSG)

bool showMapping = [Link](false, "Mapping Structure", inline="mapping",


group=MSG)
string mappingStyle = [Link]("----", "", options=["????", "----"],
inline="mapping", group=MSG)
color mappingcss = [Link]([Link], "", tooltip="Display Mapping
Structure", inline="mapping", group=MSG)
bool candlecss = [Link](false, "Color Candles", tooltip=CST, group=MSG,
inline="txt")
string mstext = [Link]("Tiny", "", options=["Tiny", "Small", "Normal",
"Large", "Huge"],
inline="txt", group=MSG)
string msmode = [Link]("Adjusted Points", "Algorithmic Logic",
options=["Extreme Points", "Adjusted Points"]
, inline="node", group=MSG)

int mslen = [Link](5, "", inline="node", group=MSG, minval=2)


bool showhl = [Link](false, "Strong/Weak HL", "Display Volumetric
Strong/Weak High and low", "hl", MSG)
bool buildsweep = [Link](true, "Build Sweep (x)", "Build sweep on market
structure", "znc", MSG)
bool msbubble = [Link](true, "Bubbles", tooltip="Display Circle Bubbles",
inline="bubbles", group=MSG)

bool obshow = [Link](true, "Show Last", tooltip=OBD, group=VBG,


inline="obshow")
int oblast = [Link](5, "", group=VBG, inline="obshow", minval=0)
color obupcs = [Link]([Link](#089981, 90), "", inline="obshow",
group=VBG)
color obdncs = [Link]([Link](#f23645, 90), "", inline="obshow",
group=VBG)
bool obshowactivity = [Link](true, "Show Buy/Sell Activity", inline="act",
group=VBG, tooltip=OBT)
color obactup = [Link]([Link](#089981, 50), "", inline="act",
group=VBG)
color obactdn = [Link]([Link](#f23645, 50), "", inline="act",
group=VBG)
obshowbb = [Link](false, "Show Breakers", inline="bb", group=VBG,
tooltip="Display Breakers")
color bbup = [Link]([Link](#089981, 100), "", inline="bb",
group=VBG)
color bbdn = [Link]([Link](#f23645, 100), "", inline="bb",
group=VBG)
obmode = [Link]("Length", "Construction", options=["Length", "Full"],
tooltip=OBMT, inline="atr", group=VBG)
len = [Link](5, "", inline="atr", group=VBG, minval=1)
obmiti = [Link]("Close", "Mitigation Method", options=["Close", "Wick",
"Avg"],
tooltip="Mitigation method for when to trigger order blocks", group=VBG)
obtxt = [Link]("Normal", "Metric Size", options=["Tiny", "Small",
"Normal", "Large", "Huge", "Auto"],
tooltip="Order block Metrics text size", inline="txt", group=VBG)
showmetric = [Link](true, "Show Metrics", group=VBG)
showline = [Link](true, "Show Mid-Line", group=VBG)
overlap = [Link](true, "Hide Overlap", group=VBG, inline="ov")
wichlap = [Link]("Recent", "", options=["Recent", "Old"], inline="ov",
group=VBG)

fvg_enable = [Link](false, "", inline="1", group="FAIR VALUE GAP",


tooltip="Display fair value gap")
what_fvg = [Link]("FVG", "", inline="1", group="FAIR VALUE GAP",
tooltip="Display fair value gap",
options=["FVG", "Breakers"])
fvg_num = [Link](5, "Show Last", inline="1a", group="FAIR VALUE GAP",
tooltip="Number of fvg to show", minval=0)
fvg_upcss = [Link]([Link](#089981, 80), "", inline="1", group="FAIR
VALUE GAP")
fvg_dncss = [Link]([Link](#f23645, 80), "", inline="1", group="FAIR
VALUE GAP")
fvgbbup = [Link]([Link](#089981, 100), "", inline="1", group="FAIR
VALUE GAP")
fvgbbdn = [Link]([Link](#f23645, 100), "", inline="1", group="FAIR
VALUE GAP")
fvg_src = [Link]("Close", "Mitigation",
inline="3",
group="FAIR VALUE GAP",
tooltip="[Close] Use the close of the body as trigger\n\n[Wick] Use the extreme
point of the body as trigger",
options=["Close", "Wick", "Avg"])
fvgthresh = [Link](0, "Threshold", tooltip="Filter out non significative
FVG", group="FAIR VALUE GAP",
inline="asd", minval=0, maxval=2, step=0.1)
fvgoverlap = [Link](true, "Hide Overlap", "Hide overlapping FVG", group="FAIR
VALUE GAP")
fvgline = [Link](true, "Show Mid-Line", group="FAIR VALUE GAP")
fvgextend = [Link](false, "Extend FVG", group="FAIR VALUE GAP")
dispraid = [Link](false, "Display Raids", inline="raid", group="FAIR VALUE
GAP")

dispSFP = [Link](false, "Show Last", tooltip="Display Swing Failure


Pattern", inline="sfp", group="Swing Failure Pattern")
sfpshow = [Link](5, "", inline="sfp", group="Swing Failure Pattern",
minval=0)
showdev = [Link](false, "Deviation Area", inline="dev", group="Swing
Failure Pattern")
brsfpcs = [Link]([Link], "", inline="sfp", group="Swing Failure
Pattern")
blsfpcs = [Link]([Link], "", inline="sfp", group="Swing Failure
Pattern")
spfuselen = [Link](true, "Length", inline="sfx", group="Swing Failure
Pattern")
sfplen = [Link](5, "", tooltip="Adjust SFP", group="Swing Failure
Pattern", inline="sfx", minval=0)
sfpfilter = [Link]("None", "Filtering", options=["None", "Trend
Following", "Counter Trade"], tooltip="Filtering for SFP", inline="sfp1",
group="Swing Failure Pattern")
sfpthresh = [Link](1, "Threshold", options=[0.1, 0.2, 0.3, 0.4, 0.5, 0.6,
0.7, 0.8, 0.9, 1, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2], tooltip="Volume
Threshold for SFP", inline="sfp2", group="Swing Failure Pattern")
devstyle = [Link]("????", "", options=["????", "----"], inline="dev",
group="Swing Failure Pattern")
devcss = [Link]([Link], "", tooltip="Display deviation projection
for SFP", inline="dev", group="Swing Failure Pattern")
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")

ehlshow = [Link](true, "Equal H&L", tooltip="Display EQH and EQL",


inline="ehl", group="LIQUIDITY CONCEPTS")
ehlmode = [Link]("Short-Term", "", options=["Short-Term", "Mid-Term",
"Long-Term"], inline="ehl", group="LIQUIDITY CONCEPTS")
ehldowncs = [Link](#6fad6f, "", inline="ehl", group="LIQUIDITY CONCEPTS")
ehlupcs = [Link](#ce636d, "", inline="ehl", group="LIQUIDITY CONCEPTS")
liqprint = [Link](true, "Liquidity Prints", "Show Liquidity Grabs on the
chart", inline="print", group="LIQUIDITY CONCEPTS")
printupcs = [Link]([Link], "", inline="print", group="LIQUIDITY
CONCEPTS")
printdowncs = [Link]([Link], "", inline="print", group="LIQUIDITY
CONCEPTS")
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")

//}
_
='
------------
��������������������������� 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>()
)

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

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

//}
_
='
------------
��������������������������� 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

ghl() => [high[2], low[2], close[1], open[1], close, open, high, low, high[1],
low[1], [Link](200)]

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

SFPData() => [high, high[1] , high[2] , low, low[1] , low[2] , close, volume, time,
bar_index , time[1]]

SFPcords() =>
RealTF = [Link] ? 0 : 1
[h, h1, h2, l, l1, l2, c, v, t, n, t1] = SFPData()

[h[RealTF], h1[RealTF], h2[RealTF], l[RealTF], l1[RealTF], l2[RealTF],


c[RealTF], v[RealTF], t[RealTF], n[RealTF], t1[RealTF]]
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] := 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] := 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)) + "%)"
)
)

method dispFVG(FVG fvg, int i, bool bull) =>


ext = fvgextend ? [Link] : [Link]
if not [Link]
[Link](box .new(top = [Link], bottom = [Link], left = [Link]
, right = time , border_color = na , bgcolor = bull ? fvg_upcss
: fvg_dncss , xloc = xloc.bar_time, extend = ext))
if fvgline
[Link]([Link](x1 = [Link], x2 = time , y1 =
[Link]([Link], [Link]), y2 = [Link]([Link], [Link]), xloc = xloc.bar_time,
color = [Link](bull ? fvg_upcss : fvg_dncss, 0) , extend =
ext))
if dispraid
[Link]([Link](x1 = [Link], x2 = fvg.raidx2, y1 =
[Link], y2 = [Link], xloc = xloc.bar_time, color = [Link]))
[Link]([Link](x = int([Link]([Link], fvg.raidx2)), y
= [Link], text = "x", xloc = xloc.bar_time, textcolor = [Link], style = bull
? label.style_label_up : label.style_label_down, size = [Link], color =
#ffffff00))

else
[Link](box .new(top = [Link] , bottom = [Link], left = [Link]
, right = [Link] , border_color = na
, bgcolor = bull ? fvg_upcss : fvg_dncss, xloc = xloc.bar_time))
[Link](box .new(top = [Link] , bottom = [Link], left = [Link]
, right = time , border_color = bull ? fvg_dncss : fvg_upcss
, bgcolor = bull ? fvg_dncss : fvg_upcss, xloc = xloc.bar_time, extend = ext))
if fvgline
[Link]([Link](x1 = [Link] , x2 = [Link] , y1 =
[Link]([Link], [Link]), y2 = [Link]([Link], [Link]), color = [Link](bull
? fvg_upcss : fvg_dncss, 0) , xloc =
xloc.bar_time))
[Link]([Link](x1 = [Link], x2 = time , y1 =
[Link]([Link], [Link]), y2 = [Link]([Link], [Link]), color = [Link](bull
? fvg_dncss : fvg_upcss, 0) , xloc =
xloc.bar_time, extend = ext, style = line.style_dashed))
//}
_
='
------------
��������������������������� 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]

upallow := false
printup := true

if low < [Link](0) and close > [Link](0) and dnallow and low < low[1]

dnallow := false
printdn := true

if ph and upallow == false


upallow := true

if pl and dnallow == false


dnallow := true

[printup, printdn]

dEHL() =>
var equalbuild[] bleqal = [Link]<equalbuild>()
var equalbuild[] breqal = [Link]<equalbuild>()
var equalname [] blname = [Link]<equalname >()
var equalname [] brname = [Link]<equalname >()

int pos = 2
float thresh = 0.1
switch ehlmode
"Short-Term" => pos := 2, thresh := 0.1
"Mid-Term" => pos := 6, thresh := 0.25
"Long-Term" => pos := 10, thresh := 0.5

var ehl w = [Link] (0 , 0 , 0 , 0)


float top = ta .pivothigh(high, pos, pos)
float btm = ta .pivotlow (low , pos, pos)
float atr = ta .atr ( 200 )

switch
top =>
mx = [Link](top, [Link])
mn = [Link](top, [Link])
switch
mx < mn + atr * thresh =>
[Link](
[Link](
w.t
, [Link]
, bar_index - pos
, top
, ehlupcs
, line.style_dotted
)
)
[Link](
[Link](
int([Link](bar_index - pos, w.t))
, top
, "EQH"
, ehlupcs
, label.style_label_down
)
)
[Link] := top
w.t := bar_index - pos

btm =>
mx = [Link](btm, [Link])
mn = [Link](btm, [Link])
switch
mn > mx - atr * thresh =>
[Link](
[Link](
w.b
, [Link]
, bar_index - pos
, btm
, ehldowncs, line.style_dotted
)
)
[Link](
[Link](
int([Link](bar_index - pos, w.b))
, btm
, "EQL"
, ehldowncs
, label.style_label_up
)
)
[Link] := btm
w.b := bar_index - pos

if [Link]
if [Link]() > 0
for i = 0 to [Link]() - 1
draw = [Link](i)
labe = [Link](i)
if i < 10
[Link](
[Link](
draw.x1
, draw.y1
, draw.x2
, draw.y2
, color = [Link]
, style = [Link]
)
)
[Link](
[Link](
x = labe.x
, y = labe.y
, color = #ffffff00
, style = [Link]
, textcolor = [Link]
, size = [Link]()
, text = [Link]
)
)

if [Link]() > 0
for i = 0 to [Link]() - 1
draw = [Link](i)
labe = [Link](i)
if i < 10
[Link](
[Link](
draw.x1
, draw.y1
, draw.x2
, draw.y2
, color = [Link]
, style = [Link]
)
)
[Link](
[Link](
x = labe.x
, y = labe.y
, color = #ffffff00
, style = [Link]
, textcolor = [Link]
, size = [Link]()
, text = [Link]
)
)

method SFP(structure ms) =>

h = high
h1 = high[1]
h2 = high[2]
l = low
l1 = low [1]
l2 = low [2]
c = close
v = volume
t = time
n = bar_index
t1 = time[1]
string size = [Link]()
bool vol = ([Link](v, 21) * sfpthresh) < v ? true : false
bool blPrint = true
bool brPrint = true

switch sfpfilter
"Trend Following" =>
switch [Link]
1 => blPrint := true , brPrint := false
-1 => blPrint := false , brPrint := true

"Counter Trade" =>


switch [Link]
1 => blPrint := false , brPrint := true
-1 => blPrint := true , brPrint := false

=> na

var SFP [] BLsfp = [Link]< SFP >()


var SFP [] BRsfp = [Link]< SFP >()
float [] lg = [Link]< float >()
int [] tn = [Link]< int >()
float [] ac = [Link]< float >()
var sfpbuildlbl [] BLlb = [Link]<sfpbuildlbl >()
var sfpbuildlbl [] BRlb = [Link]<sfpbuildlbl >()
var sfpbuildline[] BLln = [Link]<sfpbuildline>()
var sfpbuildline[] BRln = [Link]<sfpbuildline>()

if l > l1 and l1 < l2 and vol[1]


[Link]()
if spfuselen
for i = 1 to sfplen
[Link](l[i])
[Link](t[i])
[Link](h[i])

[Link](
[Link](
[Link]()
, [Link]([Link]([Link]()))
, [Link]([Link]([Link]()))
)
)

if [Link]() != l1
[Link](
[Link](
l1
, t1
, h1
)
)

else
[Link](
[Link](
l1
, t1
, h1
)
)

if h < h1 and h1 > h2 and vol[1]


[Link]()
if spfuselen
for i = 1 to sfplen
[Link](h[i])
[Link](t[i])
[Link](l[i])

[Link](
[Link](
[Link]()
, [Link]([Link]([Link]()))
, [Link]([Link]([Link]()))
)
)

if [Link]() != h1
[Link](
[Link](
h1
, t1
, l1
)
)

else
[Link](
[Link](
h1
, t1
, l1
)
)

if [Link]() > 0 and blPrint


for i = [Link]() - 1 to 0
sfp = [Link](i)
switch
c < sfp.y =>
[Link](i)

l < sfp.y and c > sfp.y =>


if vol

[Link](
[Link](
time
, (low < sfp.y ? low : sfp.y)
, label.style_label_up
, blsfpcs, "?\nSFP"
)
)
[Link](
[Link](
[Link]
, time
, sfp.y
, blsfpcs
, [Link]
, bar_index
)
)

[Link](i)

else
[Link](i)

if [Link]() > 0 and brPrint


for i = [Link]() - 1 to 0
sfp = [Link](i)
switch
c > sfp.y =>
[Link](i)

h > sfp.y and c < sfp.y =>


if vol

[Link](
[Link](
time
, (high > sfp.y ? high : sfp.y)
, label.style_label_down
, brsfpcs
, "SFP\n?"
)
)
[Link](
[Link](
[Link]
, time
, sfp.y
, brsfpcs
, [Link]
, bar_index
)
)

[Link](i)

else
[Link](i)

if [Link]
if sfpshow > 0 and [Link]() > 0
for i = 0 to [Link](sfpshow - 1, [Link]() - 1)
x = [Link](i)
[Link](
[Link](
x = x.x
, y = x.y
, text = [Link]
, color = #ffffff00
, style = [Link]
, size = size
, textcolor = [Link]
, xloc = xloc.bar_time
)
)

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


for i = 0 to [Link](sfpshow - 1, [Link]() - 1)
x = [Link](i)
[Link](
[Link](
x = x.x
, y = x.y
, text = [Link]
, color = #ffffff00
, style = [Link]
, size = size
, textcolor = [Link]
, xloc = xloc.bar_time
)
)

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


for i = 0 to [Link](sfpshow - 1, [Link]() - 1)
x = [Link](i)
[Link](
[Link](
x1 = x.x1
, x2 = x.x2
, y1 = x.y
, y2 = x.y
, color = [Link]
, style = line.style_solid
, xloc = xloc.bar_time
)
)

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


for i = 0 to [Link](sfpshow - 1, [Link]() - 1)
x = [Link](i)
[Link](
[Link](
x1 = x.x1
, x2 = x.x2
, y1 = x.y
, y2 = x.y
, color = [Link]
, style = line.style_solid
, xloc = xloc.bar_time
)
)

if sfpshow > 0 and [Link]() > 0 and [Link]() > 0 and showdev
max = [Link]([Link](0).loc, [Link](0).loc)
use = [Link]([Link](0).loc, [Link](0).loc) == [Link](0).loc ?
[Link](0) : [Link](0)
bull = [Link]([Link](0).loc, [Link](0).loc) == [Link](0).loc ?
true : false
switch bull
false =>
[Link]([Link](x1 = use.x1, x2 = time, y1 = [Link]
- 4.0 * (use.y - [Link]), y2 = [Link] - 4.0 * (use.y - [Link]), xloc =
xloc.bar_time, color = chart.fg_color, style = [Link]()))
[Link]([Link](x1 = use.x1, x2 = time, y1 = [Link]
- 2.0 * (use.y - [Link]), y2 = [Link] - 2.0 * (use.y - [Link]), xloc =
xloc.bar_time, color = devcss, style = [Link]()))
[Link]([Link](x1 = use.x1, x2 = time, y1 = [Link]
- 2.5 * (use.y - [Link]), y2 = [Link] - 2.5 * (use.y - [Link]), xloc =
xloc.bar_time, color = devcss, style = [Link]()))
if devfill
[Link](
[Link](
[Link](0)
, [Link](1)
, color = [Link](devcss, 90)
)
)

if devlvl
[Link]([Link](x = use.x1, y = [Link] + 4.0 *
([Link] - use.y), text = [Link](4.0 * 100) + "%" + " (" +
[Link]([Link]([Link] + 4.0 * ([Link] - use.y), 2)) + ")", style =
label.style_label_right, textcolor = chart.fg_color, color = #ffffff00, size =
[Link](), xloc = xloc.bar_time))
[Link]([Link](x = use.x1, y = [Link] + 2.0 *
([Link] - use.y), text = [Link](2.0 * 100) + "%" + " (" +
[Link]([Link]([Link] + 2.0 * ([Link] - use.y), 2)) + ")", style =
label.style_label_right, textcolor = devcss , color = #ffffff00, size =
[Link](), xloc = xloc.bar_time))
[Link]([Link](x = use.x1, y = [Link] + 2.5 *
([Link] - use.y), text = [Link](2.5 * 100) + "%" + " (" +
[Link]([Link]([Link] + 2.5 * ([Link] - use.y), 2)) + ")", style =
label.style_label_right, textcolor = devcss , color = #ffffff00, size =
[Link](), xloc = xloc.bar_time))

true =>
[Link]([Link](x1 = use.x1, x2 = time, y1 = [Link]
+ 4.0 * ([Link] - use.y), y2 = [Link] + 4.0 * ([Link] - use.y), xloc =
xloc.bar_time, color = chart.fg_color, style = [Link]()))
[Link]([Link](x1 = use.x1, x2 = time, y1 = [Link]
+ 2.0 * ([Link] - use.y), y2 = [Link] + 2.0 * ([Link] - use.y), xloc =
xloc.bar_time, color = devcss, style = [Link]()))
[Link]([Link](x1 = use.x1, x2 = time, y1 = [Link]
+ 2.5 * ([Link] - use.y), y2 = [Link] + 2.5 * ([Link] - use.y), xloc =
xloc.bar_time, color = devcss, style = [Link]()))
if devfill
[Link](
[Link](
[Link](0)
, [Link](1)
, color = [Link](devcss, 90)
)
)
if devlvl
[Link]([Link](x = use.x1, y = [Link] + 4.0 *
([Link] - use.y), text = [Link](4.0 * 100) + "%" + " (" +
[Link]([Link]([Link] + 4.0 * ([Link] - use.y), 2)) + ")", style =
label.style_label_right, textcolor = chart.fg_color, color = #ffffff00, size =
[Link](), xloc = xloc.bar_time))
[Link]([Link](x = use.x1, y = [Link] + 2.0 *
([Link] - use.y), text = [Link](2.0 * 100) + "%" + " (" +
[Link]([Link]([Link] + 2.0 * ([Link] - use.y), 2)) + ")", style =
label.style_label_right, textcolor = devcss, color = #ffffff00, size =
[Link](), xloc = xloc.bar_time))
[Link]([Link](x = use.x1, y = [Link] + 2.5 *
([Link] - use.y), text = [Link](2.5 * 100) + "%" + " (" +
[Link]([Link]([Link] + 2.5 * ([Link] - use.y), 2)) + ")", style =
label.style_label_right, textcolor = devcss, color = #ffffff00, size =
[Link](), xloc = xloc.bar_time))

dFVG() =>
[h2, l2, c1, o1, c, o, h, l, h1, l1, fvatr] = ghl()
var FVG[] blFVG = [Link]<FVG>()
var FVG[] brFVG = [Link]<FVG>()
bool upfvg = false
bool dnfvg = false
float blth = l1 + (fvatr[1] * fvgthresh)
float brth = h1 - (fvatr[1] * fvgthresh)

cc = [Link]()

switch
what_fvg == "FVG" or what_fvg == "Breakers" =>
if l > h2 and cc and c1 > blth
upfvg := true

if l2 > h and cc and c1 < brth


dnfvg := true

if upfvg[1]
if [Link]() > 0
fvg = [Link](0)
if [Link] == true and [Link] == false
[Link] := true
[Link] := na
fvg.raidx2 := na
[Link] := na
[Link] := #ffffff00

[Link](
[Link](
l [1]
, h2 [1]
, time[3]
, false
, na
)
)
if dnfvg[1]
if [Link]() > 0
fvg = [Link](0)
if [Link] == true and [Link] == false
fvg = [Link](0)
[Link] := true
[Link] := true
[Link] := na
fvg.raidx2 := na
[Link] := na
[Link] := #ffffff00

[Link](
[Link](
l2 [1]
, h [1]
, time[3]
, false
, na
)
)

if [Link]() > 0
for [i, fvg] in blFVG
if not [Link]
if fvg_src == "Close" ? [Link](c, o) < [Link] : fvg_src ==
"Wick" ? l < [Link] : fvg_src == "Avg" ? l < [Link]([Link], [Link]) : na

[Link] := true
[Link] := time

if what_fvg == "FVG"
[Link](i)

else
if (fvg_src == "Close" ? [Link](c, o) > [Link] : fvg_src ==
"Wick" ? h > [Link] : fvg_src == "Avg" ? h > [Link]([Link], [Link]) : na) and
what_fvg == "Breakers"
[Link](i)

if [Link]() > 0
for [i, fvg] in brFVG
if not [Link]
if (fvg_src == "Close" ? [Link](c, o) > [Link] : fvg_src ==
"Wick" ? h > [Link] : fvg_src == "Avg" ? h > [Link]([Link], [Link]) : na)

[Link] := true
[Link] := time

if what_fvg == "FVG"
[Link](i)
else
if (fvg_src == "Close" ? [Link](c, o) < [Link] : fvg_src ==
"Wick" ? l < [Link] : fvg_src == "Avg" ? l < [Link]([Link], [Link]) : na) and
what_fvg == "Breakers"
[Link](i)

if fvgoverlap
overlapFVG(blFVG, brFVG)

if dispraid
for [i, fvg] in blFVG
if not [Link] and not [Link]
if low < [Link] and close > [Link]
[Link] := true
[Link] := time
fvg.raidx2 := time
[Link] := low
[Link] := chart.fg_color
else
if low <= [Link] and [Link] == false and not [Link]

[Link] := true
fvg.raidx2 := time
else
if [Link] == false and not [Link]
fvg.raidx2 := time

for [i, fvg] in brFVG


if not [Link] and not [Link]
if high > [Link] and close < [Link] and not [Link]
[Link] := true
[Link] := time
[Link] := high
fvg.raidx2 := time
[Link] := chart.fg_color
else
if high >= [Link] and [Link] == false and not [Link]

[Link] := true
fvg.raidx2 := time
else
if [Link] == false and not [Link]
fvg.raidx2 := time

if [Link]
if [Link]() > 0 and fvg_num > 0
for i = 0 to [Link](fvg_num - 1, [Link]() - 1)
fvg = [Link](i)
dispFVG(fvg, i, true)

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


for i = 0 to [Link](fvg_num - 1, [Link]() - 1)
fvg = [Link](i)
dispFVG(fvg, i, false)

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] := 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] := 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] := "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] := "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] := 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] := "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]

switch
high >= [Link] and close <= [Link] and buildsweep =>

[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] := "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] := 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] := "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]

switch
low <= [Link] and close >= [Link] and buildsweep =>

[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] := "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 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]

if [Link] == false

[Link] := true
else
if high > [Link]
if [Link] == false

[Link] := true

if [Link]() > 0
ob = [Link](0)
if not [Link]
if high > [Link]

if [Link] == false

[Link] := true
else
if low < [Link]
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] := 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] := 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 fvg_enable
dFVG()

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


if dispSFP
[Link]()

if ehlshow
dEHL()
if showMapping
mapping()

[uLIQ, dLIQ] = posLIQ()

plotcandle(high, high, [Link](close, open), [Link](close, open), color = na,


wickcolor = na, bordercolor = uLIQ and liqprint ? printupcs : na)
plotcandle(low , low , [Link](close, open), [Link](close, open), color = na,
wickcolor = na, bordercolor = dLIQ and liqprint ? printdowncs : na)

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
)

You might also like