ORION: Linear Regression Consolidation SystemDescription:
This script is a custom-built technical analysis tool designed to identify high-probability consolidation zones (market equilibrium) and trade their subsequent breakouts in the direction of the established trend.
originality & Concept: While many indicators use simple Bollinger Band squeezes, this system employs a multi-factor algorithm to define "Consolidation" mathematically. It synthesizes three core concepts:
Volatility Compression (ATR): It compares the current range against the Average True Range (ATR) to ensure price action is compressed.
Structural Stationarity (Linear Regression): It calculates the slope of the Linear Regression line over a lookback period. A zone is valid ONLY if the slope is near-zero (< 0.25), ensuring the market is truly flat and not just choppy.
Trend Alignment (EMA): To filter out low-probability counter-trend signals, the system utilizes a 150-period Exponential Moving Average (EMA) as a baseline. Breakouts are only valid if they align with the macro trend (Above EMA = Long, Below EMA = Short).
How It Works:
Zone Detection: The script draws a visual box when the price range is within the ATR multiplier limit AND the Linear Regression slope is flat.
Signal Validation: A signal is triggered only on a confirmed candle close outside the box.
False Breakout Protection: A volume/body size filter checks if the breakout candle has significant momentum compared to the average of the last 20 bars.
Risk Management : The script projects a fixed Risk:Reward setup (default 1:1.8) and includes a "Breakeven" logic that visualizes when a trade has reached 50% of its target, securing the position.
Settings:
This system is highly customizable to fit different market conditions. Below are the specific parameters used in this setup:
1. Strategy Core (Logic)
Lookback Period (15): The algorithm analyzes the most recent 15 candles to detect market equilibrium. On the M5 timeframe, this represents a 75-minute window of stability, which is optimal for scalping setups.
Box Width (ATR Multiplier) (3) : Defines the maximum vertical range of the consolidation box. A value of 3 means the box height cannot exceed 3x the Average True Range (ATR). This ensures we are trading tight, compressed zones rather than volatile, expansive ranges.
Slope Tolerance (0.4): Controls the strictness of the Linear Regression slope. A value of 0.4 allows for a slight tilt in the consolidation structure, capturing more valid opportunities than a strictly horizontal (0.0) setting without compromising the "flatness" requirement.
2. Risk Management
Risk : Reward Ratio (1.8): Sets the profit target relative to the stop loss. For every $1 risked, the system targets $1.8 in profit. This provides a positive mathematical expectancy even with a moderate win rate.
Breakeven Trigger (%) (0.5): A capital preservation feature. When the price covers 50% (0.5) of the distance to the Take Profit target, the trade is visually marked as "Breakeven" (Risk-Free). If the price reverses after this point, it is not counted as a loss.
3. Protection & Filters (Insurance)
Enable 'Strong Candle' Filter (ON): Filters out weak "creeping" breakouts. The system will only trigger a signal if the breakout candle demonstrates significant momentum.
Average Size Period (20): The baseline for momentum is calculated using the average body size of the last 20 candles.
Candle Strength Factor (1): The breakout candle must be at least 1x (100%) the size of the average candle. This ensures that real volume and momentum are backing the move, reducing the chance of fakeouts.
Disclaimer: This script is intended for educational and analytical purposes to assist traders in identifying market structure.
Indicateur Pine Script®






















