Granville 8-Rule Engine — v6Description:
The Granville 8-Rule Engine systematically implements Joseph Granville's eight original trading rules, which provide a comprehensive framework for interpreting price action relative to a moving average to identify genuine trend changes and avoid false signals.
Granville's methodology focuses on the critical relationship between price movement and the direction of the moving average, recognizing that valid trend changes and continuations exhibit specific behavioral patterns while false breakouts and reversals show characteristic divergences.
The indicator evaluates all eight of Granville's rules and assigns a composite score based on their fulfillment:
Bullish Rules:
Rule 1: Price crosses above a rising moving average (+3 points)
Rule 2: Price remains above a rising moving average after testing support (+2 points)
Rule 3: Price remains above a rising moving average after penetrating below it (+1 point)
Rule 4: Moving average changes from declining to rising (+1 point)
Bearish Rules:
Rule 5: Price crosses below a declining moving average (-3 points)
Rule 6: Price remains below a declining moving average after testing resistance (-2 points)
Rule 7: Price remains below a declining moving average after penetrating above it (-1 point)
The indicator incorporates volume confirmation by adding or subtracting additional points when significant volume accompanies the fulfillment of bullish or bearish rules, respectively.
A buy signal is generated when the composite score reaches +4 or higher, indicating multiple bullish rules are simultaneously satisfied. A sell signal is generated when the score reaches -4 or lower, indicating multiple bearish rules are in effect.
This systematic approach filters out many false breakout and whipsaw signals by requiring multiple confirmatory conditions rather than relying on simple moving average crossovers. The scoring mechanism provides a quantitative measure of the strength of the prevailing trend relationship, enabling traders to distinguish between genuine trend development and deceptive price movements that fail to confirm with the moving average direction.
The Granville 8-Rule Engine provides a disciplined, rule-based method for determining whether price movements represent valid trend continuation, genuine trend reversal, or potentially misleading counter-trend activity that is likely to fail. By requiring multiple confirmatory conditions from Granville's established rules, the indicator helps traders avoid premature entries and provides higher-probability signals for participating in sustained trend movements.
Chỉ báo và chiến lược
Physics of PricePhysics of Price is a non-repainting kinematic reversal and volatility overlay. It models price as a physical object with position, velocity, and acceleration, then builds adaptive bands and a short-term predictive “ghost cone” to highlight where reversals are statistically more likely.
CONCEPT
Instead of using only moving averages, the core engine tracks a smoothed price (position), trend speed (velocity), and change in trend speed (acceleration). Standard deviation of the model error defines probabilistic bands around this kinematic centerline. When price stretches too far away and snaps back, the move is treated as a potential exhaustion event.
CORE COMPONENTS
– Kinematic centerline (Alpha–Beta–Gamma style filter) that bends with trend instead of lagging like a simple MA.
– Inner and outer bands based on the standard deviation of residuals between price and the kinematic model.
– Regime filter using R² and band width to avoid signals in chaotic or ultra-wide regimes.
– Optional RSI “hook” filter that waits for momentum to actually turn instead of buying into a falling RSI.
– Optional divergence add-on using kinematic velocity, so a marginal new price extreme with weaker velocity is recognized as a possible exhaustion pattern.
REVERSAL EVENTS AND SCORING
Raw events are detected when price wicks through the outer band and closes back inside (band hit with snap). These are plotted as diamonds and treated as candidates, not automatic trades.
Each event is then scored from 0 to 100 using several factors:
– How far price overshot the outer band.
– How strongly it snapped back inside.
– Whether an RSI hook is present (if enabled).
– Regime quality from the kinematic model.
– Basic kinematic safety to avoid the most aggressive “knife-catch” situations.
– Optional divergence bonus when price makes a new extreme but velocity does not.
Only events with a score above the chosen threshold become confirmed signals (triangles labeled PHYSICS REV).
GHOST CONE (PREDICTIVE BAND)
On the latest bar, the script projects a short-horizon “ghost cone” into the future using position, velocity, and a damped acceleration term. This creates a curved predictive band that visualizes a plausible short-term path and range, rather than a simple straight line. The cone is meant as context for trade management and risk, not as a hard target.
FILTERS AND OPTIONS
– Regime filter (R² and band width) can be tightened or relaxed depending on how selective you want the engine to be.
– RSI and volume filters can be toggled on for extra confirmation or off to see the raw kinematic behavior.
– An optional trend baseline (EMA) can be enabled to bias or restrict reversals relative to a higher-timeframe trend.
– Dynamic cooldown scales with volatility so the script does not spam signals in fast environments.
HOW TO USE
Physics of Price is primarily a mean-reversion and exhaustion tool. It works best in markets that respect ranges, swings, and two-sided order flow. Confirmed PHYSICS REV signals near the outer bands, with decent model health and a clean RSI hook, are the core use case. The bands and ghost cone can also be used as a context overlay alongside your own entries, exits, and risk framework.
This is an indicator, not a complete trading system. It does not use lookahead or higher-timeframe security calls and is designed for “once per bar close” alerts. Always combine it with your own risk management and confluence.
ZLSMA Cross ATR Targets - Enhanced Trading StrategyZLSMA Cross ATR Targets - Enhanced Trading Strategy
📊 Overview
This indicator combines Zero-Lag Least Squares Moving Average (ZLSMA) crossover signals with ATR-based dynamic risk management to provide precise entry and exit points. Unlike standard moving average crossovers, this system uses a zero-lag implementation to reduce signal delays and incorporates multi-timeframe analysis for improved accuracy.
🎯 What Makes This Script Unique
1. Zero-Lag LSMA Implementation:
Uses a dual-smoothing technique: 2 * SMA(price, length) - SMA(SMA(price, length), length)
This eliminates the typical lag found in standard moving averages
Provides faster reaction to price changes while maintaining smoothness
2. Multi-Timeframe Signal Generation:
Analyzes price action on a higher timeframe (default: 15-min) regardless of chart timeframe
Reduces noise and false signals common in single-timeframe systems
All calculations (ZLSMA, ATR, close price) are synchronized to the signal timeframe
3. Dynamic ATR-Based Risk Management:
Stop Loss: Automatically calculated using ATR multiplier (default: 1.0x)
Take Profit 1: First target at 1.5x ATR (adjustable)
Take Profit 2: Extended target at 3.0x ATR (adjustable)
Risk-Reward ratios are displayed on each trade label for transparency
4. Optional Signal Filters:
Trend Filter: Uses 200 EMA to filter trades - only buys above, sells below (optional)
Volatility Filter: Ensures minimum ATR % to avoid low-volatility false signals (optional)
Both filters can be independently toggled on/off
5. Real-Time Performance Tracking:
Automatically tracks completed trades (TP1, TP2, or SL hits)
Calculates win rate, total P/L, and average P/L per trade
Live P/L displayed for current open position
Performance-based color coding (Green/Blue/Orange/Red)
🔧 How It Works
Signal Generation:
BUY Signal: Triggered when price crosses above ZLSMA on the signal timeframe
SELL Signal: Triggered when price crosses below ZLSMA on the signal timeframe
If filters are enabled, signals are validated against trend direction and volatility conditions
Trade Execution:
Entry price is locked at the close of the crossover bar
SL, TP1, and TP2 are calculated using the ATR value from the signal timeframe
Horizontal lines extend into the future (default: 240 bars) for visual clarity
Labels display all trade parameters including risk-reward ratios
Position Management:
System monitors each bar to detect if price hits SL, TP1, or TP2
Once a target is hit, the trade is marked as complete and statistics update
"Show Only Latest Trade" toggle cleans up historical signals for chart clarity
📈 How to Use
Settings:
Signal Timeframe: Timeframe for ZLSMA and ATR calculations (higher = fewer signals)
ZLSMA Length: Lookback period (100 default, lower = more responsive)
ATR Length: Period for volatility measurement (14 default)
SL/TP Multipliers: Adjust risk-reward profile to your trading style
Filters: Enable/disable trend and volatility filters as needed
Dashboard:
Fixed position (top-right corner) shows:
Current trade status and live P/L
Entry, SL, TP1, TP2 prices
Total performance statistics
Strategy settings summary
Alerts:
Enable alerts in settings to receive notifications on new signals
Each alert includes full trade details (Entry, SL, TP1, TP2)
⚙️ Why This Combination Works
The mashup of ZLSMA, multi-timeframe analysis, ATR-based targets, and optional filters creates a complete trading system:
ZLSMA provides faster signals than traditional moving averages
Higher timeframe reduces noise and improves signal quality
ATR-based targets adapt to current market volatility (no fixed pip targets)
Trend filter keeps you aligned with the bigger picture
Volatility filter avoids choppy, low-conviction setups
Performance tracking allows data-driven strategy optimization
This is not just a combination of existing indicators—it's a complete risk-managed trading framework with built-in analytics.
⚠️ Risk Disclaimer: This indicator is for educational purposes only. Past performance does not guarantee future results. Always use proper risk management and never risk more than you can afford to lose.
Ben D"s IndicatorIt Auto Draws and Detects, Channels draws buy and sell signals based on over bought, oversold and a few other indicators. It works on all time frames! Enjoy! Leave a comment if you like it.
Trendshift [CHE] StrategyTrendshift Strategy — First-Shift Structural Regime Trading
Profitfactor 2,603
Summary
Trendshift Strategy implements a structural regime-shift trading model built around the earliest confirmed change in directional structure. It identifies major swing highs and lows, validates breakouts through optional ATR-based conviction, and reacts only to the first confirmed shift in each direction. After a regime reversal, the strategy constructs a premium and discount band between the breakout candle and the previous opposite swing. This band is used as contextual bias and may optionally inform stop placement and position sizing.
The strategy focuses on clear, interpretable structural events rather than continuous signal generation. By limiting entries to the first valid shift, it reduces false recycles and allows the structural state to stabilize before a new trade occurs. All signals operate on closed-bar logic, and the strategy avoids higher-timeframe calls to stabilize execution behavior.
Motivation: Why this design?
Many structure-based systems repeatedly trigger as price fluctuates around prior highs and lows. This often leads to multiple flips during volatile or choppy conditions. Trendshift Strategy addresses this problem by restricting execution to the first confirmed structural event in each direction. ATR-based filters help differentiate genuine structural breaks from noise, while the contextual band ensures that the breakout is meaningful in relation to recent volatility.
The design aims to represent a minimalistic structural trading framework focused on regime turns rather than continuous trend signaling. This reduces chart noise and clarifies where the market transitions from one regime to another.
What’s different vs. standard approaches?
Baseline reference
Typical swing-based structure indicators report every break above or below recent swing points.
Architecture differences
First-shift-only regime logic that blocks repeated signals until direction reverses
ATR-filtered validation to avoid weak or momentum-less breaks
Premium and discount bands derived from breakout structure
Optional band-driven stop placement
Optional band-dependent position-sizing factor
Regime timeout system to neutralize structure after extended inactivity
Persistent-state architecture to prevent re-triggering
Practical effect
Only the earliest actionable structure change is traded
Fewer but higher-quality signals
Premium/discount tint assists contextual evaluation
Stops and sizing can be aligned with structural context rather than arbitrary volatility measures
Improved chart interpretability due to reduced marker frequency
How it works (technical)
The algorithm evaluates symmetric swing points using a fixed bar window. When a swing forms, its value and bar index are stored as persistent state. A structural shift occurs when price closes beyond the most recent major swing on the opposite side. If ATR filtering is enabled, the breakout must exceed a volatility-scaled distance to prevent micro-breaks from firing.
Once a valid shift is confirmed, the regime is updated to bullish or bearish. The script records the breakout level, the opposite swing, and derives a band between them. This band is checked for minimum size relative to ATR to avoid unrealistic contexts.
The first shift in a new direction generates both the strategy entry and a visual marker. Additional shifts in the same direction are suppressed until a reversal occurs. If a timeout is enabled, the regime resets after a specified number of bars without structural change, optionally clearing the band.
Stop placement, if enabled, uses either the opposite or same band edge depending on configuration. Position size is computed from account percentage and may optionally scale with the price-span-to-ATR relationship.
Parameter Guide
Market Structure
Swing length (default 5): Controls swing sensitivity. Lower values increase responsiveness.
Use ATR filter (default true): Requires breakouts to show momentum relative to ATR. Reduces false shifts.
ATR length (default 14): Volatility estimation for breakout and band validation.
Break ATR multiplier (default 1.0): Required breakout strength relative to ATR.
Premium/Discount Framework
Enable framework (default true): Activates premium/discount evaluation.
Persist band on timeout (default true): Keeps structural band after timeout.
Min band ATR mult (default 0.5): Rejects narrow bands.
Regime timeout bars (default 500): Neutralizes regime after inactivity.
Invert colors (default false): Color scheme toggle.
Visuals
Show zone tint (default true): Background shade in premium or discount region.
Show shift markers (default true): Display first-shift markers.
Execution and Risk
Risk per trade percent (default 1.0): Determines position size as account percentage.
Use band for size (default false): Scales size relative to band width behavior.
Flat on opposite shift (default true): Forces reversal behavior.
Use stop at band (default false): Stop anchored to band edges.
Stop band side: Chooses which band edge is used for stop generation.
Reading & Interpretation
A green background indicates discount conditions within the structural band; red indicates premium conditions. A green triangle below price marks the first bullish structural shift after a bearish regime. A red triangle above price marks the first bearish structural shift after a bullish regime.
When stops are active, the opposite band edge typically defines the protective level. Band width relative to ATR indicates how significant a structural change is: wider bands imply stronger volatility structure, while narrow bands may be suppressed by the minimum-size filter.
Practical Workflows & Combinations
Trend following: Use first-shift entries as initial regime confirmation. Add higher-timeframe trend filters for additional context.
Swing trading: Combine with simple liquidity or fair-value-gap concepts to refine entries.
Bias mapping: Use higher timeframes for structural regime and lower timeframes for execution within the premium/discount context.
Exit management: When using stops, consider ATR-scaling or multi-stage profit targets. When not using stops, reversals become the primary exit.
Behavior, Constraints & Performance
The strategy uses only confirmed swings and closed-bar logic, avoiding intrabar repaint. Pivot-based swings inherently appear after the pivot window completes, which is standard behavior. No higher-timeframe calls are used, preventing HTF-related repaint issues.
Persistent variables track regime and structural levels, minimizing recomputation. The maximum bars back setting is five-thousand. The design avoids loops and arrays, keeping performance stable.
Known limitations include limited signal density during consolidations, delayed swing confirmation, and sensitivity to extreme gaps that stretch band logic. ATR filtering mitigates some of these effects but does not eliminate them entirely.
Sensible Defaults & Quick Tuning
Fewer but stronger entries: Increase swing length or ATR breakout multiplier.
More responsive entries: Reduce swing length to capture earlier shifts.
More active band behavior: Lower the minimum band ATR threshold.
Stricter stop logic: Use the opposite band edge for stop placement.
Volatile markets: Increase ATR length slightly to stabilize behavior.
What this indicator is—and isn’t
Trendshift Strategy is a structural-regime trading engine that evaluates major directional shifts. It is not a complete trading system and does not include take-profit logic or prediction features. It does not attempt to forecast future price movement and should be used alongside broader market structure, volatility context, and disciplined risk management.
Disclaimer
The content provided, including all code and materials, is strictly for educational and informational purposes only. It is not intended as, and should not be interpreted as, financial advice, a recommendation to buy or sell any financial instrument, or an offer of any financial product or service. All strategies, tools, and examples discussed are provided for illustrative purposes to demonstrate coding techniques and the functionality of Pine Script within a trading context.
Any results from strategies or tools provided are hypothetical, and past performance is not indicative of future results. Trading and investing involve high risk, including the potential loss of principal, and may not be suitable for all individuals. Before making any trading decisions, please consult with a qualified financial professional to understand the risks involved.
By using this script, you acknowledge and agree that any trading decisions are made solely at your discretion and risk.
Do not use this indicator on Heikin-Ashi, Renko, Kagi, Point-and-Figure, or Range charts, as these chart types can produce unrealistic results for signal markers and alerts.
Best regards and happy trading
Chervolino
Sanjay AhirPull Backs , Swings Marking
useful for market structure
useful For Smc Strcture
useful for ICT mapping
SNP420/RSI_GOD_KOMPLEXRSI_GOD_KOMPLEX is a multi–timeframe RSI scanner for TradingView that displays a compact table in the top-right corner of the chart. For each timeframe (1m, 5m, 15m, 30m, 1h, 4h, 1d) it tracks the fast RSI line (not the smoothed/main one) and marks BUY in green when RSI crosses up through 30 (leaving oversold territory) and SELL in red when RSI crosses down through 70 (leaving overbought territory), always using only closed candles for reliable, non-repainting signals. The indicator remembers the last valid signal per timeframe, so the table always shows the most recent directional impulse from RSI across all selected timeframes on the same instrument.
author: SNP420 + Jarvis
project: FNXS
ps: piece and love
Bitcoin Power Law Zones (Dunk)Introduction When viewed on a standard linear chart, Bitcoin’s long-term price action can appear chaotic and exponential. However, when analyzed through the lens of physics and network growth models, a distinct structure emerges.
This indicator implements the Bitcoin Power Law , a mathematical model that suggests Bitcoin’s price evolves in a straight line when plotted against time on a "log-log" scale. By calculating parallel bands around this regression line, we create a "Rainbow" of valuation zones that help investors visualize whether the asset is historically overheated, undervalued, or sitting at fair value.
The Math Behind the Model The Power Law dictates that price scales with time according to the formula: Price = A * (days since genesis)^b
This script uses the specific parameters popularized by recent physics-based analyses of the network: Slope (b): 5.78 (Representing the scaling law of the network adoption). Amplitude (A): 1.45 x 10^-17 (The intercept coefficient).
While simple moving averages react to price, this model is predictive based on time and network growth physics, providing a long-term "gravity" center for the asset.
Guide to the Valuation Zones
Upper Bands (Red/Orange): Extr. Overvalued, High Premium, Overvalued. Historically, these zones have marked cycle peaks where price moved too far, too fast ahead of the network's steady growth. The Baseline (Black Line): Fair Value. The mathematical mean of the Power Law. Price has historically oscillated around this line, treating it as a center of gravity. Lower Bands (Green/Blue): Undervalued, Discount, Deep Discount. These zones represent periods where the market price has historically lagged behind the network's intrinsic value, often marking accumulation phases.
Note: The lowest theoretical tiers ("Bitcoin Dead") have been trimmed from this chart to focus on relevant historical support levels.
How to Use Logarithmic Scale: You MUST set your chart to "Log" scale (bottom right of the TradingView window) for this indicator to function correctly. On a linear chart, the bands will appear to curve upwards aggressively; on a Log chart, they will appear as smooth, parallel channels. Timeframe: This is a macro-economic indicator. It is best viewed on Daily or Weekly timeframes. Overlay Labels: The indicator includes dynamic labels on the right-side axis, allowing you to instantly see the current price requirements for each valuation zone without manually tracing lines.
Credits This script is based on the Power Law theory popularized by Giovanni Santostasi and the original Corridor concepts by Harold Christopher Burger .
Disclaimer This tool is for educational and informational purposes only. It visualizes historical mathematical trends and does not constitute financial advice. Past performance of a model is not indicative of future results.
Further Reading
www.hcburger.com
giovannisantostasi.medium.com
Sequential Exhaustion 9/13 [Crypto Filter] - PyraTimeConcept: The Exhaustion Meter
This indicator is a customized version of the Sequential count, a powerful tool used by institutional traders to measure buyer and seller exhaustion. It looks for a sequence of 9 (Setup) or 13 (Countdown) consecutive candles that satisfy specific price criteria.
The purpose is simple: To tell you when a trend has run out of fuel.
Key Differentiators (The Value)
Due to the high volatility of the crypto market, standard Sequential indicators print too many false signals ("13s") during a strong trend. This custom version solves that problem with two core filters:
1. Trend Filter (EMA 200): If enabled, the indicator will automatically hide all Sell signals when the price is above the 200 EMA, protecting the user from shorting an uptrend (and vice-versa).
2. Color Confirmation: It will not print a signal unless the closing candle color matches the direction (e.g., no Red 13 sell signals on Green Candles). This drastically cleans up the chart.
Understanding the Numbers
The numbers appearing above and below the candles are your exhaustion meter.
* The "9" (Setup): Indicates a short-term trend is nearing exhaustion.
* The "13" (Countdown): Indicates the trend is statistically complete and a reversal is highly probable.
The Actionable Strategy (The PyraTime Rule)
This indicator is designed to be your Exit Tool. Use it to determine when to take profit from an existing trade.
* Example: You enter Long at the GPM Time Line. When the PyraTD prints a Red 9 or Red 13, you take profit immediately.
Final Note
Use the integrated visibility settings to turn off signals (e.g., hide 9s or Sells) to customize the view to your preferred trading style.
Disclaimer: This tool measures mathematical exhaustion and is part of the PyraTime system. It is not financial advice.
Ultimate AIO Scalper & Trend PRO [THF] V2.0This is a comprehensive "All-In-One" trading suite designed to identify high-probability setups by combining **Trend Following**, **Price Action (FVG)**, and **Ichimoku Cloud** systems.
The indicator is designed to be "Ready-to-Trade" out of the box, with all major confluence filters active by default. It helps traders avoid false signals by ensuring that momentum, trend, and support/resistance levels are in alignment.
### 🛠️ Key Features & Components:
**1. Trend & Scalp Engine:**
* **Scalp Signals:** Fast EMA crossovers (7/21) for quick entries.
* **Trend Filter:** Signals are filtered by a long-term SMA (200) to ensure you are trading with the dominant trend.
* **Golden/Death Cross:** Automatically highlights major trend shifts (SMA 50 crossing SMA 200).
**2. Price Action (Fair Value Gaps):**
* **FVG Detection:** Highlights unmitigated Bullish and Bearish imbalance zones. These act as high-probability targets or re-entry zones.
* **Dashboard:** A built-in panel tracks the number of active vs. mitigated gaps.
* **Mitigation Lines:** Automatically draws lines when price tests an FVG level.
**3. Ichimoku Cloud Overlay:**
* Displays the full Ichimoku system (Tenkan, Kijun, and Kumo Cloud) to identify dynamic support/resistance and trend strength.
* **Usage:** Perfect for confirming breakout signals when price is above/below the Cloud.
**4. Momentum & Volume:**
* **Volume Coloring:** Bars are colored based on relative volume strength.
* **RSI & MACD:** Integrated buy/sell signals to spot overbought/oversold conditions instantly.
### 🎯 How to Trade (Confluence Strategy):
The power of this script lies in **Confluence** (multiple indicators agreeing):
* **Buy Setup:**
1. Price is above the **Ichimoku Cloud** and **SMA 200**.
2. Wait for a **"SCALP BUY"** signal or **"Trend BUY"** label.
3. Confirm that price is reacting to a **Bullish FVG** (Green Box).
4. **RSI/MACD** should show bullish momentum.
* **Sell Setup:**
1. Price is below the **Ichimoku Cloud** and **SMA 200**.
2. Wait for a **"SCALP SELL"** signal.
3. Confirm rejection from a **Bearish FVG** (Red Box).
---
**CREDITS & ATTRIBUTION:**
* **Fair Value Gap Logic:** This script utilizes the open-source FVG calculation method originally developed by **LuxAlgo**. We have integrated this logic with our custom trend system to provide a complete trading view.
* **Trend Logic:** Custom compilation of Moving Average crossovers and Ichimoku standard calculations.
*Disclaimer: This tool is for educational purposes only. Always manage your risk.*
ADX Forecast Colorful [DiFlip]ADX Forecast Colorful
Introducing one of the most advanced ADX indicators available — a fully customizable analytical tool that integrates forward-looking forecasting capabilities. ADX Forecast Colorful is a scientific evolution of the classic ADX, designed to anticipate future trend strength using linear regression. Instead of merely reacting to historical data, this indicator projects the future behavior of the ADX, giving traders a strategic edge in trend analysis.
⯁ Real-Time ADX Forecasting
For the first time, a public ADX indicator incorporates linear regression (least squares method) to forecast the future behavior of ADX. This breakthrough approach enables traders to anticipate trend strength changes based on historical momentum. By applying linear regression to the ADX, the indicator plots a projected trendline n periods ahead — helping users make more accurate and timely trading decisions.
⯁ Highly Customizable
The indicator adapts seamlessly to any trading style. It offers a total of 26 long entry conditions and 26 short entry conditions, making it one of the most configurable ADX tools on TradingView. Each condition is fully adjustable, enabling the creation of statistical, quantitative, and automated strategies. You maintain full control over the signals to align perfectly with your system.
⯁ Innovative and Science-Based
This is the first public ADX indicator to apply least-squares predictive modeling to ADX dynamics. Technically, it embeds machine learning logic into a traditional trend-strength indicator. Using linear regression as a predictive engine adds powerful statistical rigor to the ADX, turning it into an intelligent, forward-looking signal generator.
⯁ Scientific Foundation: Linear Regression
Linear regression is a fundamental method in statistics and machine learning used to model the relationship between a dependent variable y and one or more independent variables x. The basic formula for simple linear regression is:
y = β₀ + β₁x + ε
Where:
y = predicted value (e.g., future ADX)
x = explanatory variable (e.g., bar index or time)
β₀ = intercept
β₁ = slope (rate of change)
ε = random error term
The goal is to estimate β₀ and β₁ by minimizing the sum of squared errors. This is achieved using the least squares method, ensuring the best linear fit to historical data. Once the coefficients are calculated, the model extends the regression line forward, generating the ADX projection based on recent trends.
⯁ Least Squares Estimation
To minimize the error, the regression coefficients are calculated as:
β₁ = Σ((xᵢ - x̄)(yᵢ - ȳ)) / Σ((xᵢ - x̄)²)
β₀ = ȳ - β₁x̄
Where:
Σ = summation
x̄ and ȳ = means of x and y
i ranges from 1 to n (number of data points)
These formulas provide the best linear unbiased estimator under Gauss-Markov conditions — assuming constant variance and linearity.
⯁ Linear Regression in Machine Learning
Linear regression is a foundational algorithm in supervised learning. Its power in producing quantitative predictions makes it essential in AI systems, predictive analytics, time-series forecasting, and automated trading. Applying it to the ADX essentially places an intelligent forecasting engine inside a classic trend tool.
⯁ Visual Interpretation
Imagine an ADX time series like this:
Time →
ADX →
The regression line smooths these values and projects them n periods forward, creating a predictive trajectory. This forecasted ADX line can intersect with the actual ADX, offering smarter buy and sell signals.
⯁ Summary of Scientific Concepts
Linear Regression: Models variable relationships with a straight line.
Least Squares: Minimizes prediction errors for best fit.
Time-Series Forecasting: Predicts future values using historical data.
Supervised Learning: Trains models to predict outcomes from inputs.
Statistical Smoothing: Reduces noise and highlights underlying trends.
⯁ Why This Indicator Is Revolutionary
Scientifically grounded: Based on rigorous statistical theory.
Unprecedented: First public ADX using least-squares forecast modeling.
Smart: Uses machine learning logic.
Forward-Looking: Generates predictive, not just reactive, signals.
Customizable: Flexible for any strategy or timeframe.
⯁ Conclusion
By merging ADX and linear regression, this indicator enables traders to predict market momentum rather than merely follow it. ADX Forecast Colorful is not just another indicator — it’s a scientific leap forward in technical analysis. With 26 fully configurable entry conditions and smart forecasting, this open-source tool is built for creating cutting-edge quantitative strategies.
⯁ Example of simple linear regression with one independent variable
This example demonstrates how a basic linear regression works when there is only one independent variable influencing the dependent variable. This type of model is used to identify a direct relationship between two variables.
⯁ In linear regression, observations (red) are considered the result of random deviations (green) from an underlying relationship (blue) between a dependent variable (y) and an independent variable (x)
This concept illustrates that sampled data points rarely align perfectly with the true trend line. Instead, each observed point represents the combination of the true underlying relationship and a random error component.
⯁ Visualizing heteroscedasticity in a scatterplot with 100 random fitted values using Matlab
Heteroscedasticity occurs when the variance of the errors is not constant across the range of fitted values. This visualization highlights how the spread of data can change unpredictably, which is an important factor in evaluating the validity of regression models.
⯁ The datasets in Anscombe’s quartet were designed to have nearly the same linear regression line (as well as nearly identical means, standard deviations, and correlations) but look very different when plotted
This classic example shows that summary statistics alone can be misleading. Even with identical numerical metrics, the datasets display completely different patterns, emphasizing the importance of visual inspection when interpreting a model.
⯁ Result of fitting a set of data points with a quadratic function
This example illustrates how a second-degree polynomial model can better fit certain datasets that do not follow a linear trend. The resulting curve reflects the true shape of the data more accurately than a straight line.
⯁ What is the ADX?
The Average Directional Index (ADX) is a technical analysis indicator developed by J. Welles Wilder. It measures the strength of a trend in a market, regardless of whether the trend is up or down.
The ADX is an integral part of the Directional Movement System, which also includes the Plus Directional Indicator (+DI) and the Minus Directional Indicator (-DI). By combining these components, the ADX provides a comprehensive view of market trend strength.
⯁ How to use the ADX?
The ADX is calculated based on the moving average of the price range expansion over a specified period (usually 14 periods). It is plotted on a scale from 0 to 100 and has three main zones:
Strong Trend: When the ADX is above 25, indicating a strong trend.
Weak Trend: When the ADX is below 20, indicating a weak or non-existent trend.
Neutral Zone: Between 20 and 25, where the trend strength is unclear.
⯁ Entry Conditions
Each condition below is fully configurable and can be combined to build precise trading logic.
📈 BUY
🅰️ Signal Validity: The signal will remain valid for X bars .
🅰️ Signal Sequence: Configurable as AND or OR .
🅰️ +DI > -DI
🅰️ +DI < -DI
🅰️ +DI > ADX
🅰️ +DI < ADX
🅰️ -DI > ADX
🅰️ -DI < ADX
🅰️ ADX > Threshold
🅰️ ADX < Threshold
🅰️ +DI > Threshold
🅰️ +DI < Threshold
🅰️ -DI > Threshold
🅰️ -DI < Threshold
🅰️ +DI (Crossover) -DI
🅰️ +DI (Crossunder) -DI
🅰️ +DI (Crossover) ADX
🅰️ +DI (Crossunder) ADX
🅰️ +DI (Crossover) Threshold
🅰️ +DI (Crossunder) Threshold
🅰️ -DI (Crossover) ADX
🅰️ -DI (Crossunder) ADX
🅰️ -DI (Crossover) Threshold
🅰️ -DI (Crossunder) Threshold
🔮 +DI (Crossover) -DI Forecast
🔮 +DI (Crossunder) -DI Forecast
🔮 ADX (Crossover) +DI Forecast
🔮 ADX (Crossunder) +DI Forecast
📉 SELL
🅰️ Signal Validity: The signal will remain valid for X bars .
🅰️ Signal Sequence: Configurable as AND or OR .
🅰️ +DI > -DI
🅰️ +DI < -DI
🅰️ +DI > ADX
🅰️ +DI < ADX
🅰️ -DI > ADX
🅰️ -DI < ADX
🅰️ ADX > Threshold
🅰️ ADX < Threshold
🅰️ +DI > Threshold
🅰️ +DI < Threshold
🅰️ -DI > Threshold
🅰️ -DI < Threshold
🅰️ +DI (Crossover) -DI
🅰️ +DI (Crossunder) -DI
🅰️ +DI (Crossover) ADX
🅰️ +DI (Crossunder) ADX
🅰️ +DI (Crossover) Threshold
🅰️ +DI (Crossunder) Threshold
🅰️ -DI (Crossover) ADX
🅰️ -DI (Crossunder) ADX
🅰️ -DI (Crossover) Threshold
🅰️ -DI (Crossunder) Threshold
🔮 +DI (Crossover) -DI Forecast
🔮 +DI (Crossunder) -DI Forecast
🔮 ADX (Crossover) +DI Forecast
🔮 ADX (Crossunder) +DI Forecast
🤖 Automation
All BUY and SELL conditions are compatible with TradingView alerts, making them ideal for fully or semi-automated systems.
⯁ Unique Features
Linear Regression: (Forecast)
Signal Validity: The signal will remain valid for X bars
Signal Sequence: Configurable as AND/OR
Condition Table: BUY/SELL
Condition Labels: BUY/SELL
Plot Labels in the Graph Above: BUY/SELL
Automate and Monitor Signals/Alerts: BUY/SELL
Background Colors: "bgcolor"
Background Colors: "fill"
Linear Regression (Forecast)
Signal Validity: The signal will remain valid for X bars
Signal Sequence: Configurable as AND/OR
Table of Conditions: BUY/SELL
Conditions Label: BUY/SELL
Plot Labels in the graph above: BUY/SELL
Automate & Monitor Signals/Alerts: BUY/SELL
Background Colors: "bgcolor"
Background Colors: "fill"
EMA Percent Angle & Slope VisualizerEMA Percent Angle & Slope Visualizer is a powerful trend-strength tool that measures the true geometric slope of an EMA using percent-normalized angle calculations.
Unlike raw angle or ATR-based angle methods, this indicator uses the formula:
angle = atan( (EMA_t - EMA_(t-1)) / EMA_(t-1) ) * (180 / pi)
This gives you a universal slope measurement that works across stocks, indices, currencies, and crypto — regardless of price scale.
🔍 Features
Percent-normalized EMA angle for accurate trend strength
Auto-detected slope segments
Dynamic EMA color
🟢 Bullish slope
🔴 Bearish slope
⚪ Neutral (angle below threshold)
Dashed slope lines drawn only during valid slope runs
Angle label displayed at slope end
Works on any timeframe
Designed for momentum traders, trend followers, breakout traders, and algo developers
📌 Why Percent-Normalized Angle?
Raw price angle is meaningless because angles depend on chart scaling.
Percent-normalized angle gives a true slope, equal across all instruments.
✔ Tip
Slopes above +0.15° and below –0.15° represent strong trend phases for Nifty.
Adjust threshold for your timeframe according to your script
Dr. Barbara Star: Dual Strategies Combined [Merged] - geminiDr. Barbara Star: Dual Strategy Suite (Merged)
Overview
This script integrates two distinct but complementary trading methodologies developed by Dr. Barbara Star: "Capture Direction & Momentum" and "Profit with Dual Oscillators & Bands." While both strategies utilize price channels to filter noise, they approach entry and exit timing from different angles—one focusing on momentum shifts (Stochastic/EMA) and the other on cyclical price deviations (DPO/Bollinger Bands).
This tool allows the user to run either strategy independently or combine them to find high-confluence setups where momentum and cyclical structure align.
Strategy A: Capture Direction & Momentum
Source: Capture Direction And Momentum
1. Purpose & Theory
The goal of this method is to filter out the "noise" of choppy markets and identify the specific point where price direction aligns with momentum strength. It moves away from trying to catch exact tops or bottoms and instead focuses on catching the "meat" of the trend (continuation).
2. Implementation
Structure (The Channel): A 13-period SMA of the Highs and Lows creates a "No Trade Zone". When price is inside this channel, the market is considered directionless.
Direction (5 EMA): A fast 5-period EMA acts as a directional trigger. When it breaks outside the SMA channel, it signals acceleration.
Momentum (Modified Stochastic): A Slow Stochastic (14,2) is used, but with a crucial modification: the overbought/oversold levels are shifted to 40 and 60 (instead of 20/80).
3. How to Use It
The "Trend Zones" (Background Colors):
Green Background (Bullish): The 5 EMA is above the channel AND the Stochastic is > 60. This is the "Go" zone.
Red Background (Bearish): The 5 EMA is below the channel AND the Stochastic is < 40.
Yellow Background: The "No Trade Zone." The price is consolidating, or the indicators disagree.
The Continuation Signal (Marked by "U" or "D"):
Why it matters: This is the most powerful setup in the system. It detects when price pulls back (retracement) but momentum remains strong.
The Signal: If the 5 EMA dips back into the SMA channel (weakness) but the Stochastic stays above 60 (strength), a blue "U" (Up) marker appears. This indicates the pullback is likely a buying opportunity, not a reversal. Conversely, a yellow "D" appears in downtrends if Stoch stays below 40.
Exits (Marked by "X"):
Signals to take profit when the 5 EMA closes back inside the channel and the Stochastic crosses back into the neutral 40–60 zone.
Strategy B: Dual Oscillators & Bands
Source: Profit With Dual Oscillators & Bands
1. Purpose & Theory
This strategy uses "Dual Bollinger Bands" to define the volatility structure of the trend and "Dual Detrended Price Oscillators" (DPO) to time the entries based on cycle shifts.
2. Implementation
Structure (Dual Bands):
Inner Bands (1 SD): These define the "Trend Channel." Strong trends tend to ride between the 1 SD and 3 SD bands.
Outer Bands (3 SD): These represent extremes (containing 99.5% of price action). Hits here often signal exhaustion.
Timing (Dual DPOs):
Long Oscillator (DPO 20): Identifies the broader trend direction (Positive = Bullish).
Short Oscillator (DPO 9): Identifies shorter-term timing and potential divergences.
3. How to Use It
Identifying the Trend State:
Strong Uptrend: Price holds above the Upper Inner Band (1 SD).
Strong Downtrend: Price holds below the Lower Inner Band (1 SD).
Transition/Neutral: Price is stuck between the Upper and Lower Inner bands.
Entry Signals (Triangles on Chart & Circles in Pane):
Aggressive Entry: When the fast DPO 9 crosses zero. This signals early momentum shifts.
Conservative Entry: Wait for the slow DPO 20 to cross zero, confirming the broader trend has shifted.
Visuals: The script plots triangles on the main chart when these cross. In the lower pane, a Blue Circle indicates a bullish cross and a Yellow Circle indicates a bearish cross.
Continuation Setup:
Similar to Strategy A, look for moments where the DPO 9 dips below zero (pullback) while the DPO 20 remains above zero (trend intact). This is often a reload opportunity.
Combined Mode: The "Power Couple"
When selecting "Both" in the settings, the indicator merges these tools for maximum confirmation:
Visual filtering: The lower pane automatically scales the DPO lines to fit inside the 0–100 Stochastic range (centering the DPO zero line at 50). This allows you to read both momentum and cycles in a single glance.
Confluence Trading:
Look for the Background to turn Green (Strategy A Trend) coincident with a Blue Triangle/Circle (Strategy B Momentum Cross).
Use the Inner Bollinger Bands (Strategy B) as your trailing stop-loss while riding the SMA Channel (Strategy A) trend.
Reference Settings
Strategy A: SMA Channel (13), EMA (5), Stochastic (14, 2, 40/60 levels).
Strategy B: Bollinger Bands (20 SMA, 1.0 & 3.0 deviations), DPO (9 & 20).
Sources: of the methodologies
1-Stocks & Commodities V. 32:7 (10-16): Profit With Dual Oscillators & Bands by Barbara Star, PhD
2-Stocks & Commodities V. 43:12 (8–12): Capture Direction And Momentum by Barbara Star, PhD
Bullish and Bearish Divergence entrythis strategy is a signal to traders where there is a divergence in the chart..
Sammy Buy/Sell Signals (OneLine Version)Sammy's buy/sell signals one line version. Very simple to follow what's going up and down.
Volume Profile S/R + OB/OS + BreaksAs a support resistance trader I have created this indicator that shows SR lines. RSI over bought and over sold. I also added momentum candle.
It's easy to use. The arrows show over bought and over sold, that's where I start to be interested. Confirmation is if we are near a support/resistance area. shown as a red/green line.
Don't just trade the RSI, Be patient and only take the perfekt setups.
I't clean, it's simple it works.
SNP420/TRCS_MASTERMicro Body Candle Highlighter is a visual tool for TradingView that continuously scans the active timeframe and highlights all candles with an extremely small body.
For every bar (including the currently forming one), the indicator compares the absolute distance between Open and Close to a user-defined threshold in ticks (default: 1 tick, based on syminfo.mintick).
If the candle’s body size is less than or equal to this threshold, the indicator draws a red frame around the candle – either around the body only or the full high-to-low range, depending on user settings.
Optionally, the indicator can also trigger alerts whenever such a “micro body” candle is detected, allowing traders to react immediately to potential indecision, pauses, or micro-reversals in price action.
author: SNP_420
project: FNXS
ps: Piece and love
🚀 Hull Squeeze + Money Flow Trinity - Ultimate Breakout Hunter🚀 Hull Squeeze + Money Flow Trinity - Ultimate Breakout HunterThis is a high-octane, multi-factor breakout hunter designed to capture explosive moves by identifying the rare confluence of extreme price compression, aligned trend, and confirmation from institutional money flow. It combines three best-in-class market analysis tools into a single, comprehensive signaling system.The indicator is engineered to filter out noisy, low-probability setups, focusing instead on high-conviction events like "MEGA SQUEEZE FIRE" and the elusive "GOD MODE SETUP".How the Trinity Works:📊 Hull Ribbon & Compression: Uses a ribbon of Hull Moving Averages (HMAs) to filter the underlying trend and, crucially, measure the compression of volatility relative to ATR. When the ribbon is highly compressed, it signals the market is coiled and ready for a major move—a Pre-Squeeze warning.💥 Squeeze Detection: Implements the classic Bollinger Band (BB) / Keltner Channel (KC) Squeeze logic to pinpoint the exact moment volatility is drained (Squeeze ON) and the moment the resulting energy is released (Squeeze FIRE).💰 Money Flow Trinity: Confirms the quality of the move by aggregating three volume-based indicators—Force Index, Chaikin Money Flow (CMF), and Accumulation/Distribution (A/D) Line. This generates a Money Flow Score ($\le 3$) that validates the directional pressure, ensuring the breakout is backed by genuine buying or selling.The Ultimate Edge:The indicator plots actionable signals directly on the chart and provides a real-time Dashboard displaying the status of each component and the final Signal Status. Use it to spot low-risk, high-reward opportunities on your favorite instruments.
new_youtube_strategy//@version=5
strategy("Dow + Homma 1m Scalper (15m filter)", overlay=true, margin_long=100, margin_short=100, initial_capital=10000)
//===== INPUTS =====
maLen = input.int(50, "Trend SMA Length", minval=5)
htf_tf = input.timeframe("15", "Higher TF")
priceTolPct = input.float(0.05, "SR tolerance %", step=0.01)
wickFactor = input.float(2.0, "Hammer/ShootingStar wick factor", step=0.1)
dojiThresh = input.float(0.1, "Doji body % of range", step=0.01)
risk_RR = input.float(2.0, "Reward:Risk", step=0.1)
capitalRiskPct = input.float(1.0, "Risk % of equity per trade", step=0.1)
//===== 1m TREND (SMA) =====
sma1 = ta.sma(close, maLen)
sma1Up = sma1 > sma1
sma1Down = sma1 < sma1
uptrend1 = close > sma1 and sma1Up
downtrend1 = close < sma1 and sma1Down
//===== 15m TREND VIA request.security =====
sma15 = request.security(syminfo.tickerid, htf_tf, ta.sma(close, maLen), lookahead=barmerge.lookahead_off)
sma15Up = sma15 > sma15
sma15Down = sma15 < sma15
uptrend15 = close > sma15 and sma15Up
downtrend15 = close < sma15 and sma15Down
//===== SWING HIGHS/LOWS (LOCAL EXTREMA) =====
var int left = 3
var int right = 3
swHigh = ta.pivothigh(high, left, right)
swLow = ta.pivotlow(low, left, right)
//===== SR FLIP LEVELS =====
var float srSupport = na
var float srResistance = na
// when a swing high is broken -> new support
if not na(swHigh)
if close > swHigh
srSupport := swHigh
// when a swing low is broken -> new resistance
if not na(swLow)
if close < swLow
srResistance := swLow
//===== CANDLE METRICS =====
body = math.abs(close - open)
cRange = high - low
upperW = high - math.max(open, close)
lowerW = math.min(open, close) - low
isBull() => close > open
isBear() => close < open
bullHammer() =>
cRange > 0 and
isBull() and
lowerW >= wickFactor * body and
upperW <= body
bearShootingStar() =>
cRange > 0 and
isBear() and
upperW >= wickFactor * body and
lowerW <= body
isDoji() =>
cRange > 0 and body <= dojiThresh * cRange
bullEngulfing() =>
isBear() and isBull() and
open <= close and close >= open
bearEngulfing() =>
isBull() and isBear() and
open >= close and close <= open
//===== SR PROXIMITY =====
tol = priceTolPct * 0.01 * close
nearSupport = not na(srSupport) and math.abs(close - srSupport) <= tol
nearResistance = not na(srResistance) and math.abs(close - srResistance) <= tol
//===== SIGNAL CONDITIONS =====
bullCandle = bullHammer() or isDoji() or bullEngulfing()
bearCandle = bearShootingStar() or isDoji() or bearEngulfing()
longTrendOK = uptrend1 and uptrend15
shortTrendOK = downtrend1 and downtrend15
longSignal = longTrendOK and nearSupport and bullCandle
shortSignal = shortTrendOK and nearResistance and bearCandle
//===== POSITION SIZING (IN RISK UNITS) =====
var float lastEquity = strategy.equity
riskCapital = strategy.equity * (capitalRiskPct * 0.01)
//===== ENTRY / EXIT PRICES =====
longStop = math.min(low, nz(srSupport, low))
longRisk = close - longStop
longTP = close + risk_RR * longRisk
shortStop = math.max(high, nz(srResistance, high))
shortRisk = shortStop - close
shortTP = close - risk_RR * shortRisk
// qty in contracts (approx; assumes price * qty ≈ capital used)
longQty = longRisk > 0 ? riskCapital / longRisk : 0.0
shortQty = shortRisk > 0 ? riskCapital / shortRisk : 0.0
//===== EXECUTION =====
if longSignal and longRisk > 0 and longQty > 0
strategy.entry("Long", strategy.long, qty=longQty)
strategy.exit("Long TP/SL", from_entry="Long", stop=longStop, limit=longTP)
if shortSignal and shortRisk > 0 and shortQty > 0
strategy.entry("Short", strategy.short, qty=shortQty)
strategy.exit("Short TP/SL", from_entry="Short", stop=shortStop, limit=shortTP)
//===== PLOTS =====
plot(sma1, color=color.orange, title="SMA 1m")
plot(sma15, color=color.blue, title="HTF SMA (15m)")
plot(srSupport, "SR Support", color=color.new(color.green, 50), style=plot.style_linebr)
plot(srResistance,"SR Resistance",color=color.new(color.red, 50), style=plot.style_linebr)
// Visual debug for signals
plotshape(longSignal, title="Long Signal", style=shape.triangleup, location=location.belowbar, color=color.lime, size=size.tiny)
plotshape(shortSignal, title="Short Signal", style=shape.triangledown, location=location.abovebar, color=color.red, size=size.tiny)
Session Highs & Lows - Pinhead TradesMarks out the session highs and lows + Sweeps
*Very good for looking for reversal entry's targeting opposing session liquidity
Smart Money Toolkit - PD Engine Bias Map [KedArc Quant]Description
Smart Money is an advanced multi-layer Smart Money Concepts framework that automatically detects structure shifts, premium-discount zones, and institutional order flow.
It is built around the PD Engine, which calculates the midpoint of the most recent market swing and dynamically determines BUY or SELL bias based on where current price trades relative to that equilibrium. This toolkit visualizes structure, order blocks, and bias context in one clean map, giving traders an institutional-grade view without unnecessary signal clutter.
Why It Is Unique
- All CHoCH, BOS, Order Block, FVG, and PD logic are coded from scratch.
- Uses true equilibrium (50 percent PD midpoint) for dynamic bias.
- Optimized for stability and non-repainting behavior.
- Designed for clarity with minimal, performance-safe visuals.
Entry and Exit Logic (Discretionary Framework)
- This toolkit is not a signal generator. It provides market context that guides discretionary trading.
BUY Bias (Discount Zone)
- Price trades below PD Mid: the market is in discount.
- Wait for a bullish CHoCH or reaction from a demand OB or FVG before buying.
- Target 1 = PD Mid. Target 2 = next opposite OB or FVG.
SELL Bias (Premium Zone)
- Price trades above PD Mid: the market is in premium.
- Wait for a bearish CHoCH or reaction from a supply OB or FVG before shorting.
- Target 1 = PD Mid. Target 2 = next opposite OB or FVG.
Institutional concept sequence: Bias → Structure Shift → Confirmation → Execution.
Input Configuration
Swing Sensitivity - Determines how far back to identify HH and LL pivots.
OB / FVG Detection - Toggles visual Order Block or Fair Value Gap zones.
PD Engine - Shows PD midpoint line, zone shading, and bias table.
Multi-TF Bias Sync - Optionally reads a higher timeframe bias for confirmation.
Color Themes - Switch between light, dark, or institutional palettes.
Formula / Logic Summary
Concept Formula
PD Mid (Equilibrium) (Recent Swing High + Recent Swing Low) / 2
BUY Bias close < PD Mid
SELL Bias close > PD Mid
CHoCH / BOS Pivot-based structure reversal: HH→LL or LL→HH
Order Block Last bullish or bearish candle before displacement.
FVG Gap between prior candle high/low and next candle range.
These formulas follow the structure used in institutional Smart Money Concepts.
How It Helps Traders
- Shows institutional premium and discount zones visually.
- Defines clear directional bias before entry.
- Combines structure, order blocks, FVG, and equilibrium in one layout.
- Works on any timeframe or asset.
- Prevents emotional trades by giving objective bias context.
Glossary
PD Mid Midpoint between recent swing high and low (market fair value).
Premium Zone Price above PD Mid; sellers control.
Discount Zone Price below PD Mid; buyers control.
CHoCH Change of Character, first reversal signal.
BOS Break of Structure, trend continuation confirmation.
OB Order Block, last institutional candle before move.
FVG Fair Value Gap, price imbalance often revisited.
FAQ
Q: Is this a signal indicator?
A: No. It is a contextual framework that supports manual decision-making.
Q: Does it repaint?
A: No. All structure logic is confirmed on bar close.
Q: Does it work on all markets?
A: Yes. It is purely price-based and timeframe independent.
Q: When does bias change?
A: Only after a new confirmed swing high or low.
Q: Can it be backtested?
A: You can build strategies on top of this context using your own entry and exit rules.
Disclaimer
This script is provided for educational purposes only.
It is not financial advice.
Trading carries risk. Past performance does not guarantee future results.
Use proper risk management and test on demo accounts before applying to live markets.
Grok/Claude Turtle Soup Alert SystemReplaces previous Turtle Soup Strategy/Indicator as Tradingview will not let me update it.
# 🥣 Turtle Soup Strategy (Enhanced)
## A Mean-Reversion Strategy Based on Failed Breakouts
---
## Historical Origins
### The Original Turtle Traders (1983-1988)
The Turtle Trading system is one of the most famous experiments in trading history. In 1983, legendary commodities trader **Richard Dennis** made a bet with his partner **William Eckhardt** about whether great traders were born or made. Dennis believed trading could be taught; Eckhardt believed it was innate.
To settle the debate, Dennis recruited 23 ordinary people through newspaper ads—including a professional blackjack player, a fantasy game designer, and an accountant—and taught them his trading system in just two weeks. He called them "Turtles" after turtle farms he had visited in Singapore, saying *"We are going to grow traders just like they grow turtles in Singapore."*
The results were extraordinary. Over the next five years, the Turtles reportedly earned over **$175 million in profits**. The experiment proved Dennis right: trading could indeed be taught.
#### The Original Turtle Rules:
- **Entry:** Buy when price breaks above the 20-day high (System 1) or 55-day high (System 2)
- **Exit:** Sell when price breaks below the 10-day low (System 1) or 20-day low (System 2)
- **Stop Loss:** 2x ATR (Average True Range) from entry
- **Position Sizing:** Based on volatility (ATR)
- **Philosophy:** Pure trend-following—catch big moves by riding breakouts
The Turtle system was a **trend-following** strategy that assumed breakouts would lead to sustained trends. It worked brilliantly in trending markets but suffered during choppy, range-bound conditions.
---
### The Turtle Soup Strategy (1990s)
In the 1990s, renowned trader **Linda Bradford Raschke** (along with Larry Connors) observed something interesting: many of the breakouts that the Turtle system traded actually *failed*. Price would spike above the 20-day high, trigger Turtle buy orders, then immediately reverse—trapping the breakout traders.
Raschke realized these failed breakouts were predictable and tradeable. She developed the **Turtle Soup** strategy, which does the *exact opposite* of the original Turtle system:
> *"Instead of buying the breakout, we wait for it to fail—then fade it."*
The name "Turtle Soup" is a clever play on words: the strategy essentially "eats" the Turtles by trading against them when their breakouts fail.
#### Original Turtle Soup Rules:
- **Setup:** Price makes a new 20-day high (or low)
- **Qualifier:** The previous 20-day high must be at least 3-4 days old (not a fresh breakout)
- **Entry Trigger:** Price reverses back inside the channel (failed breakout)
- **Entry:** Go SHORT (against the failed breakout above), or LONG (against the failed breakdown below)
- **Philosophy:** Mean-reversion—fade false breakouts and profit from trapped traders
#### Turtle Soup Plus One Variant:
Raschke also developed a more conservative variant called "Turtle Soup Plus One" which waits for the *next bar* after the breakout to confirm the failure before entering. This reduces false signals but may miss some opportunities.
---
## Our Enhanced Turtle Soup Strategy
We have taken the classic Turtle Soup concept and enhanced it with modern technical indicators and filters to improve signal quality and adapt to today's markets.
### Core Logic Preserved
The fundamental strategy remains true to Raschke's original concept:
| Turtle (Original) | Turtle Soup (Our Strategy) |
|-------------------|---------------------------|
| BUY breakout above 20-day high | SHORT when that breakout FAILS |
| SELL breakout below 20-day low | LONG when that breakdown FAILS |
| Trend-following | Mean-reversion |
| "The trend is your friend" | "Failed breakouts trap traders" |
---
### Enhancements & Improvements
#### 1. RSI Exhaustion Filter
**Addition:** RSI must confirm exhaustion before entry
- **For SHORT entries:** RSI > 60 (buyers exhausted)
- **For LONG entries:** RSI < 40 (sellers exhausted)
**Why:** The original Turtle Soup had no momentum filter. Adding RSI ensures we only fade breakouts when the market is showing signs of exhaustion, significantly reducing false signals. This enhancement was inspired by later traders who found RSI extremes (originally 90/10, softened to 60/40) dramatically improved win rates.
#### 2. ADX Trending Filter
**Addition:** ADX must be > 20 for trades to execute
**Why:** While the original Turtle Soup was designed for ranging markets, we found that requiring *some* trend strength (ADX > 20) actually improves results. This ensures we're trading in markets with enough directional movement to create meaningful failed breakouts, rather than random noise in dead markets.
#### 3. Heikin Ashi Smoothing
**Addition:** Optional Heikin Ashi calculations for breakout detection
**Why:** Heikin Ashi candles smooth out price noise and make trend reversals more visible. When enabled, the strategy uses HA values to detect breakouts and failures, reducing whipsaws from erratic price spikes.
#### 4. Dynamic Donchian Channels with Regime Detection
**Addition:** Color-coded channels based on market regime
- 🟢 **Green:** Bullish regime (uptrend + DI+ > DI- + OBV bullish)
- 🔴 **Red:** Bearish regime (downtrend + DI- > DI+ + OBV bearish)
- 🟡 **Yellow:** Neutral regime
**Why:** Visual regime detection helps traders understand the broader market context. The original Turtle Soup had no regime awareness—our enhancement lets traders see at a glance whether conditions favor the strategy.
#### 5. Volume Spike Detection (Optional)
**Addition:** Optional filter requiring volume surge on the breakout bar
**Why:** Failed breakouts are more significant when they occur on high volume. A volume spike on the breakout bar (default 1.2x average) indicates more traders got trapped, creating stronger reversal potential.
#### 6. ATR-Based Stops and Targets
**Addition:** Configurable ATR-based stop losses and profit targets
- **Stop Loss:** 1.5x ATR (default)
- **Profit Target:** 2.0x ATR (default)
**Why:** The original Turtle Soup used fixed stop placement. ATR-based stops adapt to current volatility, providing tighter stops in calm markets and wider stops in volatile conditions.
#### 7. Signal Cooldown
**Addition:** Minimum bars between trades (default 5)
**Why:** Prevents overtrading during choppy conditions where multiple failed breakouts might occur in quick succession.
#### 8. Real-Time Info Panel
**Addition:** Comprehensive dashboard showing:
- Current regime (Bullish/Bearish/Neutral)
- RSI value and zone
- ADX value and trending status
- Breakout status
- Bars since last high/low
- Current setup status
- Position status
**Why:** Gives traders instant visibility into all strategy conditions without needing to check multiple indicators.
---
## Entry Rules Summary
### SHORT Entry (Fading Failed Breakout Above)
1. ✅ Price breaks ABOVE the 20-period Donchian high
2. ✅ Previous 20-period high was at least 1 bar ago
3. ✅ Price closes back BELOW the Donchian high (failed breakout)
4. ✅ RSI > 60 (exhausted buyers)
5. ✅ ADX > 20 (trending market)
6. ✅ Cooldown period met
→ **Enter SHORT**, betting the breakout will fail
### LONG Entry (Fading Failed Breakdown Below)
1. ✅ Price breaks BELOW the 20-period Donchian low
2. ✅ Previous 20-period low was at least 1 bar ago
3. ✅ Price closes back ABOVE the Donchian low (failed breakdown)
4. ✅ RSI < 40 (exhausted sellers)
5. ✅ ADX > 20 (trending market)
6. ✅ Cooldown period met
→ **Enter LONG**, betting the breakdown will fail
---
## Exit Rules
1. **ATR Stop Loss:** Position closed if price moves 1.5x ATR against entry
2. **ATR Profit Target:** Position closed if price moves 2.0x ATR in favor
3. **Channel Exit:** Position closed if price breaks the exit channel in the opposite direction
4. **Mid-Channel Exit:** Position closed if price returns to channel midpoint
---
## Best Market Conditions
The Turtle Soup strategy performs best when:
- ✅ Markets are prone to false breakouts
- ✅ Volatility is moderate (not too low, not extreme)
- ✅ Price is oscillating within a broader range
- ✅ There are clear support/resistance levels
The strategy may struggle when:
- ❌ Strong trends persist (breakouts follow through)
- ❌ Volatility is extremely low (no meaningful breakouts)
- ❌ Markets are in news-driven directional moves
---
## Default Settings
| Parameter | Default | Description |
|-----------|---------|-------------|
| Lookback Period | 20 | Donchian channel period |
| Min Bars Since Extreme | 1 | Bars since last high/low |
| RSI Length | 14 | RSI calculation period |
| RSI Short Level | 60 | RSI must be above this for shorts |
| RSI Long Level | 40 | RSI must be below this for longs |
| ADX Length | 14 | ADX calculation period |
| ADX Threshold | 20 | Minimum ADX for trades |
| ATR Period | 20 | ATR calculation period |
| ATR Stop Multiplier | 1.5 | Stop loss distance in ATR |
| ATR Target Multiplier | 2.0 | Profit target distance in ATR |
| Cooldown Period | 5 | Minimum bars between trades |
| Volume Multiplier | 1.2 | Volume spike threshold |
---
## Philosophy
> *"The Turtle system made millions by following breakouts. The Turtle Soup strategy makes money when those breakouts fail. In trading, there's always someone on the other side of the trade—this strategy profits by being the smart money that fades the trapped breakout traders."*
The beauty of the Turtle Soup strategy is its elegant simplicity: it exploits a known, repeatable pattern (failed breakouts) while using modern filters (RSI, ADX) to improve timing and reduce false signals.
---
## Credits
- **Original Turtle System:** Richard Dennis & William Eckhardt (1983)
- **Turtle Soup Strategy:** Linda Bradford Raschke & Larry Connors (1990s)
- **RSI Enhancement:** Various traders who discovered RSI extremes improve reversal detection
- **This Implementation:** Enhanced with Heikin Ashi smoothing, regime detection, ADX filtering, and comprehensive visualization
---
*"We're not following the turtles—we're making soup out of them."* 🥣






















