OPEN-SOURCE SCRIPT

ILM & IFVG Strategy

96
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
//═══════════════════════════════════════════════════════════════════════

免責聲明

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.