Re: MT5 Smart Money Concept
2The Supply and Demand Order Blocks
coder: Issam Kassas
released date: October 22, 2023
The Supply and Demand Order Blocks:
The "Supply and Demand Order Blocks" indicator is a sophisticated tool based on Smart Money Concepts, fundamental to forex technical analysis. It focuses on identifying supply and demand zones, crucial areas where institutional traders leave significant footprints. The supply zone, indicating sell orders, and the demand zone, indicating buy orders, help traders anticipate potential reversals or slowdowns in price movements. This indicator employs a clever algorithm, combining Breakout of Structure (BoS) and Fair Value Gap (FVG) components. BoS detects market disruptions, pinpointing potential order blocks, while FVG considers fair value gaps to enhance precision. The tool provides a visual representation of these conditions, aiding traders in decision-making by highlighting potential order blocks and offering insights into market dynamics and turning points. Its user-friendly design makes it accessible to traders with various technical expertise levels, offering a comprehensive solution for advanced analysis.
Features:
Smart Money Concepts: Based on institutional trading strategies.
Supply and Demand Zones: Identifies sell and buy order blocks.
Custom order block drawing types.
Algorithm Sophistication: BoS detects market disruptions and FVG considers fair value gaps.
Visual Representation: Highlights potential order blocks on charts.
User-Friendly: Accessible for various expertise levels.
Comprehensive Analysis: Integrates BoS and FVG for insight.
Informed Decision-Making: Aids in anticipating reversals and slowdowns.
Re: MT5 Smart Money Concept
3Smart Money Concept
- These users thanked the author Banzai for the post (total 3):
- Mickey Abi, JAHVARIE1, Momentum
Re: MT5 Smart Money Concept
4Code: Select all
_ ___ _ _____ _______ __ ____ __ __ ____
| |/ / | | | ____| ___\ \/ / / ___|| \/ |/ ___|
| ' /| | | | _| | |_ \ / \___ \| |\/| | |
| . \| |_| | |___| _| / \ ___) | | | | |___
|_|\_\\___/|_____|_| /_/\_\ |____/|_| |_|\____|
Code: Select all
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Kudakwashe Courage Masangudza
////////////////////////////////////////
// Commercial Use Protection Notice:
// This code is protected for commercial use. Any unauthorized reproduction, distribution, or modification
// of this code for commercial purposes is strictly prohibited and may result in legal actions.
// All rights reserved to @Kudakwashe
// Contacts:
// Whatsapp : +263 774649453
////////////////////////////////////////
//@version=5
indicator("stracturre.x", "KUEFX SMC", true,
max_bars_back = 5000, max_labels_count = 500, max_lines_count = 500)
//#region variable declaration
var bool mnUp = na
var bool mnDn = na
float mnStrc = na
var top = high
var bot = low
var puUp = high
var puDn = low
var L = low
var H = high
var idmB = low
var idmS = high
var lastH = high
var lastL = low
var lastHH = high
var lastLL = low
//bar indexes
var int puUpbar = na
var int puDnbar = na
var int idmB_bar = na
var int idmS_bar = na
var int Hbar = bar_index
var int Lbar = bar_index
var int lastHbar = bar_index
var int lastLbar = bar_index
var int lastHHbar = bar_index
var int lastLLbar = bar_index
//structure confirmaions
lastHL = math.max(Hbar, Lbar)
var bool isBosUp = 0
var bool isBosDn = 0
var bool isCocUp = 1
var bool isCocDn = 1
//color
color transp = color.new(#59ff62, 5)
//drawing options
equalHL = input.bool(0,"Use equal H/L", "To calculate valid pullbacks and minor structure", group = "Calculation method")
showHL = input.bool(1, "Mark H/L", group = "H/L marking options")
HLcolor = input.color(color.rgb(0, 0, 0), "H/L color", group = "H/L marking options")
showMn = input.bool(0, "Mark out internal structure", group = "Internal structue")
puUpco = input.color(color.rgb(255, 82, 82) , "High pivots", inline = "mnco", group = "Internal structue")
puDnco = input.color(color.green, "Low pivots" , inline = "mnco", group = "Internal structue")
showBC = input.bool(1, "Mark BoS/ChoCH", group = "BoS/Choch")
bull = input.color(color.green, "Bull color", inline = "BSclor" ,group = "BoS/Choch")
bear = input.color(color.red , "Bear color", inline = "BSclor" ,group = "BoS/Choch")
showbarcolor = input.bool(0,"Bar color", group = "Bar color")
showSCOB = input.bool(1, "Show SCOB pattern", group = "Bar color")
scobUp = input.color(color.aqua , "Bullish SCOB", inline = "scob" , group = "Bar color")
scobDn = input.color(color.fuchsia, "Bearish SCOB", inline = "scob" , group = "Bar color")
showIDM = input.bool(1,"Mark previous IDM", group = "IDM")
showliveIDM = input.bool(1,"Mark live IDM", group = "IDM")
idmColor = input.color(color.rgb(21, 6, 230), "IDM color", group = "IDM")
var label lv_lbl = na
var line lv_line = na
showSw = input.bool(1, "Show H/L sweeping lines", group = "H/L sweeps")
markX = input.bool(1, 'Mark "X"', group = "H/L sweeps")
swColor = input.color(color.white, "Sweeping line color", group = "H/L sweeps")
//max line length
maxlen = bar_index - 500
//#endregion
//#region drawing functions
mnMark(bool UD) =>
if showMn
label.new(
x = UD ? puUpbar : puDnbar,
y = UD ? puUp : puDn,
yloc = UD ? yloc.abovebar : yloc.belowbar,
text = "",
color = UD ? puUpco : puDnco,
style = UD ? label.style_arrowdown : label.style_arrowup,
size = size.tiny
)
BoS_ChoCh(bool B_C, bool UpDn) =>
[HLbarid, BCprc, BCcolor, BCtxt, BCstyle] = switch
B_C == 1 and UpDn == 1 => [lastHHbar, lastHH, bull, "BoS" , label.style_label_down]
B_C == 0 and UpDn == 1 => [lastHbar , lastH , bull, "ChoCh", label.style_label_down]
B_C == 0 and UpDn == 0 => [lastLbar , lastL , bear, "ChoCh", label.style_label_up ]
B_C == 1 and UpDn == 0 => [lastLLbar, lastLL, bear, "BoS" , label.style_label_up ]
HLbarid := HLbarid < maxlen ? maxlen : HLbarid
if showBC
line.new(HLbarid, BCprc, bar_index, BCprc, color = BCcolor, style = line.style_dashed)
label.new(
int( math.avg(bar_index,HLbarid) ), BCprc
,BCtxt
,color = transp
,style = BCstyle
,textcolor = BCcolor
)
cfHL(bool ifHL) =>
[ifHLbarid, HLprc] = switch
ifHL =>
if high > H
[bar_index, high]
else
[Hbar, H]
=>
if low < L
[bar_index, low]
else
[Lbar, L]
ifHL_txt = if ifHL
if H == lastHH
"HH"
else
"LH"
else
if L == lastLL
"LL"
else
"HL"
cfHLStyle = ifHL ? label.style_label_down : label.style_label_up
if showHL
label.new(ifHLbarid,HLprc,ifHL_txt, color = transp, textcolor = HLcolor, style = cfHLStyle)
sweep(bool swHL, bool swHrLr) =>
swStyle = swHL ? label.style_label_down : label.style_label_up
[swHLbarid, swprc, swHL_txt] = switch
swHL == 1 and swHrLr == 1 => [lastHHbar, lastHH, "HH"]
swHL == 1 and swHrLr == 0 => [lastHbar , lastH , "LH"]
swHL == 0 and swHrLr == 1 => [lastLbar , lastL , "HL"]
swHL == 0 and swHrLr == 0 => [lastLLbar, lastLL, "LL"]
swHLbarid := swHLbarid < maxlen ? maxlen : swHLbarid
//draw sweeping line
if showSw
line.new(swHLbarid,swprc,bar_index,swprc,color = swColor,style = line.style_dotted)
if markX
label.new(int(math.avg(bar_index,swHLbarid)),swprc, "X", color = transp, textcolor = swColor, style = swStyle, size = size.small)
IDM(bool BS) =>
IDMid = BS ? idmB_bar : idmS_bar
idmprc = BS ? idmB : idmS
idmStyle = BS ? label.style_label_up : label.style_label_down
IDMid := IDMid < maxlen ? maxlen : IDMid
//draw idm takeout line
if showIDM
line.new(IDMid,idmprc,bar_index,idmprc,color = idmColor,style = line.style_dotted)
label.new(int(math.avg(bar_index,IDMid)),idmprc, "IDM", color = transp, textcolor = idmColor, style = idmStyle,size = size.small)
//Bar color
ba_color = if showSCOB
if low[1] == puDn and low >= low[1] and close > high[1] and close[1] > low[2]
scobUp
else if high[1] == puUp and high <= high[1] and close < low[1] and close[1] < high[2]
scobDn
else if showbarcolor
isCocUp?bull:bear
else
na
barcolor(ba_color,-1)
//#endregion
//#region structure mapping
//update IDM
if (high > H or (high == H and equalHL)) and low > idmB
if low <= puDn
idmB := low
idmB_bar := bar_index
else
idmB := puDn
idmB_bar := puDnbar
if (low < L or (low == L and equalHL)) and high < idmS
if high >= puUp
idmS := high
idmS_bar := bar_index
else
idmS := puUp
idmS_bar := puUpbar
//Check for IDM and ChoCh
if isCocUp and lastHL != Lbar
if low < idmB
if idmB != lastL
IDM(1)
isBosUp := 0
lastH := H
lastHbar := Hbar
lastHH := H
lastHHbar := Hbar
cfHL(1)
L := low
Lbar := bar_index
else if lastH != lastHH and high > lastH
cfHL(0)
isCocDn := 0
isBosDn := 0
if close > lastH
BoS_ChoCh(0,1)
isCocUp := 1
else
sweep(1,0)
if isCocDn and lastHL != Hbar
if high > idmS
if idmS != lastH
IDM(0)
isBosDn := 0
lastL := L
lastLbar := Lbar
lastLL := L
lastLLbar := Lbar
cfHL(0)
H := high
Hbar := bar_index
else if low < lastL and lastL != lastLL
if close < lastL
BoS_ChoCh(0,0)
cfHL(1)
isCocDn := 1
isCocUp := 0
isBosUp := 0
else
sweep(0,1)
//Check for BoS
if isBosUp == 0
if high > lastHH
if close > lastHH
BoS_ChoCh(1,1)
cfHL(0)
lastL := L
lastLbar := Lbar
isCocUp := 1
isBosUp := 1
isCocDn := 0
isBosDn := 0
else
sweep(1,1)
if isBosDn == 0
if low < lastLL
if close < lastLL
BoS_ChoCh(1,0)
cfHL(1)
lastH := H
lastHbar := Hbar
isCocUp := 0
isBosUp := 0
isCocDn := 1
isBosDn := 1
else
sweep(0,0)
//#endregion
//#region internal structure
if equalHL
if high >= top
if low > bot
mnDn :=0
mnUp := 1
if low <= bot
if high < top
mnUp := 0
mnDn := 1
if mnUp[1] and not mnUp
mnMark(1)
if mnDn[1] and not mnDn
mnMark(0)
else
if high > top
if low > bot
mnDn :=0
mnUp := 1
if low < bot
if high < top
mnUp := 0
mnDn := 1
if mnUp[1] and not mnUp
mnMark(1)
if mnDn[1] and not mnDn
mnMark(0)
if equalHL
if high >= top
puUp := high
puUpbar := bar_index
if low <= bot
puDn := low
puDnbar := bar_index
top := high
bot := low
if high >= top
top := high
bot := low
else
if high > top
puUp := high
puUpbar := bar_index
if low < bot
puDn := low
puDnbar := bar_index
top := high
bot := low
if high > top
top := high
bot := low
//#endregion
//#region auto update High and Low vars
if high > H or (high == H and equalHL)
H := high
Hbar := bar_index
if high > idmS
idmS := high
idmS_bar := bar_index
if high > lastH or (high == lastH and equalHL)
lastH := high
lastHbar := bar_index
if high > lastHH or (high == lastHH and equalHL)
lastHH := high
lastHHbar := bar_index
if low < L or (low == L and equalHL)
L := low
Lbar := bar_index
if low < idmB
idmB := low
idmB_bar := bar_index
if low < lastL or (low == lastL and equalHL)
lastL := low
lastLbar := bar_index
if low < lastLL or (low == lastLL and equalHL)
lastLL := low
lastLLbar := bar_index
//#endregion
//#region live IDM
if showliveIDM and barstate.islast
[liveIDM, liveIDMbar] = if isCocUp and lastHL == Hbar
[idmB, idmB_bar]
else if isCocDn and lastHL == Lbar
[idmS, idmS_bar]
lv_line := line.new(liveIDMbar, liveIDM, bar_index + 20, liveIDM, color = idmColor, style = line.style_dotted),
lv_lbl := label.new(bar_index + 20, liveIDM, "IDM", color = transp, textcolor = idmColor, style = isCocUp ? label.style_label_down : label.style_label_up, size = size.small)
else
lv_line := na
lv_lbl := na
line.delete(lv_line[1])
label.delete(lv_lbl[1])
//#endregion
//#region fixing bugs
// plot(H,"H")
// plot(lastH, "lastH")
// plot(lastHH, "lastHH")
// plot(idmS, "idmS")
// plot(puUp, "puUp")
// plot(L,"L")
// plot(lastL, "lastL")
// plot(lastLL, "lastLL")
// plot(idmB, "idmB")
// plot(puDn, "puDn")
//#endregion
In Smart Money Concepts (SMC), "IDM" stands for Inducement and refers to areas where price action is designed to lure retail traders into making poor trades, often by targeting liquidity pools before a significant price move.
Here's a more detailed explanation:
What is Inducement?
Inducement is a concept in SMC where price action is manipulated to create traps for retail traders, leading them to take positions at unfavorable levels.
Smart Money (large institutional traders) often use inducements to gather liquidity (stop-loss orders or pending orders) before initiating a large price move.
Identifying and understanding inducements is crucial for SMC traders to avoid being caught in these traps and to identify potential trading opportunities.
How Inducements Work:
Smart Money will push the price to a level where there's a high concentration of stop-loss orders or pending orders (liquidity pools).
This creates the illusion of a breakout or a continuation of the trend, enticing retail traders to enter trades.
Once the retail traders are in, Smart Money will reverse the price, taking out their positions and grabbing their liquidity.
Examples of Inducements:
A price pullback just above a resistance level, where retail traders might expect a breakout, but instead, the price reverses.
A price rally just below a support level, where retail traders might expect a continuation, but instead, the price reverses.
Importance of Inducement in SMC:
Understanding and identifying inducements is a key component of SMC trading strategies.
It helps traders avoid being caught in price traps and to identify potential areas where Smart Money might be accumulating or distributing.
By recognizing inducements, traders can make more informed decisions and potentially profit from the reversals that follow.
In the context of Smart Money Concepts (SMC) trading, "BOS" stands for Break of Structure, which signifies a price move beyond a previous level of support or resistance, potentially indicating a continuation of the prevailing trend.
Here's a more detailed explanation:
What it is:
A Break of Structure (BOS) occurs when the price action breaks through a significant swing high or swing low, suggesting that the trend might continue in the direction of the break.
Bullish BOS:
In an uptrend, a bullish BOS happens when the price breaks above a previous high, indicating that the bullish trend is likely to continue.
Bearish BOS:
In a downtrend, a bearish BOS occurs when the price breaks below a previous low, suggesting that the bearish trend is likely to continue.
Significance:
Identifying BOS can help traders determine the direction of the trend and make informed decisions based on market dynamics.
Context:
BOS is a fundamental concept in SMC and ICT (Institute of Currency Trading) trading methodologies, which focus on identifying the actions of "smart money" (institutions) in the market.
Other related concepts:
BOS is often used in conjunction with other SMC concepts like Change of Character (CHOCH), which indicates a potential trend reversal, and Order Blocks, which represent areas of significant institutional buying or selling.