Zen Measured Moves - Price Extension Targets Based on Prior Bar Overview
Zen Measured Moves identifies potential price extension targets by projecting the prior bar's range forward from breakout points. This indicator helps traders anticipate how far price might travel after breaking above a prior high or below a prior low.
How It Works
The indicator calculates three measured move targets in each direction:
Bullish Targets (from prior bar's high):
0.5x - Half the prior range (50% extension)
1x - Full prior range (100% extension)
2x - Double the prior range (200% extension)
Bearish Targets (from prior bar's low):
0.5x - Half the prior range (50% extension)
1x - Full prior range (100% extension)
2x - Double the prior range (200% extension)
Visual Signals
Blue circles above bars indicate bullish measured moves achieved:
Light blue (tiny) = 0.5x target hit
Medium blue (small) = 1x target hit
Dark blue (normal) = 2x target hit
Red circles below bars indicate bearish measured moves achieved:
Light red (tiny) = 0.5x target hit
Medium red (small) = 1x target hit
Dark red (normal) = 2x target hit
Data Window Outputs
All calculated values are available in the Data Window for analysis or export to Excel:
Target hit indicators (1/0 boolean values)
Actual target price levels
Bar type classifications (bullish/bearish)
Range measurements
Internal Bar Strength (IBS) values
Use Cases
Identify potential profit targets after breakouts
Gauge momentum strength by which targets are reached
Filter for high-momentum vs low-momentum moves
Backtest measured move reliability on your instruments
Export data for statistical analysis in Excel
Best Practices
Works on any timeframe or instrument
Most effective when prior bar has clear directional bias
Consider combining with volume or other confirmation indicators
Use IBS values to assess entry/exit quality within bars
インジケーターとストラテジー
stelaraX - SupertrendstelaraX – Supertrend
stelaraX – Supertrend is a trend-following indicator based on the Average True Range (ATR). It dynamically adapts to market volatility and provides clear visual guidance for identifying bullish and bearish trend phases directly on the chart.
This indicator is part of the stelaraX ecosystem, focused on clean technical analysis and AI-supported chart evaluation.
stelarax.com
Core logic
The Supertrend is calculated using two user-defined parameters:
* ATR period
* volatility factor
The indicator uses ATR-based price bands to determine trend direction:
* bullish trend when price holds above the Supertrend level
* bearish trend when price holds below the Supertrend level
When price crosses the Supertrend line, the trend direction flips accordingly. The ATR factor controls the sensitivity of trend changes, with higher values producing fewer but stronger signals.
Visualization
The script plots a single Supertrend line directly on the price chart:
* green color during bullish trends
* red color during bearish trends
* broken line style to clearly show trend transitions
The minimalist design ensures that trend direction is immediately visible without cluttering the chart.
Use case
This indicator is intended for:
* identifying and following market trends
* defining dynamic trailing stop levels
* filtering trades in the direction of the dominant trend
* trend confirmation in combination with other indicators
For traders looking to combine classical trend tools with modern AI-driven chart analysis, additional tools and insights are available at stelarax.com
Disclaimer
This indicator is provided for educational and technical analysis purposes only and does not constitute financial advice or trading recommendations. All trading decisions and risk management remain the responsibility of the user.
Intraday Cumulative Volume RatioThis indicator is designed to reveal the true order flow dominance from the start of the trading session. Unlike standard oscillators, it calculates the exact ratio between cumulative buying and selling volume using high-precision intrabar data.
It answers a simple question: "How many times stronger is the buying pressure compared to selling pressure (or vice versa) since the market opened?"
Key Features:
Zero-Based Ratio:
0.0 = Perfectly balanced market (1:1).
+1.0 = Buyers have 2x more volume than sellers.
+2.0 = Buyers have 3x more volume than sellers.
Negative values indicate seller dominance.
Intrabar Precision: Uses lower timeframe data (e.g., 1-minute) to look inside higher timeframe candles for accurate volume classification.
"Market Fuel" Filter: Helps identify stocks with sufficient momentum at the open. If the ratio stays low (near 0), the stock lacks the "fuel" for a sustained move.
Clamp Function: Includes a built-in limiter (default 3.0) to prevent chart distortion caused by extreme volume anomalies at the market open.
How to use:
Identify Trend Strength: Look for values above +2.0 (or below -2.0) to confirm strong directional conviction.
Filter Weak Stocks: If the indicator hovers around 0, avoid trading as there is no clear order flow advantage.
Spot Divergences: If price makes a new high but the Ratio makes a lower high, the buying pressure is fading relative to selling pressure.
Settings:
Reset Period: Default is Daily (D).
Analytical Timeframe: Set to 1 (minute) for best accuracy.
Clamp Limit: Default is 3.0 to keep the chart readable.
SMC Structures and FVG RUPTURA & CONTINUACIONIt marks CONTINUATION (BOS) and BREAKOUT (CHOCH) of the trend just like other identical indicators, but with the difference that instead of appearing marked as BOS and CHoCH, here they appear as CONTINUATION and RUPTURA.
Sector Rotation & Allocation StrategySector Rotation & Allocation Strategy
Overview This advanced indicator analyzes the relationship between Defensive and Cyclical sectors to identify market regimes and generate precise buy/sell signals. It automatically detects which asset you're viewing and provides tailored recommendations based on current sector rotation dynamics.
What It Does Identifies Market Regime – Determines if markets are in Risk-On (growth) or Risk-Off (defensive) mode Auto-Detects Your Asset – Classifies the current chart into one of 11 sectors Generates Trading Signals – Provides BUY/SELL signals based on sector alignment with market conditions Multi-Timeframe Analysis – Offers allocation recommendations from 1 week to 12 months Value Assessment – Scores each asset 0-100 to determine if it's a good trade NOW
How It Works
Market Regime Detection The indicator compares Defensive Sectors (Health Care, Consumer Staples, Utilities) against Cyclical Sectors (Technology, Financials, Energy, Industrials, Materials, Real Estate, Discretionary, Communication).
Risk-On Market (Green, >0): Cyclical sectors outperforming Economic growth expected Investors favoring growth stocks Action : Buy cyclicals, reduce defensives
Risk-Off Market (Red, <0): Defensive sectors outperforming Uncertainty or fear in markets Flight to safety occurring Action : Buy defensives, reduce cyclicals
Understanding the Four Tables
1. MARKET REGIME (Top Left) Market Regime : Current state – RISK-ON or RISK-OFF Bias : Which sector type is favored right now Strength : STRONG/MODERATE/WEAK – conviction level Current Sector : Your asset's sector classification Signal : Trading recommendation for your specific asset
2. SECTOR RANKINGS (Top Right) Shows relative strength of all 11 sectors vs SPY benchmark. Rel Str : Percentage outperformance/underperformance vs market Signal : ✓ = Outperforming, ✗ = Underperforming, − = Neutral
3. ALLOCATION RECOMMENDATIONS (Bottom Center) Suggested portfolio allocation between Defensive and Cyclical sectors. 1 Week : Tactical – follows current regime closely (70/30 split) 1 Month : Near-term positioning (65/35 split) 3 Months : Medium-term allocation (60/40 split) 6 Months : Balanced approach (50/50 split) 12 Months : Strategic/Contrarian – assumes mean reversion (40/60 split)
4. ASSET ANALYSIS (Bottom Left) Sector : Auto-detected sector classification Value Rating : STRONG BUY / BUY / HOLD / REDUCE / AVOID Value Score : 0-100 numerical assessment Rel Strength : How this asset performs vs SPY Regime Fit : Is this asset aligned with current market regime?
Trading Signals Explained
BUY Signals Oscillator crosses above oversold (30) Asset's sector is gaining momentum Regime is favorable for that sector
SELL Signals Oscillator crosses below overbought (70) Asset's sector is losing momentum Regime is turning unfavorable for that sector
How Value Score Works (0-100)
Relative Strength (40 points max) : Asset outperforming SPY by 5%+ → 40 points Asset outperforming SPY by 2-5% → 30 points Asset outperforming SPY by 0-2% → 20 points Asset underperforming slightly → 10 points Asset underperforming significantly → 0 points
Sector Alignment (30 points max) : Defensive in Risk-Off OR Cyclical in Risk-On → 30 points Misaligned sector → 0 points Unclassified → 15 points
Momentum (30 points max) : RSI > 60 → 30 points RSI 50-60 → 20 points RSI 40-50 → 10 points RSI < 40 → 0 points
Interpretation : 80-100 : STRONG BUY – High conviction opportunity 65-79 : BUY – Favorable setup 45-64 : HOLD – No clear edge 30-44 : REDUCE – Unfavorable conditions 0-29 : AVOID – High risk of underperformance
Best Practices Use Daily Timeframe or Higher – More reliable signals Combine with Price Action – Confirm with support/resistance Monitor Regime Changes – Transitions offer the highest ROI Respect Risk Management – Always use stop losses Don't Fight the Regime – Buying defensives during Risk-On is low probability
Disclaimer This indicator is for educational and informational purposes only. Past performance does not guarantee future results. Conduct your own research before making investment decisions.
Version: 6.0 Author: @bigcitytom Last Updated: February 2026
Precision Entry Systementry system for smc and ict with order blocks and fvgs to make sniper entries and precision and quick execution
Rhokeo-VW-RSI Histogram for Cumulative Delta by ZeiirmanRhokeo-VW-RSI Histogram: Volume-Weighted Momentum (use with Cumulative Delta from Zeiierman) Note that Cumulative Delta is a paid indicator.
Overview: The Rhokeo-VW-RSI Histogram is a momentum oscillator designed to filter out market noise by integrating volume directly into the RSI calculation. Unlike a standard RSI, which only considers price change, this indicator weights those changes by the volume occurring at the time.
It creates a momentum profile in the form of a Histogram. If the price moves on high volume, the indicator reflects that strong market interest through its volume-weighted gain and loss calculations. It is particularly effective as a complementary filter for “Cumulative Delta” from Zeiierman to confirm the strength behind a move before you enter a trade.
How It Works The indicator operates on a normalized scale of -1.0 to +1.0 for easier visual interpretation and compatibility with Cumulative Delta indicator:
• The Volume-Weighted Core: Gains and losses are calculated by multiplying the price change by volume to ensure the "Relative Strength" reflects true capital flow.
• Smoothing for Clarity: The raw Volume Weighted RSI (VW-RSI) is processed through a customizable Moving Average—such as SMA, EMA, SMMA, WMA, or VWMA—to produce the smooth histogram.
• Four-Zone Coloring System: The histogram changes color dynamically based on momentum intensity:
o Strong Bull: Price is trending up with high-volume conviction.
o Weak Bull: Positive momentum, but not yet overextended.
o Weak Bear: Negative momentum starting to build.
o Strong Bear: Heavy selling pressure with high-volume conviction.
Key Features
• Shading: The background features optional red and green shading in the "Extreme" zones to warn traders of potential exhaustion areas.
• Dynamic Zero Line: The center line flips color between Green and Red based on whether the VW-RSI is positive or negative.
• Customization: Traders can adjust the smoothing length, source price, and the specific levels for overbought/oversold zones.
Best Use Case for New Traders: New traders often get "faked out" by price spikes that have no volume behind them. This indicator helps confirm and time better entries:
1. Wait for your Cumulative Delta indicator to give a signal.
2. Check the VW-RSI Histogram and whether it confirms or not.
3. Long Entry: Only enter if the histogram is positive and rising (above 0).
4. Short Entry: Only enter if the histogram is negative and decreasing (below 0).
________________________________________
Disclaimer
Financial Risk:
• Trading involves significant risk, and most traders lose money.
• This indicator is a tool for technical analysis and does not constitute financial, investment, or trading advice.
• Past performance is not indicative of future results; never trade with money you cannot afford to lose.
Usage & Reliability:
• The Rhokeo-VW-RSI Histogram is provided "as-is" for educational and informational purposes only.
• While volume-weighting aims to filter market noise, no indicator can guarantee 100% accuracy or predict future market movements with certainty.
• This script is intended to be a complementary tool that works well with other indicators in this case the Cumulative Delta from Zeiirman; it should be used in conjunction with other forms of analysis, risk management, and your own due diligence.
Commercial Notice:
• If you are using this alongside a third-party paid indicator, please note that I am not responsible for the performance or support of external products.
• Users are responsible for their own trade execution and account management.
SBP Smart Trade Navigator [Multi-Phase] Key Features — SBP Smart Trade Navigator
✅ 1. Multi-Phase Trend Engine
Uses ATR-based Trend Guard to identify primary market direction
Filters false signals during sideways markets
Automatically adapts to volatility
✅ 2. Adaptive Flow Confirmation
Dynamic weighted moving average based on volatility
Confirms trend strength before entries
Helps avoid weak breakouts
✅ 3. PMR Trend Ribbon System
Dual-wave smoothing structure
Visual momentum ribbon for trend clarity
Green/Red zones indicate bullish/bearish pressure
✅ 4. Smart Trend Smoother (Sigmoid Engine)
Advanced smoothing algorithm
Reduces noise without lag
Acts as dynamic support/resistance
✅ 5. Power Momentum Filter
Normalized impulse detection
Identifies high-energy candles
Filters low-quality entries
✅ 6. Multi-Confirmation Entry System
Score-based entry validation
Requires multiple technical agreements
Improves signal reliability
✅ 7. Non-Repainting Signals
Uses candle-close confirmation
No historical repainting
Reliable backtesting results
✅ 8. Intelligent Signal Spacing
Volatility-based label positioning
Clean and readable charts
No overlapping signals
✅ 9. Built-In Risk & Exit Logic
EMA compression exit system
Early warning for momentum loss
Helps manage open trades
✅ 10. Re-Entry & Continuation Detection
Identifies fresh trend continuation zones
Allows structured re-entries
Avoids overtrading
✅ 11. Fully Customizable Interface
Toggle each component on/off
Separate control groups
Works on all timeframes
✅ 12. Multi-Asset Compatible
Works on:
Stocks
Indices
Forex
Crypto
Futures
Optimized for intraday and swing trading
📈 Best Use Guidelines (Optional Section)
Works best in trending markets
Combine with support/resistance
Avoid low-volume periods
User Notice
⚠️ Always use proper stop-loss and risk management.
No trading system is perfect, and losses are part of trading.
⭐ If this indicator helps you, kindly support it by liking and boosting.
Your feedback in the comments is highly appreciated and will help improve future upgrades.
💬 Please share your suggestions on what features you would like to see added or improved.
CRR HH LL EMASCRR – EMAs (Price Floors) v4 – Stick Right is an educational chart overlay designed to help traders visualize market structure and price context, not to generate trading signals.
This indicator is built around two core concepts:
EMA-based price structure
Clear visual references anchored to the most recent confirmed bar
What this indicator IS
A visual tool to display EMA structure (20 / 50 / 100 / 200)
A way to observe dynamic support and resistance
A helper to understand trend alignment, compression, and expansion
A non-repainting overlay anchored to the last completed bar
A tool intended for discretionary and educational analysis
What this indicator IS NOT
It is not a buy or sell signal generator
It does not predict future price
It is not a trading strategy
It does not provide financial or investment advice
It does not guarantee profitability
How it works
The indicator plots four Exponential Moving Averages:
EMA 20
EMA 50
EMA 100
EMA 200
Each EMA can optionally display:
A horizontal price floor line extending to the right
A value tag showing the exact EMA price
All tags and price floors are calculated using the latest confirmed bar and extend forward only for visual reference.
Nothing is projected into the future, and nothing repaints.
The Stick Right behavior ensures that EMA labels remain readable and stable when scrolling or changing chart zoom levels.
How traders typically use it
Traders commonly use this indicator to:
Identify trend direction and EMA stacking
Observe how price reacts around EMA zones
Combine EMA structure with their own price action, volume, or higher-timeframe analysis
Maintain a clean chart while keeping key structural levels visible
Disclaimer
This script is provided for educational and informational purposes only.
It does not constitute financial advice, trading advice, or investment recommendations.
Trading involves risk, and users are fully responsible for their own decisions.
Grop-Nai-Ya Mae-Pla Pak-Ka-Khiao [Adjustable Dynamic Price Grid]Adjustable Dynamic Round Price Grid 0,5
Called in Thai as Grob Nai-Ya used in XAU/USD Trading system named "Mae-Pla Pak-Ka-Khiao"
MSOFP BY JONATHAN MWENDWA NDUNGEMSOFP BY JONATHAN MWENDWA NDUNGE
(Market Structure & Order Flow Proxy)
MSOFP is an institutional-style market analysis indicator designed to identify high-probability trend continuation and reversal zones by combining market structure, liquidity behavior, and volatility conditions into a single confidence model.
Instead of relying on lagging signals, MSOFP focuses on how price interacts with recent swing highs and lows, which are widely recognized in professional trading as areas where liquidity accumulates and large participants execute positions.
Core Logic
The indicator measures three primary components that research and market microstructure studies consistently link with sustained price movement:
1. Market Structure
Detects higher lows and lower highs to confirm bullish or bearish structure.
Helps distinguish trending environments from consolidation phases.
2. Liquidity Sweep Detection
Identifies when price breaks beyond recent swing points.
These events often occur where stop orders cluster, creating momentum bursts.
3. Volatility Regime Filter
Uses ATR-based normalization to determine whether the market has sufficient movement.
Filters out low-volatility conditions where false breakouts are more common.
These factors are combined into a Trend Confidence Score, which quantifies the strength of directional bias instead of relying on subjective visual interpretation.
How to Read the Indicator
Positive confidence values suggest bullish pressure.
Negative confidence values suggest bearish pressure.
Strong signals appear only when structure, volatility, and liquidity behavior align.
Arrows mark potential high-probability continuation zones.
The histogram represents the strength of participation behind the move, helping traders avoid weak trends.
Why This Matters
Institutional and professional trading models often rely on:
Structure confirmation
Liquidity events
Volatility expansion
MSOFP translates these principles into a practical visual framework that helps traders:
Reduce false breakouts
Avoid low-quality market conditions
Identify periods of genuine directional intent
Best Use Case
MSOFP is designed to complement trend-following systems such as Donchian or ribbon-based indicators by acting as a confirmation and filtering engine before trade execution.
For optimal results, combine it with:
Higher timeframe trend bias
Risk-managed entries
Structured exits
Author: Jonathan Mwendwa Ndunge
ATR Action (Signed) + Signals + ConfidenceATR Action (Signed) — Context-Aware Volatility Signals with Confidence Scoring
ATR Action (Signed) is a volatility-normalized indicator designed to answer a simple but often overlooked question:
Was today’s move meaningful — or just noise?
Instead of measuring raw price change, this indicator compares today’s percent move to the instrument’s typical daily volatility, expressed as a normalized, signed value called ATR Action.
What makes this different
Most ATR-based tools measure range.
This script measures directional impact.
ATR Action answers:
How large was today’s move relative to normal volatility?
Was the move statistically notable or routine?
Did it occur with or against the prevailing trend?
By combining volatility normalization, trend context, and signal classification, the indicator helps distinguish:
Noise vs. meaningful expansion
Opportunistic dips vs. structural weakness
Momentum continuation vs. exhaustion
Core Concepts
ATR% (Average Daily Volatility)
Calculated as the average absolute daily percent move over a user-defined period.
This provides a “daily noise baseline” specific to each instrument.
ATR Action (Signed)
ATR Action = Today’s % Change ÷ ATR%
Positive values = up days
Negative values = down days
|1.0| ≈ normal daily move
|1.5+| = unusually large move
|2.5+| = extreme move
This allows consistent interpretation across stocks, crypto, and ETFs.
Signals (context-aware)
Signals are generated only when volatility expansion is meaningful and interpreted through trend context:
BUY / ADD
Large down day within an uptrend (potential shakeout)
MOMENTUM
Large up day within an uptrend
TRIM / SELL
Large up day within a downtrend
RISK-OFF
Large down day within a downtrend
No signals are generated during normal volatility.
Confidence Score (0–100)
Each signal includes a confidence score, derived from:
Magnitude beyond volatility thresholds
Alignment with trend direction
This is not a probability — it is a relative strength gauge to help compare setups and manage position sizing.
On-Chart Table & Explainer
The indicator includes:
A compact table showing ATR Action, ATR%, today’s move, trend state, signal, and confidence
An optional Explainer Panel (toggleable in settings) that documents each metric directly on the chart for transparency and education
Intended Use
ATR Action is designed for:
Swing traders and position traders
Scaling in/out rather than binary entries
Comparing volatility events across different instruments
Filtering emotional reactions during high-volatility periods
It does not predict direction and does not repaint.
Final Notes
This script emphasizes context over prediction.
Large moves matter — but only when viewed relative to normal behavior and prevailing trend.
Use ATR Action to frame decisions, not replace them.
SMART TRADER 2 BY JONATHAN MWENDWA NDUNGESMART TRADER 2 BY JONATHAN MWENDWA NDUNGE is a professional-grade Donchian Trend Ribbon indicator designed for serious traders seeking clarity, precision, and reliability in trend analysis. Combining classic Donchian Channel logic with modern technical filters, this indicator identifies strong bullish and bearish trends while filtering out false breakouts and market noise.
Key Features:
Multi-Timeframe Support: Analyze trends from higher timeframes without leaving your chart.
Acceptance Candle Filter: Reduces false signals by requiring trend confirmation across multiple bars.
ADX Trend Strength Filter: Ensures trades are only signaled in strong trending conditions.
ATR Volatility Buffer: Accounts for market volatility to reduce whipsaws.
Dual Donchian (20/55) Option: Align short-term and long-term trend signals for higher accuracy.
Ribbon Alignment Scoring: Quantifies trend strength visually and numerically; strong trend signals appear when multiple ribbons align.
Non-Repainting & Backtest-Friendly: Ideal for both live trading and strategy backtesting.
This indicator is suitable for traders of all experience levels who want a robust trend-following tool that balances responsiveness with reliability.
Usage:
Green ribbons indicate bullish trends, red ribbons indicate bearish trends.
Long and short signals appear only when all filters align, helping traders avoid false breakouts.
Combine with your own risk management and confirmation strategies for optimal results.
Author: Jonathan Mwendwa Ndunge
Adaptive Structure Trend Engine (ASTE)Adaptive Structure Trend Engine (ASTE)
Adaptive Structure Trend Engine (ASTE) is a non-repainting, multi-layer trend analysis indicator designed to help traders identify high-quality directional opportunities using market structure and adaptive moving averages. ASTE focuses on trend clarity, confirmation, and signal cleanliness, avoiding indicator noise and repeated signals.
🔍 Core Components
ASTE combines four powerful concepts into a single, structured framework:
• FRAMA (Fractal Adaptive Moving Average)
Detects market structure and directional slope changes.
• KAMA (Kaufman Adaptive Moving Average)
Measures price efficiency and regime stability.
• JMA (Jurik-style Moving Average)
Provides smooth momentum confirmation with minimal lag.
• EMA Hierarchy (21/50 + 50/100/150/200)
Validates trend strength and higher-order alignment.
📊 Signal Types
ASTE produces state-based signals (no repeated alerts on every bar):
1️⃣ Base Signal
Single tiny triangle
• FRAMA slope alignment
• KAMA direction confirmation
• JMA momentum confirmation
• EMA 21/50 trend validation
2️⃣ Strong Signal
Two stacked triangles
• All Base Signal conditions
• PLUS EMA 50/100/150/200 full trend confluence
Signals remain active until an opposite signal of the same type appears.
🎨 Visual Design
• Clean stacked triangle system
• No repainting
• No signal spam
• EMA band with gradual color transition
• Fully configurable visibility options
⚙️ User Controls
• Adjust FRAMA, KAMA, and JMA lengths
• Toggle Base / Strong signals
• Show or hide EMA band
• Works on all markets and timeframes
⚠️ Disclaimer
This indicator is provided for educational and analytical purposes only. It does not constitute financial advice or trade recommendations. Always use proper risk management and confirm signals with additional analysis. Past performance does not guarantee future results.
DafeSPALibDafeSPALib: The Shadow Portfolio Adaptation & Strategy Selection Engine
This is not a backtester. This is a live, adaptive portfolio manager. It is a reinforcement learning system that learns which of your strategies to trust in the ever-changing chaos of the market.
█ CHAPTER 1: THE PHILOSOPHY - BEYOND A SINGLE STRATEGY
The search for a single "holy grail" trading strategy is a fool's errand. No single set of rules can perform optimally in all market conditions. A trend-following system that thrives in a bull run will be decimated by a choppy, range-bound market. A mean-reversion strategy that profits from ranges will be run over by a powerful breakout.
The DafeSPALib (Shadow Portfolio Adaptation Library) was created to solve this fundamental problem. It is built on a powerful principle from modern quantitative finance: instead of searching for one perfect strategy, a truly robust system should intelligently allocate to a portfolio of different strategies, dynamically favoring the one that is currently most effective.
This is not just a concept; it is a complete, production-grade engine built in Pine Script. It allows a developer to run multiple "shadow portfolios"—hypothetical trading accounts for each of your strategies—in parallel, in real time. The library tracks the actual equity curve, win rate, Sharpe ratio, and drawdown of each strategy. It then uses a sophisticated selection algorithm to determine which strategy is the "alpha" in the current market regime and tells you which one to follow. It is an AI portfolio manager that lives on your chart.
█ CHAPTER 2: THE CORE INNOVATIONS - WHAT MAKES THIS A REVOLUTIONARY ENGINE?
This library is not a simple strategy switcher. It is a suite of genuine, academically recognized machine learning and statistical concepts, adapted for the Pine Script environment.
Shadow Portfolio Tracking: This is the heart of the system. For each of your strategy "arms," the library maintains a complete, independent set of performance analytics. It doesn't just keep a simple "score." It tracks every hypothetical trade, calculates real P&L;, and updates a full suite of institutional metrics, including the Sharpe Ratio (risk-adjusted return), Sortino Ratio (downside-risk-adjusted return), Profit Factor , and Maximum Drawdown . This provides a rich, data-driven foundation for all decision-making.
Advanced Selection Algorithms: The library doesn't just pick the strategy with the highest recent win rate. It uses sophisticated, battle-tested algorithms from the "multi-armed bandit" problem in machine learning to solve the critical "explore vs. exploit" dilemma:
Thompson Sampling: The default and most powerful. Instead of just picking the "best" arm, it samples from each arm's learned probability distribution of success (its Beta distribution). This naturally balances "exploitation" (using the strategy that works) with "exploration" (giving less-proven strategies a chance to shine), making it incredibly robust against changing conditions.
Upper Confidence Bound (UCB): A deterministic algorithm that is "optimistic in the face of uncertainty." It favors strategies that have both a high win rate and a high degree of uncertainty (fewer trades), encouraging intelligent exploration.
Epsilon-Greedy: A classic RL algorithm that mostly exploits the best-known strategy but, with a small probability (epsilon), explores a random one to prevent getting stuck on a sub-optimal choice.
Trauma-Based Memory Compression: This is a groundbreaking, proprietary concept. When the market experiences a "regime shock" (a sudden explosion in volatility, a violent trend reversal), a simple learning system can be paralyzed or make catastrophic errors. The SPA engine's "trauma" cycle is an intelligent response. It does not erase all learned knowledge. Instead, it compresses the memory : it preserves the direction of what it has learned (e.g., "Strategy A is generally better than B") but it destroys the confidence. The AI "remembers" its experiences but becomes highly uncertain, forcing it to re-learn and adapt to the new market personality with incredible speed. Think of it like PTSD for an AI: the memory of the event remains, but the trust is shattered.
Multi-Layer Concept Drift Detection: This is the system's "earthquake detector." It is constantly scanning for signs that the market's fundamental character is changing ("concept drift"). It uses three layers of detection— Structural (trend slope changes), Volatility (ATR explosions), and Participation (volume anomalies)—to identify a regime shock and trigger the trauma compression cycle.
█ CHAPTER 3: A DUAL-PURPOSE FRAMEWORK - MODES OF OPERATION
This library, along with its companion DAFE libraries, is designed for ultimate flexibility. As a developer, you have complete freedom to use these tools independently or as a fully integrated system.
MODE 1: STANDALONE ENGINE OPERATION (Independent Power)
The DafeSPALib can be used entirely on its own to build a powerful portfolio-of-strategies indicator without any external ML. This approach is perfect for comparing, validating, and dynamically selecting from your own existing, rule-based trading ideas.
The Workflow:
Your indicator initializes the SPA engine with a set number of "arms" (e.g., 4).
On each bar, you calculate the signals for each of your independent strategies (e.g., an EMA Crossover, an RSI Mean Reversion, a Bollinger Breakout).
You feed this array of signals ( ) into the SPA's feed_signals() function.
The SPA engine updates the shadow portfolio for each of the four strategies based on these signals. You then call the select() function, and the SPA's chosen algorithm (e.g., Thompson Sampling) will return the index of the single strategy arm that it trusts the most right now.
Your indicator's final output signal is the signal from that selected arm.
The Result: A complete, self-contained meta-strategy. Your indicator is no longer just one strategy; it is an intelligent manager that dynamically switches between multiple strategies, adapting to the market by selecting the one with the best real-time, risk-adjusted performance.
MODE 2: BRIDGED SUPER-SYSTEM OPERATION (The Ultimate AI)
This is the pinnacle of the DAFE ecosystem. In this advanced mode, the DafeSPALib acts as the "strategic brain" or "portfolio manager" that is fused with a tactical machine learning engine (like the DafeRLMLLib) via a master communication protocol (the DafeMLSPABridge).
The Workflow:
The ML engine generates proposals.
The Bridge Library translates these proposals into a portfolio of micro-strategies.
The SPA engine (this library) receives this portfolio of signals, tracks their shadow performance, and uses its advanced selection algorithms to choose the single best micro-strategy to follow. This becomes the final trade decision.
The final P&L; from the SPA's selection is then routed back through the Bridge to the ML engine as a highly qualified reward signal for learning.
The Result: A hybrid intelligence that is more robust and adaptive than either system alone. The ML provides tactical creativity, while the SPA provides ruthless, performance-based strategic oversight.
█ CHAPTER 4: THE DEVELOPER'S MASTERCLASS - IMPLEMENTATION GUIDE
This library is a professional framework. This guide provides the complete, unabridged instructions and templates required to integrate the DAFE SPA engine into your own custom Pine Script indicators.
PART I: THE INPUTS TEMPLATE (THE CONTROL PANEL)
To give your users full control over the AI, copy this entire block of inputs into your indicator script. It is professionally organized with groups and detailed tooltips.
// ╔════════════════════════════════════════════════════════╗
// ║ INPUTS TEMPLATE (COPY INTO YOUR SCRIPT) ║
// ╚════════════════════════════════════════════════════════╝
// INPUT GROUPS
string G_SPA_ENGINE = "════════════ 🧠 SPA ENGINE ════════════"
string G_SPA_DRIFT = "════════════ 🌊 CONCEPT DRIFT ══════════"
string G_SPA_DASH = "════════════ 📋 DIAGNOSTICS ═══════════"
// SPA ENGINE
int i_spa_num_arms = input.int(4, "Number of Strategy Arms", minval=2, maxval=10, group=G_SPA_ENGINE,
tooltip="The number of parallel strategies the SPA will track.")
string i_spa_selection = input.string("Thompson Sampling", "🤖 Selection Algorithm",
options= , group=G_SPA_ENGINE,
tooltip="The machine learning algorithm used to select the best arm. " +
"• Thompson Sampling: Bayesian approach, samples from each arm's success probability. Balances explore/exploit perfectly (Recommended). " +
"• UCB: Optimistic approach that favors arms with high uncertainty. Excellent for exploration. " +
"• Epsilon-Greedy: Mostly exploits the best arm, but explores randomly with a small probability (epsilon). " +
"• Softmax: Selects arms based on a probability distribution weighted by their performance.")
float i_spa_epsilon = input.float(0.15, "🧭 Epsilon (for Epsilon-Greedy)", minval=0.01, maxval=0.5, step=0.01, group=G_SPA_ENGINE,
tooltip="The probability of taking a random action to explore. This value automatically decays over time.")
float i_spa_decay = input.float(0.995, "🧠 Memory Decay Rate", minval=0.98, maxval=0.9999, step=0.0005, group=G_SPA_ENGINE,
tooltip="Controls recency bias. A value of 0.995 means the AI gives slightly more weight to recent performance. Lower values create a very short-term memory.")
// CONCEPT DRIFT & TRAUMA
bool i_spa_use_drift = input.bool(true, "🌊 Enable Concept Drift & Trauma", group=G_SPA_DRIFT,
tooltip="Allows the engine to detect market regime shocks and trigger a 'Trauma Compression' cycle to accelerate re-learning.")
float i_spa_trauma_sens = input.float(2.0, "Trauma Sensitivity", minval=1.2, maxval=4.0, step=0.1, group=G_SPA_DRIFT,
tooltip="How sensitive the shock detector is. A lower value will trigger trauma cycles more frequently on smaller volatility/volume spikes.")
// DIAGNOSTICS
bool i_spa_show_dash = input.bool(true, "📋 Show Diagnostics Dashboard", group=G_SPA_DASH)
PART II: THE IMPLEMENTATION LOGIC (THE HEART OF YOUR SCRIPT)
This is the boilerplate code you will adapt to your indicator. It shows the complete loop of feeding signals, detecting drift, and selecting the best strategy.
// ╔═══════════════════════════════════════════════════════╗
// ║ USAGE EXAMPLE (ADAPT TO YOUR SCRIPT) ║
// ╚═══════════════════════════════════════════════════════╝
// 1. INITIALIZE THE ENGINE (happens only on the first bar)
int sel_method_id = i_spa_selection == "Thompson Sampling" ? 0 : i_spa_selection == "Upper Confidence Bound (UCB)" ? 1 : i_spa_selection == "Epsilon-Greedy" ? 2 : 3
var spa.SPAEngine engine = spa.init(
num_arms = i_spa_num_arms,
arm_names = array.from("TrendArm", "ReversionArm", "BreakoutArm", "MomentumArm"), // Give your arms names!
selection_method = sel_method_id,
decay_rate = i_spa_decay,
trauma_sensitivity = i_spa_trauma_sens,
epsilon = i_spa_epsilon
)
// 2. DEFINE YOUR STRATEGY SIGNALS (runs on every bar)
// These are your own custom, rule-based strategies. The signal should be +1 for Buy, -1 for Sell, 0 for Neutral.
int trend_signal = close > ta.ema(close, 200) and ta.crossover(ta.ema(close, 20), ta.ema(close, 50)) ? 1 :
close < ta.ema(close, 200) and ta.crossunder(ta.ema(close, 20), ta.ema(close, 50)) ? -1 : 0
int reversion_signal = ta.crossunder(ta.rsi(close, 14), 30) ? 1 : ta.crossover(ta.rsi(close, 14), 70) ? -1 : 0
int breakout_signal = ta.crossover(close, ta.highest(high, 20) ) ? 1 : ta.crossunder(close, ta.lowest(low, 20) ) ? -1 : 0
int momentum_signal = ta.crossover(ta.mom(close, 10), 0) ? 1 : ta.crossunder(ta.mom(close, 10), 0) ? -1 : 0
// Create an array of your signals. The order MUST be consistent.
array all_signals = array.from(trend_signal, reversion_signal, breakout_signal, momentum_signal)
// 3. THE MAIN LOOP (Feed -> Detect -> Select) - runs on every bar
// --- FEED: Update the shadow portfolios with the latest signals and price ---
engine := spa.feed_signals(engine, all_signals, close)
// --- DETECT: Run the concept drift engine ---
if i_spa_use_drift
float trend_slope = ta.linreg(close, 20, 0) - ta.linreg(close, 20, 1)
engine := spa.detect_drift(engine, close, volume, ta.atr(14), trend_slope)
engine := spa.apply_trauma_cycle(engine) // This will compress memory if a shock was detected
// --- SELECT: Ask the engine for its best choice ---
= spa.select(engine)
engine := updated_engine // CRITICAL: Always update the engine state
// --- ACT: Use the final, selected signal for your indicator's logic ---
int final_signal = array.get(all_signals, selected_arm)
string selected_name = spa.get_name(engine, selected_arm)
// Example: Color bars based on the final, SPA-vetted signal
barcolor(final_signal == 1 ? color.new(color.green, 70) : final_signal == -1 ? color.new(color.red, 70) : na)
// 4. DISPLAY DIAGNOSTICS
if i_spa_show_dash and barstate.islast
string diag_text = spa.diagnostics(engine)
label.new(bar_index, high, diag_text,
style=label.style_label_down,
color=color.new(#0A0A14, 10),
textcolor=#00E5FF,
size=size.small,
textalign=text.align_left)
█ DEVELOPMENT PHILOSOPHY
The DafeSPALib was born from the realization that market adaptation is the true holy grail of trading. While any single strategy is brittle, a portfolio of strategies, managed by an intelligent selection algorithm, is antifragile—it can learn, adapt, and potentially thrive in the face of chaos. This library is an open-source tool for the systems thinker, the quantitative analyst, and the professional developer. It is designed to provide the foundational architecture for building the most robust, adaptive, and intelligent trading systems on the TradingView platform.
This library is a tool for that wisdom. It is not about having the single smartest algorithm, but about having a disciplined, data-driven process for selecting the one that is working right now.
█ DISCLAIMER & IMPORTANT NOTES
THIS IS A LIBRARY FOR ADVANCED DEVELOPERS: This script does nothing on its own. It is a powerful engine that must be integrated into other indicators and fed with valid strategy signals.
PERFORMANCE IS HYPOTHETICAL: The shadow portfolio tracking is a simulation. It does not account for slippage, fees (unless manually added to P&L;), or the psychological pressure of live trading.
LEARNING REQUIRES DATA: The selection algorithms require a sufficient number of trades (at least 20-30 per arm) to make statistically meaningful decisions. The engine will be less reliable during the initial "warm-up" period.
"You don't need to be a rocket scientist. Investing is not a game where the guy with the 160 IQ beats the guy with the 130 IQ."
— Warren Buffett
Taking you to school. - Dskyz, Create with RL.
ninjactor fib (v6, Native Pivots, Non-Repainting)📐 Fibonacci Sequence Framework (Non-Repainting)
This indicator implements a structured Fibonacci sequence framework using confirmed, non-repainting pivots.
It automatically identifies Fibonacci boundaries, plots a precise Fibonacci level set with grouped color logic, and projects targets based on retracement depth.
The script is designed for clarity, accuracy, and object-based plotting, extending Fibonacci levels to the right while active and maintaining a clean chart by default.
🔹 Core Features
Non-Repainting Fractals
Uses confirmed 2-left / 2-right pivots (ta.pivotlow, ta.pivothigh)
Pivot labels are plotted on the correct historical bar
Automatic Fibonacci Boundary Detection
Long spreads:
Boundary 1 = pivot low (100%)
Boundary 2 = first pivot high after (0%)
Short spreads use the inverted logic
Direction can be set to Auto, Long Only, or Short Only
Exact Fibonacci Level Set
Retracements:
0.236 · 0.382 · 0.500 · 0.618 · 0.786 · 0.886
Extensions (targets):
1.127 · 1.272 · 1.618
Negative levels included:
-0.127 · -0.272 · -0.618
Grouped Color Logic
Red: 0.236 / 0.382 / 0.500 / 0.618, 1.618, negative levels
Blue: 0.786, 1.272, boundary lines
Green: 0.886, 1.127
Active target is highlighted with increased line thickness
Strict “Must Touch” Logic
Retracement levels are only considered valid if price actually touches them
Wick-based validation (not close-based)
Target hits must be touched exactly — no partial credit
Target Projection Rules
Retracements ≤ 0.618 → target = 1.618
0.786 retracement → target = 1.272
0.886 retracement → target = 1.127
Clean Object Management
Uses line and label objects (not plots)
Levels extend right while active
By default, only the current active spread is displayed
Optional history toggle to keep previous spreads
⚙️ Customization
Fully customizable color inputs
Adjustable opacity for:
Non-active levels
Active target line
Direction mode selection
History on/off control
📌 Notes
This is an indicator, not a strategy (no trade execution)
Designed for discretionary trading and confluence analysis
Built to be stable, readable, and Pine Script v6 compatible
Market Cycle Strength# Market Cycle Strength (MCS)
## Overview
Market Cycle Strength is a comprehensive composite indicator that synthesizes six key market health metrics into a single score ranging from -100 to +100. The indicator is designed to help traders assess the current market regime and identify potential turning points by analyzing multiple dimensions of market structure simultaneously.
## How It Works
### Components
The indicator combines six distinct market signals, each weighted by default as follows:
| Component | Weight | What It Measures |
|-----------|--------|------------------|
| **Momentum (30%)** | Price trend strength via SPY's position relative to 50/200 SMAs, golden/death cross status, and rate of change |
| **Credit Spreads (20%)** | Risk appetite through HYG/LQD ratio (high yield vs investment grade bonds) |
| **VIX Structure (20%)** | Fear/greed levels and volatility regime |
| **Market Breadth (15%)** | Participation via RSP/SPY ratio (equal weight vs cap weight performance) |
| **Sector Rotation (10%)** | Leadership patterns by comparing cyclical sectors (XLK, XLY, XLF, XLI, XLB) against defensive sectors (XLU, XLP, XLV, XLRE) |
| **Yield Curve Proxy (5%)** | Flight-to-safety signals via TLT/SHY ratio |
### Score Interpretation
The composite score maps to six market regimes:
- **Strong Bull (+50 to +100)**: Broad strength across most components - healthy expansion
- **Bull (+25 to +50)**: Generally positive conditions with some caution areas
- **Weak Bull (0 to +25)**: Positive but deteriorating - correction risk rising
- **Neutral (-25 to 0)**: Mixed signals - unclear direction, increased caution warranted
- **Bear (-50 to -25)**: Multiple stress indicators present - defensive posture recommended
- **Strong Bear (-100 to -50)**: Significant market stress - crisis conditions
### Contrarian Application
Historical backtesting suggests this indicator has **contrarian value** at extremes:
- Extremely bearish readings (below -25) have historically preceded above-average forward returns
- Very bullish readings (above +70) may indicate complacency rather than a buy signal
The dashboard displays a "CONTRARIAN: BUY SIGNAL" when the score drops below -25, highlighting potential accumulation opportunities.
## How To Use
### Setup
1. Apply the indicator to any chart but SPY is recommended (it fetches all required data via `request.security`)
2. The indicator works best on daily timeframes for regime analysis
3. Adjust component weights in settings if you want to emphasize certain signals
### Dashboard
The table displays:
- **Composite Score**: Overall market health reading
- **Regime**: Current market classification
- **Component Breakdown**: Individual scores for each of the six inputs
- **Status Flags**: Golden/Death cross, credit health, sector leadership, etc.
### Alerts
Four alert conditions are available:
- **Strong Bull Entry**: Score crosses above +50
- **Bear Warning**: Score crosses below -25
- **Contrarian Buy Signal**: Extreme bearish reading (potential opportunity)
- **Regime Change**: Any transition between market regimes
## Best Practices
1. **Context Matters**: Use alongside price action and other analysis - no indicator works in isolation
2. **Timeframe**: Most reliable on daily charts; intraday may produce noise
3. **Extremes Are Signals**: Pay special attention when the score reaches extreme levels in either direction
4. **Component Analysis**: Check individual components to understand what's driving the composite score
5. **Confirmation**: Wait for regime changes to be confirmed by multiple components, not just one
## Inputs
- **Component Weights**: Customize the importance of each signal (default weights sum to 1.0)
- **Show Dashboard**: Toggle the information table on/off
- **Show Zone Background**: Toggle colored zone fills
- **Table Position**: Move dashboard to any corner
- **Alert Thresholds**: Customize notification trigger levels
## Data Sources
The indicator pulls data from:
- SPY, RSP (market proxies)
- HYG, LQD (credit markets)
- TLT, SHY (bond markets)
- VIX (volatility)
- XLK, XLY, XLF, XLI, XLB (cyclical sectors)
- XLU, XLP, XLV, XLRE (defensive sectors)
## Limitations
- Requires access to US market data (best results with TradingView's data feeds)
- Historical data needed for SMA calculations (200+ bars minimum)
- VIX term structure (VIX3M) not available on TradingView, so that component is omitted
- Works best as a daily regime indicator, not for intraday timing
## Acknowledgments
This indicator synthesizes concepts from multiple areas of market analysis including momentum trading, credit cycle research, volatility analysis, and sector rotation theory. The composite approach aims to provide a holistic view of market conditions rather than relying on any single metric.
---
**Disclaimer**: This indicator is for educational and informational purposes only. It does not constitute financial advice. Past performance of any methodology is not indicative of future results. Always conduct your own research and consider your risk tolerance before making trading decisions.
7AM Daily Open (Round to 0/5) + AlertsIndicator Description: 7AM Daily Open Zone (Rounded)
This indicator is designed to establish a daily trading range based on the market open at 07:00 AM (Bangkok Time, UTC+7). It automatically plots a central reference line and two boundary lines (Upper and Lower) to help traders identify key support and resistance zones for the day.
TDI-X CustomThis indicator is a TDI-style RSI oscillator built for clear momentum and trend signals.
It plots a smoothed RSI “Price Line” and a separate “Signal Line” to help identify trend shifts, momentum changes, and crossover entries. Optional volatility bands can be enabled to visualize RSI expansion and contraction, similar to Bollinger Bands.
It includes configurable RSI length, smoothing methods, band settings, and alert conditions for crossovers and overbought/oversold events.
BULL-BEAR-WALLDEMPurpose and Overview
Designed for minimalistic charting, this indicator computes RSI (default 14-period on close) but hides all visuals—plots, bands, fills, and smoothing—to focus solely on divergence signals. With overlay=true, it integrates labels onto the main price chart, eliminating separate panes and scale issues. Divergences highlight momentum-price mismatches: bullish for potential upturns (e.g., weakening downtrends), bearish for downturns (e.g., fading rallies). The calculateDivergence input (default false) gates the logic, optimizing for user control and performance.
Technical Implementation
RSI Core: Employs ta.change(), ta.rma() for up/down averages, yielding rsi = 100 - (100 / (1 + up / down)).
Divergence Module: Uses ta.pivotlow()/ta.pivothigh() with fixed lookbacks (left/right: 5) and range filter (5-60 bars). Conditions: Bullish (rsiHL && priceLL), Bearish (rsiLH && priceHH), evaluated conditionally.
Rendering: plotshape() for labels (" Bull "/ " Bear ") at bar extremes (location.belowbar/abovebar), offset by -lookbackRight. Colors: green bull, red bear.
Hiding: color=na for plots/hlines; transparent color.new(..., 100) for fills. Smoothing via switch (SMA/EMA/etc.) but invisible.
Alerts: alertcondition() with pivot context messages.
The structure prioritizes readability: grouped inputs, modular functions, and no unnecessary visuals.
Usage Scenarios and Tips
Apply to trending markets—e.g., 4H BTCUSD for crypto reversals or daily TSLA for stock pullbacks. Enable divergence in settings; labels offset to pivots aid quick scans. Pair with volume or trends for confirmation; alerts enable real-time monitoring. For backtesting, adapt to strategy() using conditions as entry signals.
Customization Options
Inputs: RSI length (min 1), source, divergence toggle (hidden display).
Smoothing: Hidden group with MA types, lengths, BB multipliers.
Extensions: Expose lookbacks as input.int(); add hidden divergences or MTF via request.security().
Limitations and Considerations
Signals rely on data: No divergences mean no labels; adjust parameters for sensitivity.
Repainting possible on live bars; best on closed data.
Not standalone: Divergences (55-65% historical accuracy per studies) need context to avoid false positives in strong trends.
v6-dependent; compatible but feature-limited in v5.
Volatility Structure Regime Engine (VSgRE)Volatility Structure Regime Engine (VSgRE)
Volatility Structure Regime Engine (VSgRE) is a volatility-based market analysis tool designed to highlight when volatility is likely to expand, without implying trade direction.
The indicator uses a three-layer analytical framework to identify meaningful volatility events while remaining fully direction-agnostic.
🔹 Structure Layer
Defines the broader volatility environment using normalized volatility metrics to distinguish between high- and low-volatility conditions.
🔹 Regime Layer
Identifies volatility compression, expansion, and transition phases, helping traders recognize periods of stored or released market energy.
🔹 Execution Layer
Detects real-time volatility ignition events that signal the start of meaningful expansion.
📊 Signal Types
Strong Signals
Indicate valid volatility expansion events within an active volatility regime.
Elite Signals
Highlight the first volatility expansion following a prolonged compression phase.
Signals are represented using neutral bubbles to avoid bullish or bearish bias.
✅ Key Characteristics
Pure volatility-based logic
Leading, non-directional signals
Clean and minimal chart visuals
State-based, non-repetitive signaling
Suitable for breakout timing, regime analysis, and risk awareness
⚠️ Disclaimer
This indicator is provided for educational and analytical purposes only. It does not constitute financial advice. Trading involves risk, and users are responsible for their own decisions.






















