OPEN-SOURCE SCRIPT
SMC Minimal Setup

//version=5
indicator("SMC Minimal Setup", overlay=true)
// === INPUTS ===
swingLeft = input.int(5, "Swing Left")
swingRight = input.int(5, "Swing Right")
structureLookback = input.int(20, "Structure Lookback")
// === MARKET STRUCTURE ===
var string structure = "neutral"
if high > ta.highest(high[1], structureLookback)
structure := "bullish"
if low < ta.lowest(low[1], structureLookback)
structure := "bearish"
// === SWING LEVELS ===
relevantHigh = ta.pivothigh(high, swingLeft, swingRight)
relevantLow = ta.pivotlow(low, swingLeft, swingRight)
// === LIQUIDITY SWEEPS ===
sweepHigh = not na(relevantHigh) and high > relevantHigh and close < relevantHigh
sweepLow = not na(relevantLow) and low < relevantLow and close > relevantLow
// === DISPLACEMENT CANDLES ===
bodySize = math.abs(close - open)
candleRange = high - low
avgRange = ta.sma(candleRange, 10)
displacementUp = close > open and bodySize > candleRange*0.6 and candleRange > avgRange
displacementDown = open > close and bodySize > candleRange*0.6 and candleRange > avgRange
// === SETUP ===
bullishSetup = sweepLow and displacementUp
bearishSetup = sweepHigh and displacementDown
plotshape(bullishSetup, style=shape.triangleup, location=location.belowbar, color=color.green, size=size.small)
plotshape(bearishSetup, style=shape.triangledown, location=location.abovebar, color=color.red, size=size.small)
// === FVG ===
bullishFVG = low[1] > high[2]
bearishFVG = high[1] < low[2]
if bullishFVG
box.new(left=bar_index-2, right=bar_index, top=low[1], bottom=high[2], bgcolor=color.new(color.green,85))
if bearishFVG
box.new(left=bar_index-2, right=bar_index, top=high[1], bottom=low[2], bgcolor=color.new(color.red,85))
// === BACKGROUND ===
bgcolor(structure=="bullish" ? color.new(color.green,80) : structure=="bearish" ? color.new(color.red,80) : na)
indicator("SMC Minimal Setup", overlay=true)
// === INPUTS ===
swingLeft = input.int(5, "Swing Left")
swingRight = input.int(5, "Swing Right")
structureLookback = input.int(20, "Structure Lookback")
// === MARKET STRUCTURE ===
var string structure = "neutral"
if high > ta.highest(high[1], structureLookback)
structure := "bullish"
if low < ta.lowest(low[1], structureLookback)
structure := "bearish"
// === SWING LEVELS ===
relevantHigh = ta.pivothigh(high, swingLeft, swingRight)
relevantLow = ta.pivotlow(low, swingLeft, swingRight)
// === LIQUIDITY SWEEPS ===
sweepHigh = not na(relevantHigh) and high > relevantHigh and close < relevantHigh
sweepLow = not na(relevantLow) and low < relevantLow and close > relevantLow
// === DISPLACEMENT CANDLES ===
bodySize = math.abs(close - open)
candleRange = high - low
avgRange = ta.sma(candleRange, 10)
displacementUp = close > open and bodySize > candleRange*0.6 and candleRange > avgRange
displacementDown = open > close and bodySize > candleRange*0.6 and candleRange > avgRange
// === SETUP ===
bullishSetup = sweepLow and displacementUp
bearishSetup = sweepHigh and displacementDown
plotshape(bullishSetup, style=shape.triangleup, location=location.belowbar, color=color.green, size=size.small)
plotshape(bearishSetup, style=shape.triangledown, location=location.abovebar, color=color.red, size=size.small)
// === FVG ===
bullishFVG = low[1] > high[2]
bearishFVG = high[1] < low[2]
if bullishFVG
box.new(left=bar_index-2, right=bar_index, top=low[1], bottom=high[2], bgcolor=color.new(color.green,85))
if bearishFVG
box.new(left=bar_index-2, right=bar_index, top=high[1], bottom=low[2], bgcolor=color.new(color.red,85))
// === BACKGROUND ===
bgcolor(structure=="bullish" ? color.new(color.green,80) : structure=="bearish" ? color.new(color.red,80) : na)
نص برمجي مفتوح المصدر
بروح TradingView الحقيقية، قام مبتكر هذا النص البرمجي بجعله مفتوح المصدر، بحيث يمكن للمتداولين مراجعة وظائفه والتحقق منها. شكرا للمؤلف! بينما يمكنك استخدامه مجانًا، تذكر أن إعادة نشر الكود يخضع لقواعد الموقع الخاصة بنا.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.
نص برمجي مفتوح المصدر
بروح TradingView الحقيقية، قام مبتكر هذا النص البرمجي بجعله مفتوح المصدر، بحيث يمكن للمتداولين مراجعة وظائفه والتحقق منها. شكرا للمؤلف! بينما يمكنك استخدامه مجانًا، تذكر أن إعادة نشر الكود يخضع لقواعد الموقع الخاصة بنا.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.