PrimeFib_constants_v1Library "PrimeFib_constants_v1"
PrimeFib / GoldenWhirl constants (Pine Library). Versioning is handled via TradingView publish versions.
GOLDEN_RATIO()
GOLDEN_RATIO_INV()
PI()
INV_PI()
PHI_SPIRAL()
PHI7()
PHI7_INV()
PSI_PF()
PSI_PF_INV()
LAMBDA_PF()
RHO_PF_THEO()
RHO_BTC_EMP()
RHO_CME_EMP()
RHO_PF_EMP()
RHOT()
지표 및 전략
Jpi for LIFEEEEhmm like idk it kinda just marks out with a veritcal line 8am nyc 10:30 nyc and 10am nyc idk why but like ye ig its comfortable
king 3//@version=5
indicator("BTC_QQQ_Crown_Indicator", overlay=true)
// 1. MACD Numbers (8, 16, 11)
= ta.macd(close, 8, 16, 11)
// 2. Engulfing Candle Logic
bull = close < open and open < close and close > open
bear = close > open and open > close and close < open
// 3. Crown Signal Condition
crownBuy = bull and hist > hist
crownSell = bear and hist < hist
// 4. Drawing Crowns on Chart
plotshape(crownBuy, title="Buy_Crown", style=shape.labelup, location=location.belowbar, color=color.yellow, size=size.normal, text="👑 BUY", textcolor=color.black)
plotshape(crownSell, title="Sell_Crown", style=shape.labeldown, location=location.abovebar, color=color.red, size=size.normal, text="👑 SELL", textcolor=color.white)
NeuralFlow Forecast Levels | SPY WeeklyThis is a companion script that plots AI-adaptive market equilibrium & expansion mapping levels for SPY on chart.
NeuralFlow Forecast levels are generated though a Artificial Intelligence framework trained to identify where price is statistically inclined to re-balance and where expansion zones historically exhaust rather than extend.
What the Bands Represent
Band Layer Meaning
AI Equilibrium (white core) Primary weekly balance zone where price is most likely to mean-revert
Predictive Rails (aqua / purple) High-confidence corridor of institutional flow containment
Outer Zones (green / red) Expansion limits where continuation historically decays
Extreme Zones (top/bottom) Rare deviation envelope where auction completion is statistically favored
NeuralFlow operates Artificial Intelligence models trained specifically to map statistical re-balancing behavior, not trader predictions or sentiment. No discretionary drawing. No correlations. No lagging overlays.
This engine updates only when underlying structure changes — not when candles fluctuate intraday.
Risk:
Educational & analytical use only. Not financial advice
Investment Analysis Bar v2What It Does
A comprehensive analysis bar combining fundamental metrics with technical signals, designed for long-term investors who prioritize quality over momentum.
Core Philosophy: Quality companies trading below their 200 EMA in accumulation zones = opportunities, not warnings.
Tier 1 Bar Metrics
Margins: GM, OM, NIM, FCF Margin
Returns: ROCE, ROE
Growth: Revenue YoY, EPS YoY
Valuation: PE TTM, Forward PE, PEG
Zone: Accumulate / Hold / Trim / Exit
Signal: PRIME / BUY / TRIM / SELL / NEUTRAL
Performance: 1W to 1Y returns
Two Strategy Modes
Value Accumulator (Default) - For long-term position building. Treats below-200-EMA as an opportunity when fundamentals are intact. PRIME signals require: RSI bounce + Volume + Accumulate Zone + All Quality Gates Pass + Below 200 EMA.
Trend Follower - Traditional momentum approach. Prefers entries above 200 EMA.
Quality Gates System
Four fundamental checkpoints:
Gross Margin ≥ 40%
ROCE ≥ 15%
Debt/Equity ≤ 50%
SBC/Revenue ≤ 15%
Strong signals require quality confirmation. PRIME signals require ALL gates to pass.
Zone System
Three calculation methods:
52W Range: Accumulate in bottom 25%, Trim in top 25%
Manual Levels: Set your own price targets
ATR-Based: Dynamic zones from EMA ± ATR
Signal Hierarchy (Value Mode)
SignalMeaning
PRIME 💎Optimal entry - all conditions aligned
BUY 🔼Strong accumulation signal
BUY? ↗Decent entry, not ideal zone
ACCUM 🎯In accumulation zone, quality OK
WAIT ⏳Setup forming, no bounce yet
TRIM 📤Consider taking profits
Alerts Included
Zone transitions (Accumulate, Trim, Exit)
PRIME Entry Signal
Strong Buy / Sell signals
Quality Gate failures
Quality Accumulation Setup
Best Used On
US stocks with fundamental data available. Technical features work on all symbols.
Settings
Fully customizable:
Toggle each metric category
Adjust quality gate thresholds
Choose zone calculation method
Configure RSI/volume parameters
Position bar and panel anywhere
Ram Key Levels (Daily Horizontals) + Day SeparatorsRam Key Levels (Daily Horizontals) + Day Separators
SMC Alpha Sentiment Pro [Binance Futures Data]The SMC Alpha Sentiment Pro is an advanced decision-support tool developed for the Crypto Trade community. Unlike traditional lagging indicators, this script focuses on Market Sentiment and Smart Money Concepts (SMC) by analyzing real-time data from Binance Futures.
🔍 Key Data Points:
Open Interest (OI): Tracks new capital entering the market to confirm trend strength.
Long/Short Ratio (LSR): Identifies retail positioning. We look for "Smart Money" opportunities when retail (LSR > 1) is trapped or providing liquidity for institutional moves.
RSI & ATR: Used to identify exhaustion levels and ensure sufficient volatility for the trade.
Volume Filter: A built-in security layer that validates signals only when current volume exceeds the 20-period average.
🚥 Signal Logic:
SMC LONG: Triggered when OI is rising, LSR is below 1 and falling (retail selling), RSI is showing extreme strength (>= 68), and volume is surging.
SMC SHORT: Triggered when OI is rising, LSR is above 1 and rising (retail buying), RSI is showing extreme weakness (<= 32), and volume is surging.
📈 Best Practices:
Timeframe: Optimized for 15-minute (15M) charts.
Exchange: Specifically designed to pull ticker data from Binance Futures.
Disclaimer: This script is for educational purposes only. Trading involves significant risk.
A-Share Broad-Based ETF Dual-Core Timing System1. Strategy Overview
The "A-Share Broad-Based ETF Dual-Core Timing System" is a quantitative trading strategy tailored for the Chinese A-share market (specifically for broad-based ETFs like CSI 300, CSI 500, STAR 50). Recognizing the market's characteristic of "short bulls, long bears, and sharp bottoms," this strategy employs a "Left-Side Latency + Right-Side Full Position" dual-core driver. It aims to safely bottom-fish during the late stages of a bear market and maximize profits during the main ascending waves of a bull market.
2. Core Logic
A. Left-Side Latency (Rebound/Bottom Fishing)
Capital Allocation: Defaults to 50% position.
Philosophy: "Buy when others fear." Seeks opportunities in extreme panic or momentum divergence.
Entry Signals (Triggered by any of the following):
Extreme Panic: RSI Oversold (<30) + Price below Bollinger Lower Band + Bullish Candle Close (Avoid catching falling knives).
Oversold Bias: Price deviates more than 15% from the 60-day MA (Life Line), betting on mean reversion.
MACD Bullish Divergence: Price makes a new low while MACD histogram does not, accompanied by strengthening momentum.
B. Right-Side Full Position (Trend Following)
Capital Allocation: Aggressively scales up to Full Position (~99%) upon signal trigger.
Philosophy: "Follow the trend." Strike heavily once the trend is confirmed.
Entry Signals (All must be met):
Upward Trend: MACD Golden Cross + Price above 20-day MA.
Breakout Confirmation: CCI indicator breaks above 100, confirming a main ascending wave.
Volume Support: Volume MACD Golden Cross, ensuring price increase is backed by volume.
C. Smart Risk Control
Bear Market Exhaustion Exit: In a bearish trend (MA20 < MA60), the strategy does not "hold and hope." It immediately liquidates left-side positions upon signs of rebound exhaustion (breaking below MA20, touching MA60 resistance, or RSI failure).
ATR Trailing Stop: Uses Average True Range (ATR) to calculate a dynamic stop-profit line that rises with the price to lock in profits.
Hard Stop Loss: Forces a stop-loss if the left-side bottom fishing fails and losses exceed a set ATR multiple, preventing deep drawdowns.
3. Recommendations
Target Assets: High liquidity broad-based ETFs such as CSI 300 ETF (510300), CSI 500 ETF (510500), ChiNext ETF (159915), STAR 50 ETF (588000).
Timeframe: Daily Chart.
Strat Structure Engine + Trapped TradersStrat Structure Engine + Trapped Traders – Detailed Description
This script identifies high-probability market structure patterns known as “The Strat” setups, specifically focusing on 3-bar → Failed 2, 2-bar → Failed 2, and Failed 2 → Failed 2 (“Dragon’s Tail”) sequences. It is designed to help traders visualize potential reversals, trapped traders, and exhaustion points directly on the chart, combining price action, volatility, and volume metrics to grade signal strength.
Key Features:
3-Bar → Failed 2 (Tiered Scoring):
Detects a 3-bar structure followed immediately by a strict Failed 2 bar.
Evaluates the setup using four criteria:
3-bar range relative to ATR
Failed 2 close position relative to the 3-bar midpoint
Failed 2 body-to-range ratio
Volume relative to recent average
Assigns a tier (A+, A, B, or —) to indicate reliability, giving traders a graded view of signal strength.
2-Bar → Failed 2 (A+ Only):
Identifies strict 2-bar structures immediately followed by a Failed 2 bar.
Uses a similar evaluation system as 3→F2 but filters only for the strongest A+ setups.
Highlights signals where price shows strong directional rejection and high probability for reversal.
Dragon’s Tail – Failed 2 → Failed 2:
Captures consecutive Failed 2 bars in opposite directions, a classic trapped-trader scenario.
Signals both bullish and bearish sequences on bar close, helping traders spot potential quick reversals.
How It Works:
Uses ATR to contextualize bar ranges and volatility.
Incorporates volume averaging to detect unusually high trading activity that validates the strength of a Failed 2 setup.
Strict bar evaluation ensures only fully-formed, confirmed patterns are labeled, reducing noise and false signals.
Optional labels and alerts allow traders to track these structures in real-time or on bar close.
Practical Trading Use:
Ideal for spotting short-term exhaustion points, trapped traders, and reversal zones.
Can be used alongside liquidity zones, VWAP, and fair value gaps to refine entries and exits.
Traders can focus on high-tier signals (A+ / A) for higher probability trades, while lower-tier signals (B) indicate caution or context setups.
Customization Options:
Toggle visibility for each pattern type (3→F2, 2→F2, F2→F2).
Adjust ATR length and volume average period for different instruments or timeframes.
Alerts are available for all major setups, enabling integration with automated monitoring or manual execution strategies.
Summary:
The Strat Structure Engine + Trapped Traders script combines price action structure, volatility, and volume analysis to visualize high-probability reversal setups. By highlighting both strict pattern confirmations and tiered reliability, it provides traders with actionable insight into potential turning points, trapped trader scenarios, and high-conviction market moves without relying on external scripts or assumptions.
Ramo Trend Reversal Set (HTF Confirmed)Ramo Trend Reversal (HTF Confirmed)
Short – net – profesyonel
Sistem mantığını tek başına anlatıyor
9 HMA Direction Scalper (Pure Flip)new easier 9hma directional pure flip, it will help you with scalping short trends
IDAHL | QuantEdgeBIDAHL | QuantEdgeB
🔍 Overview
The IDAHL indicator builds adaptive, volatility-aware threshold bands from two separate ALMA lines—one smoothed from recent highs, the other from recent lows—then uses percentiles of those lines to define a dynamic “high/low” channel. Price crossing above or below that channel triggers clear long/short signals, with on-chart candle coloring, fills, optional labels and even a built-in backtest table.
✨ Key Features
• 📈 Dual ALMA Bands (with DEMA pre-smoothing)
o High ALMA: ALMA applied to DEMA-smoothed highs (high → DEMA(30) → ALMA).
o Low ALMA: ALMA applied to DEMA-smoothed lows (low → DEMA(30) → ALMA).
• 📊 Percentile Thresholds
o Computes a high threshold at the Xth percentile of the High ALMA over a lookback window.
o Computes a low threshold at the Yth percentile of the Low ALMA.
o Shifts each threshold forward by a small period to reduce repainting.
• ⚡ Dynamic Channel Logic
o When price closes above the high percentile line, the “final” threshold flips down to the low percentile line (and vice versa), creating an adaptive channel that only moves when the outer bound is violated.
o Inside the channel, the threshold holds its last value to avoid whipsaw.
• 🎨 Visual & Alerts
o Plots the two percentile lines and fills between them with a color that reflects the current regime (green for long, yellow for neutral, orange for short).
o Colors your candles to match the active signal.
o Optional “Long”/“Short” labels on confirmed flips.
o Alert conditions fire on each long/short crossover.
• 📊 On-Chart Backtest Metrics
o Toggle on a small performance table—complete with win-rate, net P/L, drawdown—from your chosen start date, without any extra code.
⚙️ How It Works
1. Adaptive Smoothing (ALMA)
o Uses ALMA (Arnaud Legoux Moving Average) for smooth, low-lag filtering. In this script, the inputs are additionally pre-smoothed with DEMA(30) to reduce noise before ALMA is applied—improving stability on highs/lows.
2. Percentile Lines
o The High ALMA series feeds a linear-interpolation percentile function to generate the upper bound; the Low ALMA produces the lower bound.
o These lines are offset by a small look-ahead (X bars) to reduce repaint behavior.
3. Channel Logic
o Breakout Flip: When the selected source (default: Close) closes above the upper bound, the active threshold “jumps” to the lower bound—locking in a new channel until price next crosses.
o Breakdown Flip: Conversely, a close below the lower bound flips the threshold to the upper bound.
4. Signal Generation
o Long while the source is above the current “final” threshold.
o Short while below.
o Neutral inside the channel before any flip.
5. Visualization & Alerts
o Dynamic fills between the two percentile lines change hue as the regime flips.
o Candles adopt the regime color.
o Optional pinned “Long”/“Short” labels at flip bars.
o Alerts on every signal crossover of the zero-based regime line.
6. Backtest Table
o From your chosen start date, a mini-table displays cumulative P/L, win rate and drawdown for this strategy—handy for quick in-chart validation.
🎯 Who Should Use It
• Breakout Traders hunting for adaptive channels that auto-recenter on new highs/lows.
• Volatility Traders who want thresholds that expand and contract with market turbulence.
• Trend-Chasers seeking a fresh take on high/low channels with built-in smoothing.
• Systematic Analysts who appreciate on-chart backtesting without leaving TradingView.
⚙️ Default Settings
• ALMA Length: 14
• Percentile Length: 35 bars
• Percentile Lookback Period (offset): 4 bars
• Upper Percentile: 92%
• Lower Percentile: 50%
• Threshold Source: Close
• Visuals: Candle coloring on, labels off by default, “Strategy” palette
• Backtest Table: on by default (toggleable)
• Start Date (Backtest): 09 Oct 2017
📌 Conclusion
IDAHL blends two smooth, low-lag ALMA filters (fed by DEMA-smoothed highs/lows) with percentile-based channel construction for a self-rewiring high/low envelope. It gives you robust breakout/breakdown signals, immediate visual context via colored fills and candles, optional labels, alerts, and even performance stats—everything you need to spot and confirm regime shifts in one compact script.
🔹 Disclaimer : Past performance is not indicative of future results. Always backtest and align settings with your risk tolerance and objectives before live trading.
🔹 Strategic Advice : Always backtest, optimize, and align parameters with your trading objectives and risk tolerance before live trading.
Smart Money Concepts with EMA + RSI - DrSafDescription
This indicator combines LuxAlgo’s Smart Money Concepts (SMC) framework with a trend and momentum confluence system.
Core Features:
Swing & internal BOS / CHoCH
Order blocks, fair value gaps, equal highs/lows
Premium & discount zones
Multi-timeframe high/low levels
Added Filters:
EMA 21 / 50 / 200 trend alignment
Optional RSI 50 momentum filter
Clear long/short signals based on:
Swing CHoCH
Higher-timeframe trend alignment
Momentum confirmation
Signal Logic
Long: Bullish CHoCH + EMA bullish structure + RSI confirmation
Short: Bearish CHoCH + EMA bearish structure + RSI confirmation
Designed for non-repainting execution, clean chart structure or systematic trading.
Indicator plots EMA 21, EMA 50, and EMA 200 to define trend structure and dynamic support/resistance.
EMA 200: overall trend bias
EMA 21 and EMA 50: pullback support for high probability trend entries.
EMA 21/50 crosses highlight momentum shifts but are not intended as standalone entry signals.
License
Based on LuxAlgo Smart Money Concepts
CC BY-NC-SA 4.0 (Non-Commercial)
Account GuardianAccount Guardian: Dynamic Risk/Reward Overlay
Introduction
Account Guardian is an open-source indicator for TradingView designed to help traders evaluate trade setups before entering positions. It automatically calculates Risk-to-Reward ratios based on market structure, displays visual Stop Loss and Take Profit zones, and provides real-time position sizing recommendations.
The indicator addresses a fundamental question every trader should ask before entering a trade: "Does this setup make mathematical sense?" Account Guardian answers this question visually and numerically, helping traders avoid impulsive entries with poor risk profiles.
Core Functionality
Account Guardian performs four primary functions:
Detects swing highs and swing lows to identify logical stop loss placement levels
Calculates Risk-to-Reward ratios for both long and short setups in real-time
Displays visual SL/TP zones on the chart for immediate trade planning
Computes position sizing based on your account size and risk tolerance
The goal is to provide traders with instant feedback on whether a potential trade meets their minimum risk/reward criteria before committing capital.
How It Works
Swing Detection
The indicator uses pivot point detection to identify recent swing highs and swing lows on the chart. These swing points serve as logical areas for stop loss placement:
For Long Trades: The most recent swing low becomes the stop loss level. Price breaking below this level would invalidate the bullish thesis.
For Short Trades: The most recent swing high becomes the stop loss level. Price breaking above this level would invalidate the bearish thesis.
The swing detection lookback period is configurable, allowing you to adjust sensitivity based on your trading timeframe and style.
It automatically adjusts the tp and sl when it is applied to your chart so it is always moving up and down!
Risk/Reward Calculation
Once swing levels are identified, the indicator calculates:
Entry Price: Current close price (where you would enter)
Stop Loss: Recent swing low (for longs) or swing high (for shorts)
Risk: Distance from entry to stop loss
Take Profit: Entry plus (Risk × Target Multiplier)
R:R Ratio: Reward divided by Risk
The R:R ratio is then evaluated against your configured thresholds to determine if the setup is valid, marginal, or poor.
Visual Elements
SL/TP Zones
When enabled, the indicator draws colored boxes on the chart showing:
Red Zone: Stop Loss area - the region between your entry and stop loss
Green/Gold/Red Zone: Take Profit area - colored based on R:R quality
The color coding provides instant visual feedback:
Green: R:R meets or exceeds your "Good R:R" threshold (default 3:1)
Gold: R:R meets minimum threshold but below "Good" (between 2:1 and 3:1)
Red: R:R below minimum threshold - setup should be avoided
Swing Point Markers
Small circles mark detected swing points on the chart:
Green circles: Swing lows (potential support / long SL levels)
Red circles: Swing highs (potential resistance / short SL levels)
Dashboard Panel
The dashboard in the top-right corner displays comprehensive trade planning information:
R:R Row: Current Risk-to-Reward ratio for long and short setups
Status Row: VALID, OK, BAD, or N/A based on R:R thresholds
Stop Loss Row: Exact price level for stop loss placement
Take Profit Row: Exact price level for take profit placement
Pos Size Row: Recommended position size based on your risk parameters
Risk $ Row: Dollar amount at risk per trade
Position Sizing Logic
The indicator calculates position size using the formula:
Position Size = Risk Amount / Risk per Unit
Where:
Risk Amount = Account Size × (Risk Percentage / 100)
Risk per Unit = Entry Price - Stop Loss Price
For example, with a $10,000 account risking 1% per trade ($100), if your entry is at 100 and stop loss at 98 (risk of 2 per unit), your position size would be 50 units.
Input Parameters
Swing Detection:
Swing Lookback: Number of bars to look back for pivot detection (default: 10). Higher values find more significant swing points but may be slower to update.
Target Multiplier: Multiplier applied to risk to calculate take profit distance (default: 2). A value of 2 means TP is 2× the distance of SL from entry.
Risk/Reward Thresholds:
Minimum R:R: Minimum acceptable Risk-to-Reward ratio (default: 2.0). Setups below this show as "BAD" in red.
Good R:R: Threshold for excellent setups (default: 3.0). Setups at or above this show as "VALID" in green.
Account Settings:
Account Size ($): Your trading account size in dollars (default: 10,000). Used for position sizing calculations.
Risk Per Trade (%): Percentage of account to risk per trade (default: 1.0%). Professional traders typically risk 0.5-2% per trade.
Display:
Show SL/TP Zones: Toggle visibility of the colored zone boxes on chart (default: enabled)
Show Dashboard: Toggle visibility of the information panel (default: enabled)
Analyze Direction: Choose to analyze Long only, Short only, or Both directions (default: Both)
How to Use This Indicator
Basic Workflow:
Add the indicator to your chart
Configure your account size and risk percentage in the settings
Set your minimum and good R:R thresholds based on your trading rules
Look at the dashboard to see current R:R for potential long and short entries
Only consider trades where the status shows "VALID" or at minimum "OK"
Use the displayed SL and TP levels for your order placement
Use the position size recommendation to determine lot/contract size
Interpreting the Dashboard:
VALID (Green): Excellent setup - R:R meets your "Good" threshold. This is the ideal scenario for taking a trade.
OK (Gold): Acceptable setup - R:R meets minimum but isn't optimal. Consider taking if other confluence factors align.
BAD (Red): Poor setup - R:R below minimum threshold. Avoid this trade or wait for better entry.
N/A (Gray): Cannot calculate - usually means no valid swing point detected yet.
Best Practices:
Use this indicator as a filter, not a signal generator. It tells you IF a trade makes sense, not WHEN to enter.
Combine with your existing entry strategy - use Account Guardian to validate setups from other analysis.
Adjust the swing lookback based on your timeframe. Lower timeframes may need smaller lookback values.
Be honest with your account size input - accurate position sizing requires accurate inputs.
Consider the target multiplier carefully. Higher multipliers mean larger potential reward but lower probability of hitting TP.
Alerts
The indicator includes four alert conditions:
Good Long Setup: Triggers when long R:R reaches or exceeds your "Good R:R" threshold
Good Short Setup: Triggers when short R:R reaches or exceeds your "Good R:R" threshold
Bad Long Setup: Triggers when long R:R falls below your minimum threshold
Bad Short Setup: Triggers when short R:R falls below your minimum threshold
These alerts can help you monitor multiple charts and get notified when favorable setups appear.
Technical Implementation
The indicator is built using Pine Script v6 and includes:
Pivot-based swing detection using ta.pivothigh() and ta.pivotlow()
Dynamic box drawing for visual SL/TP zones
Table-based dashboard for clean information display
Color-coded visual feedback system
Persistent variable tracking for swing levels
Code Structure:
// Swing Detection
float swingHi = ta.pivothigh(high, swingLen, swingLen)
float swingLo = ta.pivotlow(low, swingLen, swingLen)
// R:R Calculation for Long
float longSL = recentSwingLo
float longRisk = entry - longSL
float longTP = entry + (longRisk * targetMult)
float longRR = (longTP - entry) / longRisk
// Position Sizing
float riskAmount = accountSize * (riskPct / 100)
float posSize = riskAmount / longRisk
Limitations
The indicator uses historical swing points which may not always represent optimal SL placement for your specific strategy
Position sizing assumes you can trade fractional units - adjust accordingly for instruments with minimum lot sizes
R:R calculations assume linear price movement and don't account for gaps or slippage
The indicator doesn't predict price direction - it only evaluates the mathematical viability of a setup
Swing detection has inherent lag due to the lookback period required for pivot confirmation
Recommended Settings by Trading Style
Scalping (1-5 minute charts):
Swing Lookback: 5-8
Target Multiplier: 1-2
Minimum R:R: 1.5
Good R:R: 2.0
Day Trading (15-60 minute charts):
Swing Lookback: 8-12
Target Multiplier: 2
Minimum R:R: 2.0
Good R:R: 3.0
Swing Trading (4H-Daily charts):
Swing Lookback: 10-20
Target Multiplier: 2-3
Minimum R:R: 2.5
Good R:R: 4.0
Why Risk/Reward Matters
Many traders focus solely on win rate, but profitability depends on the combination of win rate AND risk/reward ratio. Consider these scenarios:
50% win rate with 1:1 R:R = Breakeven (before costs)
50% win rate with 2:1 R:R = Profitable
40% win rate with 3:1 R:R = Profitable
60% win rate with 1:2 R:R = Losing money
Account Guardian helps ensure you only take trades where the math works in your favor, even if you're wrong more often than you're right.
Disclaimer
This indicator is provided for educational and informational purposes only. It is not intended as financial, investment, trading, or any other type of advice or recommendation.
Trading involves substantial risk of loss and is not suitable for all investors. The calculations provided by this indicator are based on historical price data and mathematical formulas that may not accurately predict future price movements.
Position sizing recommendations are estimates based on user inputs and should be verified before placing actual trades. Always consider factors such as leverage, margin requirements, and broker-specific rules when determining actual position sizes.
The Risk-to-Reward ratios displayed are theoretical calculations based on swing point detection. Actual trade outcomes will vary based on market conditions, execution quality, and other factors not captured by this indicator.
Past performance does not guarantee future results. Users should thoroughly test any trading approach in a demo environment before risking real capital. The authors and publishers of this indicator are not responsible for any losses or damages arising from its use.
Always consult with a qualified financial advisor before making investment decisions.
Hurst-Optimized Adaptive Channel [Kodexius]Hurst-Optimized Adaptive Channel (HOAC) is a regime-aware channel indicator that continuously adapts its centerline and volatility bands based on the market’s current behavior. Instead of using a single fixed channel model, HOAC evaluates whether price action is behaving more like a trend-following environment or a mean-reverting environment, then automatically selects the most suitable channel structure.
At the core of the engine is a robust Hurst Exponent estimation using R/S (Rescaled Range) analysis. The Hurst value is smoothed and compared against user-defined thresholds to classify the market regime. In trending regimes, the script emphasizes stability by favoring a slower, smoother channel when it proves more accurate over time. In mean-reversion regimes, it deliberately prioritizes a faster model to react sooner to reversion opportunities, similar in spirit to how traders use Bollinger-style behavior.
The result is a clean, professional adaptive channel with inner and outer bands, dynamic gradient fills, and an optional mean-reversion signal layer. A minimalist dashboard summarizes the detected regime, the current Hurst reading, and which internal model is currently preferred.
🔹 Features
🔸 Robust Regime Detection via Hurst Exponent (R/S Analysis)
HOAC uses a robust Hurst Exponent estimate derived from log returns and Rescaled Range analysis. The Hurst value acts as a behavioral filter:
- H > Trend Start threshold suggests trend persistence and directional continuation.
- H < Mean Reversion threshold suggests anti-persistence and a higher likelihood of reverting toward a central value.
Values between thresholds are treated as Neutral, allowing the channel to remain adaptive without forcing a hard bias.
This regime framework is designed to make the channel selection context-aware rather than purely reactive to recent volatility.
🔸 Dual Channel Engine (Fast vs Slow Models)
Instead of relying on one fixed channel, HOAC computes two independent channel candidates:
Fast model: shorter WMA basis and standard deviation window, intended to respond quickly and fit more reactive environments.
Slow model: longer WMA basis and standard deviation window, intended to reduce noise and better represent sustained directional flow.
Each model produces:
- A midline (basis)
- Outer bands (wider deviation)
- Inner bands (tighter deviation)
This structure gives you a clear core zone and an outer envelope that better represents volatility expansion.
🔸 Rolling Optimization Memory (Model Selection by Error)
HOAC includes an internal optimization layer that continuously measures how well each model fits current price action. On every bar, each model’s absolute deviation from the basis is recorded into a rolling memory window. The script then compares total accumulated error between fast and slow models and prefers the one with lower recent error.
This approach does not attempt curve fitting on multiple parameters. It focuses on a simple, interpretable metric: “Which model has tracked price more accurately over the last X bars?”
Additionally:
If the regime is Mean Reversion, the script explicitly prioritizes the fast model, ensuring responsiveness when reversals matter most.
🔸 Optional Output Smoothing (User-Selectable)
The final selected channel can be smoothed using your choice of:
- SMA
- EMA
- HMA
- RMA
This affects the plotted midline and all band outputs, allowing you to tune visual stability and responsiveness without changing the underlying decision engine.
🔸 Premium Visualization Layer (Inner Core + Outer Fade)
HOAC uses a layered band design:
- Inner bands define the core equilibrium zone around the midline.
- Outer bands define an extended volatility envelope for extremes.
Gradient fills and line styling help separate the core from the extremes while staying visually clean. The midline includes a subtle glow effect for clarity.
🔸 Adaptive Bar Tinting Strength (Regime Intensity)
Bar coloring dynamically adjusts transparency based on how far the Hurst value is from 0.5. When market behavior is more decisively trending or mean-reverting, the tint becomes more pronounced. When behavior is closer to random, the tint becomes more subtle.
🔸 Mean-Reversion Signal Layer
Mean-reversion signals are enabled when the environment is not classified as Trending:
- Buy when price crosses back above the lower outer band
- Sell when price crosses back below the upper outer band
This is intentionally a “return to channel” logic rather than a breakout logic, aligning signals with mean-reversion behavior and avoiding signals in strongly trending regimes by default.
🔸 Minimalist Dashboard (HUD)
A compact table displays:
- Current regime classification
- Smoothed Hurst value
- Which model is currently preferred (Fast or Slow)
- Trend flow direction (based on midline slope)
🔹 Calculations
1) Robust Hurst Exponent (R/S Analysis)
The script estimates Hurst using a Rescaled Range approach on log returns. It builds a returns array, computes mean, cumulative deviation range (R), standard deviation (S), then converts RS into a Hurst exponent.
calc_robust_hurst(int length) =>
float r = math.log(close / close )
float returns = array.new_float(length)
for i = 0 to length - 1
array.set(returns, i, r )
float mean = array.avg(returns)
float cumDev = 0.0
float maxCD = -1.0e10
float minCD = 1.0e10
float sumSqDiff = 0.0
for i = 0 to length - 1
float val = array.get(returns, i)
sumSqDiff += math.pow(val - mean, 2)
cumDev += (val - mean)
if cumDev > maxCD
maxCD := cumDev
if cumDev < minCD
minCD := cumDev
float R = maxCD - minCD
float S = math.sqrt(sumSqDiff / length)
float RS = (S == 0) ? 0.0 : (R / S)
float hurst = (RS > 0) ? (math.log10(RS) / math.log10(length)) : 0.5
hurst
This design avoids simplistic proxies and attempts to reflect persistence (trend tendency) vs anti-persistence (mean reversion tendency) from the underlying return structure.
2) Hurst Smoothing
Raw Hurst values can be noisy, so the script applies EMA smoothing before regime decisions.
float rawHurst = calc_robust_hurst(i_hurstLen)
float hVal = ta.ema(rawHurst, i_smoothHurst)
This stabilized hVal is the value used across regime classification, dynamic visuals, and the HUD display.
3) Regime Classification
The smoothed Hurst reading is compared to user thresholds to label the environment.
string regime = "NEUTRAL"
if hVal > i_trendZone
regime := "TRENDING"
else if hVal < i_chopZone
regime := "MEAN REV"
Higher Hurst implies more persistence, so the indicator treats it as a trend environment.
Lower Hurst implies more mean-reverting behavior, so the indicator enables MR logic and emphasizes faster adaptation.
4) Dual Channel Models (Fast and Slow)
HOAC computes two candidate channel structures in parallel. Each model is a WMA basis with volatility envelopes derived from standard deviation. Inner and outer bands are created using different multipliers.
Fast model (more reactive):
float fastBasis = ta.wma(close, 20)
float fastDev = ta.stdev(close, 20)
ChannelObj fastM = ChannelObj.new(fastBasis, fastBasis + fastDev * 2.0, fastBasis - fastDev * 2.0, fastBasis + fastDev * 1.0, fastBasis - fastDev * 1.0, math.abs(close - fastBasis))
Slow model (more stable):
float slowBasis = ta.wma(close, 50)
float slowDev = ta.stdev(close, 50)
ChannelObj slowM = ChannelObj.new(slowBasis, slowBasis + slowDev * 2.5, slowBasis - slowDev * 2.5, slowBasis + slowDev * 1.25, slowBasis - slowDev * 1.25, math.abs(close - slowBasis))
Both models store their structure in a ChannelObj type, including the instantaneous tracking error (abs(close - basis)).
5) Rolling Error Memory and Model Preference
To decide which model fits current conditions better, the script stores recent errors into rolling arrays and compares cumulative error totals.
var float errFast = array.new_float()
var float errSlow = array.new_float()
update_error(float errArr, float error, int maxLen) =>
errArr.unshift(error)
if errArr.size() > maxLen
errArr.pop()
Each bar updates both error histories and computes which model has lower recent accumulated error.
update_error(errFast, fastM.error, i_optLookback)
update_error(errSlow, slowM.error, i_optLookback)
bool preferFast = errFast.sum() < errSlow.sum()
This is an interpretable optimization approach: it does not attempt to brute-force parameters, it simply prefers the model that has tracked price more closely over the last i_optLookback bars.
6) Winner Selection Logic (Regime-Aware Hybrid)
The final model selection uses both regime and rolling error performance.
ChannelObj winner = regime == "MEAN REV" ? fastM : (preferFast ? fastM : slowM)
rawMid := winner.mid
rawUp := winner.upper
rawDn := winner.lower
rawUpInner := winner.upper_inner
rawDnInner := winner.lower_inner
In Mean Reversion, the script forces the fast model to ensure responsiveness.
Otherwise, it selects the lowest-error model between fast and slow.
7) Optional Output Smoothing
After the winner is selected, the script optionally smooths the final channel outputs using the chosen moving average type.
smooth(float src, string type, int len) =>
switch type
"SMA" => ta.sma(src, len)
"EMA" => ta.ema(src, len)
"HMA" => ta.hma(src, len)
"RMA" => ta.rma(src, len)
=> src
float finalMid = i_enableSmooth ? smooth(rawMid, i_smoothType, i_smoothLen) : rawMid
float finalUp = i_enableSmooth ? smooth(rawUp, i_smoothType, i_smoothLen) : rawUp
float finalDn = i_enableSmooth ? smooth(rawDn, i_smoothType, i_smoothLen) : rawDn
float finalUpInner = i_enableSmooth ? smooth(rawUpInner, i_smoothType, i_smoothLen) : rawUpInner
float finalDnInner = i_enableSmooth ? smooth(rawDnInner, i_smoothType, i_smoothLen) : rawDnInner
This preserves decision integrity since smoothing happens after model selection, not before.
8) Dynamic Visual Intensity From Hurst
Transparency is derived from the distance of hVal to 0.5, so stronger behavioral regimes appear with clearer tints.
int dynTrans = int(math.max(20, math.min(80, 100 - (math.abs(hVal - 0.5) * 200))))
The Strat: 3-2D Setup Label + Entry, Target & AlertsThis is an indicator that identifies the 3-2D setup based on TheStrat & will alert you if you have this on the chart. Once the 3-2D setup happens this will give you the entry, target and price labels. You can change the font size, label colors and add optional alerts.
3 EMA IndicatorThis indicator is a combination og three EMA's
This indicator is a combination og three EMA's
This indicator is a combination og three EMA's
This indicator is a combination og three EMA's
This indicator is a combination og three EMA's
The Strat Candle Types (1 / 2U / 2D / 3)This script uses TheStrat candle numbers 1, 2D, 2U, 3 and places the text below or above. You can also change the text size. This also allows you to change the colors of the candles with two options for the 1 & 3 so you can color them in the direction they are going. For example a 1 that is green can be green and a 1 that is red can be red.
50SMA bounceScans stocks that closed above Weekly 10SMA and previous week closing below the weekly 10SMA






















