LN Gold StrategyStrategy Summary:
This strategy combines ZigZag structure, Fair Value Gaps (FVG), and EMA trend filtering to identify high-probability trade setups.
Trades are taken when price aligns with the trend (EMA), confirms structure (ZigZag), and interacts with a valid FVG zone.
The system uses a fixed risk-to-reward ratio, with built-in stop loss, take profit, and optional lock-profit (break-even) management to protect gains.
It is designed for precision entries, controlled risk, and consistent execution, mainly on lower timeframes. Strategy

Indicator

Indicator

Indicator

Indicator

TPOLibLibrary "TPOLib"
TPOLib — Classical Time Price Opportunity (TPO) primitives.
Provides tick/row conversion, POC/Value Area calculation, TPO letter encoding,
Initial Balance tracking, and profile shape classification.
Note: Function bodies for f_price_to_tick, f_tick_to_row, f_row_to_price,
f_calc_row_ticks, f_poc_from_vals, f_value_area, and f_find_key_sorted are
copied from TPOSmartMoneyLib/3 (immutable on TradingView). No extraction or
migration - legacy consumers unaffected.
Architecture: L0 (no library dependencies, uses ta.* and math.* primitives only)
f_price_to_tick(p)
Convert price to tick
Parameters:
p (float) : Price value
Returns: Tick value
f_tick_to_row(t, row_ticks_in)
Convert tick to row
Parameters:
t (int) : Tick value
row_ticks_in (int) : Number of ticks per row
Returns: Row index
f_row_to_price(row, row_ticks_in)
Convert row to price (midpoint)
Parameters:
row (int) : Row index
row_ticks_in (int) : Number of ticks per row
Returns: Price at row midpoint
f_calc_row_ticks(natr_ref, row_gran_mult)
Calculate dynamic row size based on normalized ATR
Parameters:
natr_ref (float) : Daily normalized ATR reference value
row_gran_mult (float) : Row granularity multiplier
Returns: Number of ticks per row
f_poc_from_vals(keys, vals)
Calculate Point of Control from volume distribution
Parameters:
keys (array) : Sorted array of row keys
vals (array) : Array of volume values
Returns: POC row key
f_value_area(keys, vals, poc_key, va_pct)
Calculate Value Area from volume distribution
Parameters:
keys (array) : Sorted array of row keys
vals (array) : Array of volume values
poc_key (int) : POC row key
va_pct (float) : Value Area percentage (typically 0.70)
Returns: Tuple of
f_find_key_sorted(keys, target)
Find key in sorted array using binary search
Parameters:
keys (array) : Sorted array of keys
target (int) : Target key to find
Returns: Index of key, or -1 if not found
f_tpo_letter_idx(bracket_idx)
Get TPO letter for bracket index (A-Z, then AA-AZ, etc.)
Parameters:
bracket_idx (int) : Bracket index (0-based)
Returns: Letter string
f_initial_balance_from_brackets(brackets, ib_bracket_count, row_ticks)
Calculate Initial Balance from first N brackets
Parameters:
brackets (array) : Array of TPOBracket (sorted by time)
ib_bracket_count (int) : Number of brackets in IB period (typically 2 for 1hr)
row_ticks (int) : Number of ticks per row
Returns: InitialBalance
f_detect_tpo_singles(brackets)
Detect TPO singles (rows with only one TPO print)
Parameters:
brackets (array) : Array of TPOBracket
Returns: Array of row indices that are singles
f_classify_profile(poc, val, vah, range_low, range_high)
Classify profile shape based on POC position and VA width
Parameters:
poc (int) : POC row
val (int) : VAL row
vah (int) : VAH row
range_low (int) : Lowest row in profile
range_high (int) : Highest row in profile
Returns: ProfileShape
TPOBracket
TPO bracket (single time period at a price level)
Fields:
letter (series string) : Letter identifier (A-Z for 30min brackets in RTH session)
row (series int) : Row index (price level)
volume (series float) : Volume accumulated in this bracket
ValueArea
Value Area calculation result
Fields:
poc (series int) : Point of Control (row with highest volume)
val (series int) : Value Area Low (row)
vah (series int) : Value Area High (row)
poc_volume (series float) : Volume at POC
va_volume (series float) : Total volume in Value Area
InitialBalance
Initial Balance (first hour of RTH session)
Fields:
ib_high (series float) : Highest price in IB period
ib_low (series float) : Lowest price in IB period
ib_range (series float) : IB range (high - low)
extended_up (series bool) : IB extended upward
extended_down (series bool) : IB extended downward
ProfileShape
Profile shape classification
Fields:
shape (series string) : "normal", "b_shape", "p_shape", "d_shape", "neutral"
poc_position (series float) : POC position relative to range (0.0=low, 1.0=high)
va_width (series float) : Value Area width as % of total range Library

Strategy

Apex Matrix V4 Strategy: Martingale & Dynamic ExitThis script is published for educational and analytical purposes. It demonstrates a complex, multi-layered algorithmic trading system designed to identify liquidity sweeps and leverage traps in the cryptocurrency market.
█ WARNING — MARTINGALE RISK DISCLOSURE
This strategy explicitly utilizes a Martingale position-sizing system. If a trade moves against the entry (adverse excursion), the algorithm will aggressively double the allocated margin on the next valid signal to pull the average entry price closer to the current market price. Martingale systems carry extreme inherent risk and can lead to rapid and total liquidation of capital during sustained, unidirectional trends. Do not use this system with real funds without fully understanding the mathematical risk of ruin.
█ WHAT THIS SCRIPT DOES
This strategy executes mean-reversion trades by identifying areas where retail leverage is trapped, using a combination of price action (Swing Failure Patterns) and multi-exchange Open Interest aggregation.
█ HOW IT FINDS SETUPS (THE 4 PILLARS)
1 — Macro Flow (USDT.D Proxy): Evaluates Tether Dominance to ensure fiat is flowing into or out of the crypto market, providing macro trend alignment.
2 — Synthetic Leverage (Aggregated OI): Sums the Open Interest from Binance, Bybit, and OKX. It looks for "flushed" OI to confirm safe bottoms and "spiking" OI to identify overheated tops.
3 — Topological Sweeps (SFP): The trigger only arms when price pierces a 20-period high/low boundary and immediately closes back inside the range, trapping breakout traders.
4 — TDA Cluster Collapse: Requires a 2-standard-deviation volume anomaly or extreme candle body absorption (Effort vs. Result) to validate institutional presence.
█ HOW IT MANAGES RISK (ASYMMETRIC EXITS & RATCHETS)
• Logical Stop: Evaluates a 2% stop loss strictly on the candle close to avoid getting stopped out by manipulative, high-leverage exchange wicks.
• Catastrophe Stop: A hidden 4% wick-based hard stop to protect against flash crashes.
• Dual-Tier Ratchet: The millisecond price wicks to +1% profit, the stop is hard-locked at break-even. At +1.5%, the stop is pulled up to +1.5% and locked.
• 10% Max Take Profit: A hard limit order is placed at 10% for absolute profit capping.
• Dynamic Trailing: Closes early if price loses short-term momentum (crosses 5 EMA).
Some results as of releasing this indicator (5000USD portfolio $50 margin with 100x leverage simulated, 0.05% commision as default Binance taker fee):
Symbol 1m, 3m, 5m, 15m, 30m, 1h, Total
BTC, 152.96, 131.37, 161.78, 455.3, 26.36, 295.6, 1223.37
BTCP, 412.33, 39.28, 34.07,, 398.53, 147.33, 280.25, 1311.79
ETH, 282.95, -101.47, -126.71, 372.93, 682.07, 888.3, 1998.07
ETHP 467.5, 101.64, -233.13, 350.69, -1098.64, 792.2, 380.26
XRP, 241.35, 214.84, 378.16, -232.94, 800.46, 2113.84, 3515.71
XRPP , 260.39, 269.6, 346.76, -451.94, 954.07, 2164.21, 3543.09
SOL , 66.2, -111.94, 142.32, 204.16, 435.25, 658.54, 1394.53
SOLP , 228.78, 580.46, -104.32, 384.45, 805.72, 508.05, 2403.14
Total , 743.46, 132.8, 555.55, 799.45, 1944.14, 3956.28, 8131.68
TotalP 1369, 990.98, 43.38, 681.73, 808.48, 3744.71, 7638.28 Strategy

Indicator

Indicator

OscLibLibrary "OscLib"
OscLib — Oscillator primitives and normalization utilities.
Provides centered/clamped normalization for bounded and unbounded oscillators,
multi-oscillator dispatcher, and pivot-based divergence detection.
Architecture: L0 (no library dependencies, uses ta.* primitives only)
f_center_bounded(raw, midpoint)
Centered normalization for bounded oscillators (RSI, MFI, Stoch, WPR)
Parameters:
raw (float) : Raw oscillator value
midpoint (float) : Center point (typically 50.0 for RSI/MFI/Stoch)
Returns: Centered value in range
f_clamp_normalize(raw, threshold)
Clamped normalization for unbounded oscillators (CCI, MACD Hist, ATR)
Parameters:
raw (float) : Raw oscillator value
threshold (float) : Scaling threshold (e.g., 200 for CCI, 2*ATR for MACD)
Returns: Clamped value in range
f_compute_osc(kind, src, len)
Multi-oscillator dispatcher
Parameters:
kind (string) : Oscillator type: "RSI", "CCI", "MFI", "STOCH", "WPR"
src (float) : Source series (typically close or hlc3)
len (simple int) : Oscillator period/length
Returns: Raw oscillator value
f_divergence_pivot(osc, price, lb_left, lb_right)
Pivot-based divergence detection (matches REOS production pattern)
Parameters:
osc (float) : Oscillator series
price (float) : Price series (typically close)
lb_left (int) : Left lookback for pivot detection
lb_right (int) : Right lookback for pivot detection
Returns:
bearish_div: price makes higher high, oscillator doesn't
bullish_div: price makes lower low, oscillator doesn't Library

Indicator

Indicator

Indicator

Indicator

Indicator

Yield Curve MonitorWhat you see in the preview image
The chart displays the complete US Treasury yield curve as a smooth log-scaled polyline drawn to the right of the last bar, with all eleven maturities from 1-month T-bills to 30-year bonds plotted at their actual yield values. The solid line shows today's curve; the dashed line shows the curve from 21 trading days ago for direct visual comparison. Each tenor is labeled with its name and yield in percent. To the right, a comprehensive dashboard table lists every maturity with current yield, the change in basis points versus the historical reference date, and a relative magnitude bar. Below the maturity rows the four most-watched yield-curve spreads are shown (2s10s, 3m10y, 2s30s, 5s30s) with their current value, change versus history, and inversion status. The footer classifies both the current and historical curves into one of five regimes — Steep, Normal, Flat, Inverted, or Humped — using a user-selectable slope metric.
What this indicator does
This is a complete US Treasury yield-curve workstation built into a single TradingView pane. It solves a problem that ordinary time-series indicators cannot: the yield curve is fundamentally a cross-sectional object — yield as a function of maturity at a single moment — but standard charts plot variables against time. By rendering the curve as a polyline anchored to the right of the last bar, with maturity on a logarithmic x-axis and yield on the price axis, the indicator gives you a real, geometrically faithful view of curve shape, alongside a complete data table and historical comparison.
Eleven maturities are pulled from TradingView's TVC feed at daily resolution: US01MY, US03MY, US06MY, US01Y, US02Y, US03Y, US05Y, US07Y, US10Y, US20Y, US30Y. Each tenor is requested twice — once for the current bar and once for a user-defined lookback offset — giving the indicator a paired snapshot that drives every visualization and metric. If a specific tenor is unavailable on your data plan (US20Y is the most common gap), that point silently drops from the curve and shows an em dash in the table — no errors are raised.
Settings explained
Display group
Curves geplottet (Curves to plot) — choose which yield curves are drawn to the right of the last bar: , , or . The dashboard table always shows both datasets regardless of this setting; this toggle controls only the visual polyline. The tenor labels next to the points always reflect the curve being plotted (or the current curve when both are shown).Current onlyHistoric onlyBoth
Slope-Metrik (Shape-Klassifikation) — selects which spread drives the Steep / Normal / Flat / Inverted / Humped classification shown in the dashboard footer. Six options are available: (the default, broadest possible measure), (classic NBER recession lead-indicator), (the Federal Reserve's preferred recession signal), (long-end steepness), (pure long-end term-premium proxy), and (full-spectrum slope excluding T-bills). Each metric has its own empirically calibrated thresholds (see the Methodology section), so the classification remains meaningful regardless of which spread you choose. Alerts also fire on the selected spread.30y - 3m10y - 2y (2s10s)10y - 3m (3m10y)30y - 5y (5s30s)30y - 10y (10s30s)30y - 2y (2s30s)
Dashboard anzeigen — show or hide the data table.
Tabellen-Position — five anchor points for the dashboard: top-left, top-right, middle-right, bottom-right, bottom-left.
Historic Lookback (Daily Bars) — the number of trading days back used for the historical comparison. Default is 21, which approximates one trading month. Useful presets: 21 ≈ 1 month, 63 ≈ 1 quarter, 126 ≈ 6 months, 252 ≈ 1 year. Maximum 504 bars (≈ 2 years).
Style group
Five customizable colors mapped to semantic roles (Bull/Steep/Current, Bear/Inversion, Neutral/Normal, Warning/Flat/Hump, Historic). One additional input controls the polyline line width (1 to 5). All defaults match a dark theme; the colors can be repointed to fit any chart style.
Alerts group
Two alert toggles: one fires when the user-selected slope metric crosses below zero (inversion event), the other when it crosses back above zero (re-steepening event). Both alerts trigger on confirmed daily-bar closes only — there is no intrabar repainting.
What the dashboard shows
The table is divided into three blocks.
Maturity block (eleven rows) — one row per tenor showing the current yield to three decimal places, the change in basis points versus the lookback date with directional color (green up, red down), and a magnitude bar built from filled and empty Unicode block characters that visualizes the yield's size relative to the highest yield in the curve. This block lets you read absolute levels and recent moves at a glance.
Key Spreads block (four rows) — the four most-watched curve spreads (2s10s, 3m10y, 2s30s, 5s30s), each with current value, change in basis points versus the lookback date, and an OK / INVERTED status flag. These four are shown unconditionally regardless of which slope metric you selected for shape classification, so you always have the full institutional toolkit visible.
Curve Shape block (one or two rows) — one row per plotted curve (Current and/or Historic, depending on the curve toggle). Each row shows the regime label (STEEP, NORMAL, FLAT, INVERTED, or HUMPED) on a colored background matching the regime, the current slope value of the selected metric, and the metric's name. This lets you compare regime states between today and the lookback date directly: the curve may have shifted from FLAT to STEEP, for example, even if both versions are visible on the chart.
Methodology — shape classification
The indicator uses the user-selected spread as its primary slope input, with four absolute thresholds calibrated empirically from US Treasury data since 1990:
30y - 3m Steep : +1.5% Normal > +0.3% Flat > -0.3% Inverted ≤ -0.3%
10y - 2y (2s10s) +1.0% +0.2% -0.2% -0.2%
10y - 3m (3m10y) +1.5% +0.3% -0.3% -0.3%
30y - 5y (5s30s) +0.7% +0.15% -0.15% -0.15%
30y - 10y (10s30s) +0.5% +0.1% -0.1% -0.1%
30y - 2y (2s30s) +1.0% +0.2% -0.2% -0.2%
The thresholds reflect each spread's historical distribution: the long-end spreads (5s30s, 10s30s) have far narrower ranges than the broad measures (30y-3m, 3m10y), so applying a single global threshold would over-classify the long-end as STEEP at almost every reading. By calibrating per metric, the classification stays meaningful no matter which spread the user selects.
A separate Hump detection runs alongside: if the maximum yield in the curve falls in the belly (2Y, 3Y, 5Y, or 7Y) and the overall slope is below twice the Normal threshold, the curve is classified as HUMPED. This identifies the canonical inverted-belly shape that often signals a near-term policy-rate peak followed by expected easing.
How to read the curve
A Steep curve typically associates with early-cycle expansions, accommodative monetary policy, or rising inflation expectations — investors demand higher compensation to lend further out. A Normal curve is the long-term default state of healthy bond markets. A Flat curve indicates near-equality of short and long expectations, typically near cyclical turning points. An Inverted curve, where long yields trade below short yields, has preceded every US recession since the 1960s with an average lead time of roughly 12 to 18 months — this is the signal to watch for. A Humped shape, where the belly trades above both ends, typically reflects market pricing of a near-term hiking cycle followed by expected cuts.
The dashed historical curve makes regime transitions visually obvious. If the solid current curve sits below the dashed reference across all tenors, yields have fallen broadly (a bond rally). If the curves cross — for example, the short end is up but the long end is down — the curve has flattened or inverted further during the lookback window. If the spread between them widens at the long end, term premium is expanding.
Repainting and data behavior
All calls use . Alerts trigger only on confirmed daily-bar closes. There is no repainting on confirmed bars.request.securitylookahead = barmerge.lookahead_off
When the chart is on an intraday timeframe, the displayed yields reflect the most recent closed daily bar — during the US trading session this means yesterday's settlement until the new daily close prints. This is correct, non-repainting behavior and is consistent with how all daily-resolution data is served on TradingView.
The pane scales automatically to the yield range using two invisible anchor plots (min and max across both current and historical curves). This ensures the polyline always uses the full vertical space without manual axis adjustment, regardless of the absolute level of yields.
Limitations
The classification thresholds are static absolutes, not adaptive. In persistent low-rate regimes (such as 2010-2021) the STEEP threshold may register slightly too generously; in high-rate regimes the FLAT threshold may understate compression. The numerical slope value is always shown alongside the label, so you can apply your own judgment when the regime label feels off.
The Hump detection uses a simple argmax check on the belly tenors rather than a full curvature metric (such as the 2 × 5Y minus 2Y minus 10Y butterfly). It is most reliable when the selected slope metric spans the full curve (30y-3m, 3m10y, 2s10s); for narrow long-end metrics (5s30s, 10s30s) the belly lies outside the metric's span and Hump classification can be misleading. When in doubt, switch the slope metric to for the most robust shape reading.30y - 3m
Only US Treasuries are supported in this version. The architecture leaves headroom in the request.security budget (22 of 40 calls used) for adding additional sovereign curves (Bunds, Gilts, JGBs) in future updates.
Two alert conditions are exposed for the user-selected slope metric:
Selected Spread Inversion — fires when the chosen spread crosses below zero (e.g., from positive to negative 2s10s). Useful as an early-warning trigger in macro frameworks.
Selected Spread Re-Steepening — fires when the chosen spread crosses back above zero. The bull-versus-bear-steepener distinction (which end of the curve is moving) requires looking at the individual yields in the dashboard at the moment the alert fires.
Alerts respect the user's slope-metric selection — switching from 2s10s to 3m10y in the settings will redirect the alerts to the new spread automatically.
Recommended use
Place the indicator on a daily chart of a broad US equity index (SPX, ES1!, SPY) to visualize how historical yield-curve regimes have aligned with equity-market phases — the inversion shading and shape labels make prior recession signals immediately visible. For fixed-income traders, place it directly on a Treasury futures chart (ZN1!, ZB1!) to use the live curve view as a directional input alongside the underlying price action. For macro discretionary traders, the configurable slope metric lets you align the shape classification with whichever spread your framework prioritizes — Fed-watchers typically use 3m10y, recession-modelers use 2s10s, term-premium analysts use 5s30s or 10s30s.
Originality
This indicator combines three distinct visualizations of the same dataset — a cross-sectional polyline curve drawn to the right of the last bar, a comprehensive numerical dashboard with eleven tenors and four spreads, and a configurable shape classification with per-metric calibrated thresholds — into a single, self-contained workspace. The log-scaled cross-sectional curve drawing using Pine v6's polyline objects, the historical comparison overlay, and the user-selectable slope metric with empirically calibrated thresholds per spread are not, to my knowledge, available in this combination in other public yield-curve scripts on the platform.
Indicator

Position Calculator - VPosition Calculator — Dynamic Stop Loss & Targets
A simple, chart-synced position calculator that automatically adjusts to your current timeframe. Enter your entry price, select direction (Long/Short), and instantly get a logical stop loss based on ATR, plus two take-profit targets based on customizable risk/reward ratios.
Features:
ATR-based stop loss that adapts to the current timeframe's volatility
Customizable ATR length and multiplier
Two take-profit levels with adjustable R:R ratios (default 1:1 and 1:2)
Visual lines on chart for Entry, Stop, TP1, and TP2
Clean info table showing prices, percentages, ATR value, and stop distance
Configurable table position
How to use:
Add the indicator to your chart
Open settings and enter your entry price
Select Long or Short
The stop and targets calculate automatically based on the timeframe you're viewing
Switching timeframes updates the stop dynamically — perfect for traders who want a logical, volatility-adjusted stop without manual recalculation. Indicator

Price oscillator [Session Adjusted]Price Oscillator
This indicator combines directional momentum bias with dynamic volatility analysis, helping traders identify both trend direction and potential exhaustion zones.
Core Concept
The oscillator calculates the percentage deviation of price from a session-adjusted moving average (close / MA - 1).
The histogram is plotted as always-positive columns (green when price is above the MA, red when below). This design enables a clear visual comparison between momentum strength and the Bollinger Band Width (BBW).
When the colored columns cross above the BBW line, it signals an over-extended condition, often indicating a high probability of imminent correction or mean reversion.
Volatility Analysis
The blue BBW line is a key element of the indicator:
- Rising BBW (positive slope) indicates volatility expansion — typically associated with strong trending moves or breakout phases.
- Falling BBW (negative slope) indicates volatility contraction — often signaling consolidation periods or impending explosive moves.
Main Features
Adaptive Lookback Period:
Automatically adjusts based on the selected session duration (default 24 hours), providing timeframe consistency.
Flexible Smoothing:
Choose between SMA, EMA, RMA, or WMA for the reference moving average.
Dual Signal System:
Colored columns show momentum direction and strength.
BBW line reveals both the level and the direction (slope) of volatility.
Exhaustion Zones:
Crosses between momentum columns and BBW act as dynamic overbought/oversold signals.
How to Use
Directional Bias Filter: Green columns = bullish bias | Red columns = bearish bias.
Volatility Regime: Use the slope of the BBW line to distinguish between trending (expanding volatility) and consolidating (contracting volatility) environments.
Correction Signals: Watch for strong momentum columns crossing above the BBW line — this frequently precedes pullbacks or reversals.
Particularly effective on Forex pairs and European indices (DAX, CAC40, FTSEMIB, etc.) on 1H to 4H, and Daily timeframes.
Indicator

Indicator

Indicator

Strategy

Indicator
