Sign up
Login
New
Trending
Archive
English
English
Sign up
Login
New Paste
Add Image
//@version=5 indicator("ไอ้จุ่น SMC Pro v18 (Auto Fibo + HMA Trend Filter)", overlay=true, max_lines_count=500, max_boxes_count=500, max_labels_count=500) // ========================================== // 1. SETTINGS // ========================================== // --- Group: General Size --- grp_gen = "⚙️ General / Size Settings" textSize = input.string(size.small, "Label Text Size", options=[size.tiny, size.small, size.normal, size.large], group=grp_gen) tableSize = input.string(size.normal, "Table Text Size", options=[size.small, size.normal, size.large], group=grp_gen) // --- Group: Trend Filter (Better than HAMA) [NEW!] --- grp_trend = "🌊 Trend Filter (Hull Suite)" useTrend = input.bool(true, "Color Bars by Trend?", group=grp_trend) trendLen = input.int(55, "Trend Length (HMA)", minval=1, group=grp_trend) // 55 is standard for swing colUp = input.color(color.new(#00ffbb, 0), "Up Trend Color", group=grp_trend) colDn = input.color(color.new(#ff1100, 0), "Down Trend Color", group=grp_trend) // --- Group: Auto Fibonacci (SMC Pro) --- grp_fibo = "🔢 Auto Fibo (SMC/ICT Levels)" showFibo = input.bool(true, "Show Auto Fibo?", group=grp_fibo) fiboLen = input.int(20, "Fibo Pivot Lookback", minval=5, group=grp_fibo) // Colors cFibo0 = input.color(color.gray, "Level 0 & 1 Color", group=grp_fibo) cFibo0236 = input.color(color.red, "Level 0.236 Color", group=grp_fibo) cFibo0382 = input.color(color.orange, "Level 0.382 Color", group=grp_fibo) cFibo05 = input.color(color.green, "Level 0.5 (EQ) Color", group=grp_fibo) cFibo0618 = input.color(color.teal, "Level 0.618 Color", group=grp_fibo) cFibo0705 = input.color(color.purple, "Level 0.705 (OTE) Color", group=grp_fibo) cFibo0786 = input.color(color.new(#00BCD4, 0), "Level 0.786 Color", group=grp_fibo) cFibo0886 = input.color(color.new(color.fuchsia, 0), "Level 0.886 (Deep) Color", group=grp_fibo) cFibo1272 = input.color(color.new(color.orange, 0), "Level 1.272 Color", group=grp_fibo) cFibo1618 = input.color(color.blue, "Level 1.618 Color", group=grp_fibo) cFibo2 = input.color(color.teal, "Level 2.0 Color", group=grp_fibo) // --- Group: MTF Dashboard --- grp_mtf = "🚀 MTF Trend Dashboard" showMtf = input.bool(true, "Show MTF Table?", group=grp_mtf) mtfLen = input.int(200, "Trend Filter (EMA Period)", group=grp_mtf) tblPos = input.string(position.bottom_right, "Table Position", options=[position.top_right, position.bottom_right, position.top_left, position.bottom_left], group=grp_mtf) // --- Group: SMC Major --- grp_smc = "📐 SMC Major Structure" showSMC = input.bool(true, "Show Major Structure?", group=grp_smc) pivotLen = input.int(10, "Major Pivot Lookback", minval=2, group=grp_smc) colorBos = input.color(color.green, "Major BOS Color", group=grp_smc) colorChoch = input.color(color.orange, "Major CHoCH Color", group=grp_smc) // --- Group: SMC Internal --- grp_int = "📏 SMC Internal Structure" showInt = input.bool(true, "Show Internal Structure?", group=grp_int) pivotLenInt = input.int(5, "Internal Pivot Lookback", minval=2, group=grp_int) colorBosInt = input.color(color.new(color.green, 40), "Internal BOS Color", group=grp_int) colorChochInt = input.color(color.new(color.orange, 40), "Internal CHoCH Color", group=grp_int) // --- Group: Inducement --- grp_idm = "🪤 Inducement (IDM)" showIDM = input.bool(true, "Show IDM?", group=grp_idm) idmLen = input.int(3, "IDM Pivot Lookback", minval=1, group=grp_idm) colorIdmHigh= input.color(color.new(color.orange, 30), "IDM High Color", group=grp_idm) colorIdmLow = input.color(color.new(color.blue, 30), "IDM Low Color", group=grp_idm) // --- Group: FVG --- grp_fvg = "🧲 FVG" showFVG = input.bool(true, "Show FVG?", group=grp_fvg) colorFvgBull = input.color(color.new(color.green, 90), "Bullish FVG", group=grp_fvg) colorFvgBear = input.color(color.new(color.red, 90), "Bearish FVG", group=grp_fvg) // --- Group: PA Setup --- grp_pa = "🕯️ PA Setup" showPA = input.bool(true, "Show PA Zones?", group=grp_pa) wickPct = input.float(5.0, "Max Open Wick %", minval=0.0, group=grp_pa) / 100 minBody = input.float(1.2, "Min Body Size", minval=1.0, group=grp_pa) extendBox = input.int(10, "Extend Zone", group=grp_pa) // --- Group: Single Candle --- grp_single = "✨ Single Candle Patterns" showSingle = input.bool(true, "Show Pinbar?", group=grp_single) showInside = input.bool(true, "Show Inside Bar?", group=grp_single) // ========================================== // 2. TREND FILTER (HULL SUITE) - NEW! // ========================================== // Hull Moving Average Calculation hmaVal = ta.hma(close, trendLen) hmaPrev = hmaVal[1] isTrendUp = hmaVal > hmaPrev isTrendDown = hmaVal < hmaPrev // Determine Bar Color based on Trend var color barCol = na if useTrend barCol := isTrendUp ? colUp : colDn else barCol := na // Apply Color (เฉพาะแท่งเทียน Inside bar จะถูกทับด้วยสีเหลืองจาก Logic ด้านล่าง) barcolor(barCol) // ========================================== // 3. MTF TREND // ========================================== getTrend(tf) => emaVal = ta.ema(close, mtfLen) isBull = close > emaVal request.security(syminfo.tickerid, tf, isBull, gaps=barmerge.gaps_off, lookahead=barmerge.lookahead_on) t15 = getTrend("15"), t30 = getTrend("30"), t60 = getTrend("60"), t120 = getTrend("120"), t240 = getTrend("240") var table mtfTable = table.new(tblPos, 2, 6, border_color=color.gray, border_width=1, frame_color=color.gray, frame_width=1, bgcolor=color.new(color.black, 50)) if showMtf and barstate.islast table.cell(mtfTable, 0, 0, "TF", text_color=color.white, bgcolor=color.gray, text_size=tableSize) table.cell(mtfTable, 1, 0, "Trend", text_color=color.white, bgcolor=color.gray, text_size=tableSize) table.cell(mtfTable, 0, 1, "M15", text_color=color.white, text_size=tableSize) table.cell(mtfTable, 1, 1, t15 ? "Bull 🟢" : "Bear 🔴", text_color=t15 ? color.green : color.red, text_size=tableSize) table.cell(mtfTable, 0, 2, "M30", text_color=color.white, text_size=tableSize) table.cell(mtfTable, 1, 2, t30 ? "Bull 🟢" : "Bear 🔴", text_color=t30 ? color.green : color.red, text_size=tableSize) table.cell(mtfTable, 0, 3, "H1", text_color=color.white, text_size=tableSize) table.cell(mtfTable, 1, 3, t60 ? "Bull 🟢" : "Bear 🔴", text_color=t60 ? color.green : color.red, text_size=tableSize) table.cell(mtfTable, 0, 4, "H2", text_color=color.white, text_size=tableSize) table.cell(mtfTable, 1, 4, t120 ? "Bull 🟢" : "Bear 🔴", text_color=t120 ? color.green : color.red, text_size=tableSize) table.cell(mtfTable, 0, 5, "H4", text_color=color.white, text_size=tableSize) table.cell(mtfTable, 1, 5, t240 ? "Bull 🟢" : "Bear 🔴", text_color=t240 ? color.green : color.red, text_size=tableSize) // ========================================== // 4. AUTO FIBONACCI (PRO LEVELS) // ========================================== f_ph = ta.pivothigh(high, fiboLen, fiboLen) f_pl = ta.pivotlow(low, fiboLen, fiboLen) var float f_last_ph = na var float f_last_pl = na var int f_idx_ph = 0 var int f_idx_pl = 0 if not na(f_ph) f_last_ph := f_ph f_idx_ph := bar_index[fiboLen] if not na(f_pl) f_last_pl := f_pl f_idx_pl := bar_index[fiboLen] var line[] fiboLines = array.new_line() var label[] fiboLabels = array.new_label() drawFiboLine(x1, y, x2, col, txt) => l = line.new(x1, y, x2, y, color=col, style=line.style_solid, width=1) lb = label.new(x2, y, txt, color=color.new(color.white, 100), textcolor=col, style=label.style_label_left, size=size.tiny) array.push(fiboLines, l) array.push(fiboLabels, lb) if showFibo and barstate.islast for l in fiboLines line.delete(l) for lb in fiboLabels label.delete(lb) array.clear(fiboLines) array.clear(fiboLabels) isHighLast = f_idx_ph > f_idx_pl startPrice = isHighLast ? f_last_pl : f_last_ph endPrice = isHighLast ? f_last_ph : f_last_pl startIndex = isHighLast ? f_idx_pl : f_idx_ph endIndex = isHighLast ? f_idx_ph : f_idx_pl currIndex = bar_index + 5 rangePrice = endPrice - startPrice drawFiboLine(endIndex, endPrice, currIndex, cFibo0, "0.00") drawFiboLine(endIndex, endPrice - (rangePrice * 0.236), currIndex, cFibo0236, "0.236") drawFiboLine(endIndex, endPrice - (rangePrice * 0.382), currIndex, cFibo0382, "0.382") drawFiboLine(endIndex, endPrice - (rangePrice * 0.5), currIndex, cFibo05, "0.5 (EQ)") drawFiboLine(endIndex, endPrice - (rangePrice * 0.618), currIndex, cFibo0618, "0.618") drawFiboLine(endIndex, endPrice - (rangePrice * 0.705), currIndex, cFibo0705, "0.705 (OTE)") drawFiboLine(endIndex, endPrice - (rangePrice * 0.786), currIndex, cFibo0786, "0.786") drawFiboLine(endIndex, endPrice - (rangePrice * 0.886), currIndex, cFibo0886, "0.886 (Deep)") drawFiboLine(endIndex, startPrice, currIndex, cFibo0, "1.00") drawFiboLine(endIndex, endPrice - (rangePrice * 1.272), currIndex, cFibo1272, "1.272") drawFiboLine(endIndex, endPrice - (rangePrice * 1.618), currIndex, cFibo1618, "1.618") drawFiboLine(endIndex, endPrice - (rangePrice * 2.0), currIndex, cFibo2, "2.00") line.new(startIndex, startPrice, endIndex, endPrice, color=color.gray, style=line.style_dotted) // ========================================== // 5. SMC MAJOR // ========================================== ph = ta.pivothigh(high, pivotLen, pivotLen) pl = ta.pivotlow(low, pivotLen, pivotLen) var float lastHigh = na var float lastLow = na var int lastHighIndex = 0 var int lastLowIndex = 0 var bool isUptrend = false if not na(ph) txt = "H" if not na(lastHigh) txt := ph > lastHigh ? "HH" : "LH" if showSMC label.new(bar_index[pivotLen], ph, txt, color=color.new(color.white, 100), textcolor=color.gray, style=label.style_label_down, size=textSize) lastHigh := ph lastHighIndex := bar_index[pivotLen] if not na(pl) txt = "L" if not na(lastLow) txt := pl > lastLow ? "HL" : "LL" if showSMC label.new(bar_index[pivotLen], pl, txt, color=color.new(color.white, 100), textcolor=color.gray, style=label.style_label_up, size=textSize) lastLow := pl lastLowIndex := bar_index[pivotLen] if ta.crossover(close, lastHigh) and not na(lastHigh) txtType = isUptrend ? "BOS" : "CHoCH" isUptrend := true if showSMC line.new(lastHighIndex, lastHigh, bar_index, lastHigh, color=isUptrend ? colorBos : colorChoch, style=line.style_solid, width=2) label.new(bar_index, lastHigh, txtType, color=color.new(color.white, 100), textcolor=isUptrend ? colorBos : colorChoch, style=label.style_label_down, size=textSize) if ta.crossunder(close, lastLow) and not na(lastLow) txtType = not isUptrend ? "BOS" : "CHoCH" isUptrend := false if showSMC line.new(lastLowIndex, lastLow, bar_index, lastLow, color=not isUptrend ? colorBos : colorChoch, style=line.style_solid, width=2) label.new(bar_index, lastLow, txtType, color=color.new(color.white, 100), textcolor=not isUptrend ? colorBos : colorChoch, style=label.style_label_up, size=textSize) // ========================================== // 6. SMC INTERNAL // ========================================== ph_int = ta.pivothigh(high, pivotLenInt, pivotLenInt) pl_int = ta.pivotlow(low, pivotLenInt, pivotLenInt) var float lastHighInt = na var float lastLowInt = na var int lastHighIndexInt = 0 var int lastLowIndexInt = 0 var bool isUptrendInt = false if not na(ph_int) lastHighInt := ph_int lastHighIndexInt := bar_index[pivotLenInt] if not na(pl_int) lastLowInt := pl_int lastLowIndexInt := bar_index[pivotLenInt] if showInt if ta.crossover(close, lastHighInt) and not na(lastHighInt) txtTypeInt = isUptrendInt ? "iBOS" : "iCHoCH" isUptrendInt := true line.new(lastHighIndexInt, lastHighInt, bar_index, lastHighInt, color=isUptrendInt ? colorBosInt : colorChochInt, style=line.style_dashed) label.new(bar_index, lastHighInt, txtTypeInt, color=color.new(color.white, 100), textcolor=isUptrendInt ? colorBosInt : colorChochInt, style=label.style_label_down, size=size.tiny) if ta.crossunder(close, lastLowInt) and not na(lastLowInt) txtTypeInt = not isUptrendInt ? "iBOS" : "iCHoCH" isUptrendInt := false line.new(lastLowIndexInt, lastLowInt, bar_index, lastLowInt, color=not isUptrendInt ? colorBosInt : colorChochInt, style=line.style_dashed) label.new(bar_index, lastLowInt, txtTypeInt, color=color.new(color.white, 100), textcolor=not isUptrendInt ? colorBosInt : colorChochInt, style=label.style_label_up, size=size.tiny) // ========================================== // 7. INDUCEMENT // ========================================== ph_idm = ta.pivothigh(high, idmLen, idmLen) pl_idm = ta.pivotlow(low, idmLen, idmLen) var line l_idm_high = na var line l_idm_low = na var label lb_idm_high = na var label lb_idm_low = na if showIDM if not na(ph_idm) line.delete(l_idm_high) label.delete(lb_idm_high) l_idm_high := line.new(bar_index[idmLen], ph_idm, bar_index + 10, ph_idm, color=colorIdmHigh, style=line.style_dashed) lb_idm_high := label.new(bar_index[idmLen], ph_idm, "IDM", color=color.new(color.white, 100), textcolor=colorIdmHigh, style=label.style_label_down, size=textSize) if not na(pl_idm) line.delete(l_idm_low) label.delete(lb_idm_low) l_idm_low := line.new(bar_index[idmLen], pl_idm, bar_index + 10, pl_idm, color=colorIdmLow, style=line.style_dashed) lb_idm_low := label.new(bar_index[idmLen], pl_idm, "IDM", color=color.new(color.white, 100), textcolor=colorIdmLow, style=label.style_label_up, size=textSize) line.set_x2(l_idm_high, bar_index) line.set_x2(l_idm_low, bar_index) // ========================================== // 8. FVG & PA // ========================================== fvg_bull = (low[0] > high[2]) fvg_bear = (high[0] < low[2]) if showFVG if fvg_bull box.new(bar_index[2], high[2], bar_index+5, low[0], border_color=color.new(color.green, 90), bgcolor=colorFvgBull, text="FVG", text_color=color.new(color.green, 50), text_size=textSize) if fvg_bear box.new(bar_index[2], low[2], bar_index+5, high[0], border_color=color.new(color.red, 90), bgcolor=colorFvgBear, text="FVG", text_color=color.new(color.red, 50), text_size=textSize) // PA Zones C = close O = open H = high L = low body = math.abs(C - O) openWickBuy = O - L openWickSell = H - O isFlatBottom = body > 0 ? (openWickBuy < body * wickPct) : false isFlatTop = body > 0 ? (openWickSell < body * wickPct) : false isBigBuy = body > (high[1] - low[1]) * minBody isBigSell = body > (high[1] - low[1]) * minBody setupBuy = (C > O) and isFlatBottom and isBigBuy and (C > H[1]) setupSell = (C < O) and isFlatTop and isBigSell and (C < L[1]) var box[] zones = array.new_box() var label[] labs = array.new_label() if showPA if setupBuy newBox = box.new(left=bar_index-1, top=high[1], right=bar_index+extendBox, bottom=low[1], border_color=color.green, bgcolor=color.new(color.green, 80), text="PA Demand", text_color=color.green, text_size=textSize) array.push(zones, newBox) l = label.new(bar_index, high, "PA Zone", color=color.green, textcolor=color.white, style=label.style_label_down, size=textSize) array.push(labs, l) if setupSell newBox = box.new(left=bar_index-1, top=high[1], right=bar_index+extendBox, bottom=low[1], border_color=color.red, bgcolor=color.new(color.red, 80), text="PA Supply", text_color=color.red, text_size=textSize) array.push(zones, newBox) l = label.new(bar_index, low, "PA Zone", color=color.red, textcolor=color.white, style=label.style_label_up, size=textSize) array.push(labs, l) if array.size(zones) > 20 box.delete(array.shift(zones)) if array.size(labs) > 20 label.delete(array.shift(labs)) // Single Candle bodySize = math.abs(close - open) totalRange = high - low upperWickSize = high - math.max(close, open) lowerWickSize = math.min(close, open) - low isSmallBody = bodySize < 0.35 * totalRange and bodySize > 0 isLongLower = lowerWickSize > 2.0 * bodySize and lowerWickSize > 0.5 * totalRange isLongUpper = upperWickSize > 2.0 * bodySize and upperWickSize > 0.5 * totalRange isSmallUpperNose = upperWickSize < 0.1 * totalRange isSmallLowerNose = lowerWickSize < 0.1 * totalRange bullishPin = isSmallBody and isLongLower and isSmallUpperNose bearishPin = isSmallBody and isLongUpper and isSmallLowerNose if showSingle and bullishPin label.new(bar_index, low, "Buy", color=color.green, textcolor=color.white, style=label.style_label_up, size=textSize) if showSingle and bearishPin label.new(bar_index, high, "Sell", color=color.red, textcolor=color.white, style=label.style_label_down, size=textSize) isInside = high < high[1] and low > low[1] // Inside Bar Priority (ทับสี Trend Filter) barcolor(showInside and isInside ? color.yellow : na)
Settings
Title :
[Optional]
Paste Folder :
[Optional]
Select
Syntax :
[Optional]
Select
Markup
CSS
JavaScript
Bash
C
C#
C++
Java
JSON
Lua
Plaintext
C-like
ABAP
ActionScript
Ada
Apache Configuration
APL
AppleScript
Arduino
ARFF
AsciiDoc
6502 Assembly
ASP.NET (C#)
AutoHotKey
AutoIt
Basic
Batch
Bison
Brainfuck
Bro
CoffeeScript
Clojure
Crystal
Content-Security-Policy
CSS Extras
D
Dart
Diff
Django/Jinja2
Docker
Eiffel
Elixir
Elm
ERB
Erlang
F#
Flow
Fortran
GEDCOM
Gherkin
Git
GLSL
GameMaker Language
Go
GraphQL
Groovy
Haml
Handlebars
Haskell
Haxe
HTTP
HTTP Public-Key-Pins
HTTP Strict-Transport-Security
IchigoJam
Icon
Inform 7
INI
IO
J
Jolie
Julia
Keyman
Kotlin
LaTeX
Less
Liquid
Lisp
LiveScript
LOLCODE
Makefile
Markdown
Markup templating
MATLAB
MEL
Mizar
Monkey
N4JS
NASM
nginx
Nim
Nix
NSIS
Objective-C
OCaml
OpenCL
Oz
PARI/GP
Parser
Pascal
Perl
PHP
PHP Extras
PL/SQL
PowerShell
Processing
Prolog
.properties
Protocol Buffers
Pug
Puppet
Pure
Python
Q (kdb+ database)
Qore
R
React JSX
React TSX
Ren'py
Reason
reST (reStructuredText)
Rip
Roboconf
Ruby
Rust
SAS
Sass (Sass)
Sass (Scss)
Scala
Scheme
Smalltalk
Smarty
SQL
Soy (Closure Template)
Stylus
Swift
TAP
Tcl
Textile
Template Toolkit 2
Twig
TypeScript
VB.Net
Velocity
Verilog
VHDL
vim
Visual Basic
WebAssembly
Wiki markup
Xeora
Xojo (REALbasic)
XQuery
YAML
HTML
Expiration :
[Optional]
Never
Self Destroy
10 Minutes
1 Hour
1 Day
1 Week
2 Weeks
1 Month
6 Months
1 Year
Status :
[Optional]
Public
Unlisted
Private (members only)
Password :
[Optional]
Description:
[Optional]
Tags:
[Optional]
Encrypt Paste
(
?
)
Create Paste
You are currently not logged in, this means you can not edit or delete anything you paste.
Sign Up
or
Login
Site Languages
×
English