OPEN-SOURCE SCRIPT
ILM & IFVG Strategy

Please feel free to adjust in any way possible. Let me know if you can create something better from this initial coding.
//═══════════════════════════════════════════════════════════════════════
// Inverted Liquidity Model (ILM) – Strategy
//═══════════════════════════════════════════════════════════════════════
//
// The **Inverted Liquidity Model (ILM)** is a liquidity-based algorithm
// built to capture high-probability reversals after:
//
// • A liquidity sweep (SSL/BSL taken)
// • Rejection back inside the range
// • A Fair Value Gap (FVG) forms
// • That FVG becomes invalidated → becomes an IFVG entry zone
//
// ILM combines:
// • LTF BOS / CHOCH structure confirmation
// • HTF structure (expansion) filtering
// • Premium / Discount filter (17:00 CST session midline)
// • Optional ATR volatility filter
// • Optional trading session restrictions
// • Optional partial profit-taking + runners
//
// When all conditions align, the strategy enters:
// ✔ Long after sweep of SSL + valid long IFVG + trend confirmation
// ✔ Short after sweep of BSL + valid short IFVG + trend confirmation
//
// Stops are placed at the sweep wick.
// Full target is set at the next structural high/low.
// Optional partial TP sends a runner to full target.
//
// Visual tools (labels, sweep lines, IFVG boxes, midline) assist
// with review and forward testing.
//
//───────────────────────────────────────────────────────────────────────
// USER CONFIGURABLE FEATURES
//───────────────────────────────────────────────────────────────────────
//
// • **Liquidity & Structure**
// - pivotLen → swing length for pivots / liquidity
// - htfOn → toggle higher-timeframe pivots
// - htfTF → timeframe for HTF structure/liquidity
// - useStructureFilter → enforce LTF BOS/CHOCH trend
// - useHtfExpansionFilter → enforce HTF trend
// - showStructureLabels → show BOS/CHOCH labels
// - showHtfStructureLabels → show HTF BOS/CHOCH labels
//
// • **Premium / Discount Midline**
// - usePremiumDiscountFilter → only long in discount / short in premium
// - pdSession → session used for midline (default 17:00 CST)
// - showPdMidLine → show 50% midline
//
// • **FVG / IFVG Detection**
// - useBodyGapFVG → FVG uses candle bodies instead of wicks
// - useDisplacementFVG → require displacement bar
// - dispAtrMult → minimum ATR threshold for displacement
// - showIFVG → draw IFVG boxes
//
// • **ATR / Volatility / Sessions**
// - useRangeFilter → require minimum ATR%
// - atrLen → ATR period
// - minAtrPerc → minimum ATR% of price
// - useSessionFilter → restrict trading hours
// - sessionTimes → allowed trading session
//
// • **Sweep Visualization**
// - showSweepLines → draw sweep lines at SSL/BSL sweeps
// - sweepLineWidth → thickness of sweep lines
//
// • **Exits: Partial Targets & Runners**
// - usePartialTargets → enable partial TP logic
// - tp1QtyPercent → percent closed at TP1
// - tp1FractionOfPath → TP1 relative to path to full target
//
// • **Formatting / Visibility**
// - labelFontSizeInput → tiny / small / normal / large / huge
// - showEntries → entry markers
// - showTargets → target lines
//
//═══════════════════════════════════════════════════════════════════════
// END OF STRATEGY DESCRIPTION
//═══════════════════════════════════════════════════════════════════════
//═══════════════════════════════════════════════════════════════════════
// Inverted Liquidity Model (ILM) – Strategy
//═══════════════════════════════════════════════════════════════════════
//
// The **Inverted Liquidity Model (ILM)** is a liquidity-based algorithm
// built to capture high-probability reversals after:
//
// • A liquidity sweep (SSL/BSL taken)
// • Rejection back inside the range
// • A Fair Value Gap (FVG) forms
// • That FVG becomes invalidated → becomes an IFVG entry zone
//
// ILM combines:
// • LTF BOS / CHOCH structure confirmation
// • HTF structure (expansion) filtering
// • Premium / Discount filter (17:00 CST session midline)
// • Optional ATR volatility filter
// • Optional trading session restrictions
// • Optional partial profit-taking + runners
//
// When all conditions align, the strategy enters:
// ✔ Long after sweep of SSL + valid long IFVG + trend confirmation
// ✔ Short after sweep of BSL + valid short IFVG + trend confirmation
//
// Stops are placed at the sweep wick.
// Full target is set at the next structural high/low.
// Optional partial TP sends a runner to full target.
//
// Visual tools (labels, sweep lines, IFVG boxes, midline) assist
// with review and forward testing.
//
//───────────────────────────────────────────────────────────────────────
// USER CONFIGURABLE FEATURES
//───────────────────────────────────────────────────────────────────────
//
// • **Liquidity & Structure**
// - pivotLen → swing length for pivots / liquidity
// - htfOn → toggle higher-timeframe pivots
// - htfTF → timeframe for HTF structure/liquidity
// - useStructureFilter → enforce LTF BOS/CHOCH trend
// - useHtfExpansionFilter → enforce HTF trend
// - showStructureLabels → show BOS/CHOCH labels
// - showHtfStructureLabels → show HTF BOS/CHOCH labels
//
// • **Premium / Discount Midline**
// - usePremiumDiscountFilter → only long in discount / short in premium
// - pdSession → session used for midline (default 17:00 CST)
// - showPdMidLine → show 50% midline
//
// • **FVG / IFVG Detection**
// - useBodyGapFVG → FVG uses candle bodies instead of wicks
// - useDisplacementFVG → require displacement bar
// - dispAtrMult → minimum ATR threshold for displacement
// - showIFVG → draw IFVG boxes
//
// • **ATR / Volatility / Sessions**
// - useRangeFilter → require minimum ATR%
// - atrLen → ATR period
// - minAtrPerc → minimum ATR% of price
// - useSessionFilter → restrict trading hours
// - sessionTimes → allowed trading session
//
// • **Sweep Visualization**
// - showSweepLines → draw sweep lines at SSL/BSL sweeps
// - sweepLineWidth → thickness of sweep lines
//
// • **Exits: Partial Targets & Runners**
// - usePartialTargets → enable partial TP logic
// - tp1QtyPercent → percent closed at TP1
// - tp1FractionOfPath → TP1 relative to path to full target
//
// • **Formatting / Visibility**
// - labelFontSizeInput → tiny / small / normal / large / huge
// - showEntries → entry markers
// - showTargets → target lines
//
//═══════════════════════════════════════════════════════════════════════
// END OF STRATEGY DESCRIPTION
//═══════════════════════════════════════════════════════════════════════
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.