OPEN-SOURCE SCRIPT
Event Horizon

Event Horizon is a historical analog projection fan designed to answer one practical question:
What has price tended to do after market conditions similar to the current one?
Instead of using a fixed crossover, oscillator threshold, or trend flip, this indicator builds a market fingerprint from the current chart, searches historical bars for similar conditions, and projects how those past analogs moved forward. The result is a visual forward fan showing possible path behavior, consensus direction, dispersion, confidence, and the closest historical analog path.
The goal is not to predict the future with certainty. The goal is to give traders a structured way to compare the current setup against similar historical environments and quickly see whether the analogs are aligned, scattered, bullish, bearish, or not useful.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
What makes this script different
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Most projection tools draw a channel, regression, moving average extension, or volatility cone from a fixed formula.
Event Horizon uses a historical analog engine. Each bar is converted into a multi-factor feature profile, then compared against prior market states using weighted Euclidean similarity. The closest historical analogs are used to create a forward projection fan.
The script combines:
• Historical analog matching
• Weighted Euclidean distance
• Regime-aware scoring
• Volatility and trend-state filtering
• Consensus projection logic
• Closest historical path overlay
• Agreement and confidence scoring
• Directional historical event dots
• A visual fan that shows uncertainty instead of one hard prediction
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
How it works
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1. Market fingerprint
The script measures the current market using multiple dimensions, including:
• Recent price movement
• Trend slope
• ATR expansion and compression
• Candle range and body behavior
• Wick imbalance
• Position relative to recent structure
• Breakout distance
• Volume ratio and volume trend
• ATR percentile
• ADX / trend strength
• Historical shape samples
This creates a multi-dimensional profile of the current setup.
2. Historical analog search
The current profile is compared to historical profiles on the same chart. Similarity is calculated with weighted Euclidean distance, so higher-value features such as trend, volatility regime, and price-shape behavior can matter more than smaller candle details.
Closer historical examples receive stronger match scores.
3. Regime awareness
The script also classifies the current environment into regimes such as trend, compression, volatility expansion, volume shock, or range/chop. Historical examples from incompatible regimes are penalized, helping reduce weak comparisons.
4. Forward projection
Once the best analogs are selected, the script looks at what actually happened after those historical setups. Those forward moves are normalized and projected from the current anchor point.
5. Consensus and confidence
The indicator summarizes the analog group with:
• Directional bias
• Agreement percentage
• Dispersion
• Confidence score
• Edge state: TRADEABLE, CAUTION, or NO EDGE
• Historical self-test statistics
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
How to read the fan
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
The colored fan shows the projected analog field.
The colored median shows the consensus path of the analog set.
The white line shows the closest visible historical analog path. It is not a guaranteed target. It is the path taken by the most similar past setup selected by the engine.
The wider the fan, the more disagreement there is between analogs.
The tighter the fan, the more historically aligned the analogs are.
The confidence and edge label are important. A bullish-looking fan with low confidence or high dispersion should be treated differently than a bullish fan with strong agreement and cleaner regime structure.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Historical dots
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Historical event dots help visually review where prior projection events occurred.
• Bullish projection dots appear below price
• Bearish projection dots appear above price
• Mixed or neutral readings are visually separated
This makes it easier to inspect whether the indicator has been identifying useful directional conditions on the current symbol and timeframe.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
How to use it
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
For newer traders:
1. Start on the Daily or 4H chart.
2. Look at the colored median.
3. Check whether the white analog path agrees with the median.
4. Check confidence and agreement.
5. Avoid forcing trades when the label says NO EDGE or when dispersion is high.
A stronger bullish read usually has:
• Median path rising
• White analog path also rising
• Agreement above roughly 65%
• Confidence above roughly 70
• Low or medium dispersion
• Edge state showing TRADEABLE or CAUTION, not NO EDGE
A weaker or avoidable read usually has:
• Median and white path disagreeing
• Agreement near 50%
• High dispersion
• Low confidence
• Range/chop regime
• NO EDGE label
For experienced traders:
Use the fan as an analog-based context layer. It is most useful when combined with your own structure, liquidity, trend, support/resistance, volume, or macro view. The script is designed to show whether historical analog behavior supports or conflicts with the trade idea you already see on the chart.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Suggested settings
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Balanced stocks / ETFs:
• Mode: Current Bar Projection
• Visual Mode: Cinematic
• Fan Style: Hybrid Swarm + Contours
• Horizon: 30
• Memory Lookback: 1800
• Max Analogs: 30
• Minimum Analogs: 6
• Pre-Event Window: 20
• Shape Samples: 6
• Path Scale: 1.0
Crypto:
• Horizon: 24
• Memory Lookback: 2000 to 2500
• Path Scale: 0.75 to 0.90
• Flexible direction matching
Intraday:
• Horizon: 20 to 24
• Minimum Analogs: 8
• Path Scale: 0.75 to 1.0
• Use liquid symbols only
Trend continuation:
• Direction Matching: Strict
• Mirror Opposite Direction: Off
• Path Scale: 1.0
Reversal / exhaustion:
• Direction Matching: Flexible
• Mirror Opposite Direction: On
• Path Scale: 0.75
• Shorter horizon preferred
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Best use cases
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Event Horizon is best suited for:
• Liquid stocks
• Major ETFs
• Index products
• Major crypto pairs
• Trend continuation setups
• Post-compression expansion
• Structure breaks
• Swing-trade context
• Daily and 4H analysis
It is less suitable for:
• Illiquid symbols
• Very new tickers with limited history
• Low-volume penny stocks
• Earnings gaps
• Binary news events
• Extremely short scalping timeframes
• Markets with sudden one-off catalysts
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Important notes
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
This is an analog projection tool, not a standalone buy/sell system.
Historical similarity does not guarantee future behavior. Market structure, liquidity, volatility, news, and macro conditions can change quickly. The fan should be used as a decision-support layer, not as a guaranteed forecast.
The strongest readings occur when the median, white analog path, agreement, confidence, and regime state all point in the same direction.
The weakest readings occur when analogs are scattered, confidence is low, dispersion is high, or the script identifies a no-edge environment.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Summary
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Event Horizon turns historical market behavior into a forward analog projection fan.
It helps traders see:
• What similar past setups did next
• Whether those analogs agree or disagree
• Whether the current regime supports the projection
• Whether the projected path is tight or scattered
• Whether the setup has enough confidence to matter
Use it to add historical context, probability awareness, and regime-based discipline to your chart analysis.
What has price tended to do after market conditions similar to the current one?
Instead of using a fixed crossover, oscillator threshold, or trend flip, this indicator builds a market fingerprint from the current chart, searches historical bars for similar conditions, and projects how those past analogs moved forward. The result is a visual forward fan showing possible path behavior, consensus direction, dispersion, confidence, and the closest historical analog path.
The goal is not to predict the future with certainty. The goal is to give traders a structured way to compare the current setup against similar historical environments and quickly see whether the analogs are aligned, scattered, bullish, bearish, or not useful.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
What makes this script different
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Most projection tools draw a channel, regression, moving average extension, or volatility cone from a fixed formula.
Event Horizon uses a historical analog engine. Each bar is converted into a multi-factor feature profile, then compared against prior market states using weighted Euclidean similarity. The closest historical analogs are used to create a forward projection fan.
The script combines:
• Historical analog matching
• Weighted Euclidean distance
• Regime-aware scoring
• Volatility and trend-state filtering
• Consensus projection logic
• Closest historical path overlay
• Agreement and confidence scoring
• Directional historical event dots
• A visual fan that shows uncertainty instead of one hard prediction
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
How it works
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1. Market fingerprint
The script measures the current market using multiple dimensions, including:
• Recent price movement
• Trend slope
• ATR expansion and compression
• Candle range and body behavior
• Wick imbalance
• Position relative to recent structure
• Breakout distance
• Volume ratio and volume trend
• ATR percentile
• ADX / trend strength
• Historical shape samples
This creates a multi-dimensional profile of the current setup.
2. Historical analog search
The current profile is compared to historical profiles on the same chart. Similarity is calculated with weighted Euclidean distance, so higher-value features such as trend, volatility regime, and price-shape behavior can matter more than smaller candle details.
Closer historical examples receive stronger match scores.
3. Regime awareness
The script also classifies the current environment into regimes such as trend, compression, volatility expansion, volume shock, or range/chop. Historical examples from incompatible regimes are penalized, helping reduce weak comparisons.
4. Forward projection
Once the best analogs are selected, the script looks at what actually happened after those historical setups. Those forward moves are normalized and projected from the current anchor point.
5. Consensus and confidence
The indicator summarizes the analog group with:
• Directional bias
• Agreement percentage
• Dispersion
• Confidence score
• Edge state: TRADEABLE, CAUTION, or NO EDGE
• Historical self-test statistics
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
How to read the fan
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
The colored fan shows the projected analog field.
The colored median shows the consensus path of the analog set.
The white line shows the closest visible historical analog path. It is not a guaranteed target. It is the path taken by the most similar past setup selected by the engine.
The wider the fan, the more disagreement there is between analogs.
The tighter the fan, the more historically aligned the analogs are.
The confidence and edge label are important. A bullish-looking fan with low confidence or high dispersion should be treated differently than a bullish fan with strong agreement and cleaner regime structure.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Historical dots
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Historical event dots help visually review where prior projection events occurred.
• Bullish projection dots appear below price
• Bearish projection dots appear above price
• Mixed or neutral readings are visually separated
This makes it easier to inspect whether the indicator has been identifying useful directional conditions on the current symbol and timeframe.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
How to use it
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
For newer traders:
1. Start on the Daily or 4H chart.
2. Look at the colored median.
3. Check whether the white analog path agrees with the median.
4. Check confidence and agreement.
5. Avoid forcing trades when the label says NO EDGE or when dispersion is high.
A stronger bullish read usually has:
• Median path rising
• White analog path also rising
• Agreement above roughly 65%
• Confidence above roughly 70
• Low or medium dispersion
• Edge state showing TRADEABLE or CAUTION, not NO EDGE
A weaker or avoidable read usually has:
• Median and white path disagreeing
• Agreement near 50%
• High dispersion
• Low confidence
• Range/chop regime
• NO EDGE label
For experienced traders:
Use the fan as an analog-based context layer. It is most useful when combined with your own structure, liquidity, trend, support/resistance, volume, or macro view. The script is designed to show whether historical analog behavior supports or conflicts with the trade idea you already see on the chart.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Suggested settings
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Balanced stocks / ETFs:
• Mode: Current Bar Projection
• Visual Mode: Cinematic
• Fan Style: Hybrid Swarm + Contours
• Horizon: 30
• Memory Lookback: 1800
• Max Analogs: 30
• Minimum Analogs: 6
• Pre-Event Window: 20
• Shape Samples: 6
• Path Scale: 1.0
Crypto:
• Horizon: 24
• Memory Lookback: 2000 to 2500
• Path Scale: 0.75 to 0.90
• Flexible direction matching
Intraday:
• Horizon: 20 to 24
• Minimum Analogs: 8
• Path Scale: 0.75 to 1.0
• Use liquid symbols only
Trend continuation:
• Direction Matching: Strict
• Mirror Opposite Direction: Off
• Path Scale: 1.0
Reversal / exhaustion:
• Direction Matching: Flexible
• Mirror Opposite Direction: On
• Path Scale: 0.75
• Shorter horizon preferred
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Best use cases
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Event Horizon is best suited for:
• Liquid stocks
• Major ETFs
• Index products
• Major crypto pairs
• Trend continuation setups
• Post-compression expansion
• Structure breaks
• Swing-trade context
• Daily and 4H analysis
It is less suitable for:
• Illiquid symbols
• Very new tickers with limited history
• Low-volume penny stocks
• Earnings gaps
• Binary news events
• Extremely short scalping timeframes
• Markets with sudden one-off catalysts
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Important notes
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
This is an analog projection tool, not a standalone buy/sell system.
Historical similarity does not guarantee future behavior. Market structure, liquidity, volatility, news, and macro conditions can change quickly. The fan should be used as a decision-support layer, not as a guaranteed forecast.
The strongest readings occur when the median, white analog path, agreement, confidence, and regime state all point in the same direction.
The weakest readings occur when analogs are scattered, confidence is low, dispersion is high, or the script identifies a no-edge environment.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Summary
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Event Horizon turns historical market behavior into a forward analog projection fan.
It helps traders see:
• What similar past setups did next
• Whether those analogs agree or disagree
• Whether the current regime supports the projection
• Whether the projected path is tight or scattered
• Whether the setup has enough confidence to matter
Use it to add historical context, probability awareness, and regime-based discipline to your chart analysis.
نص برمجي مفتوح المصدر
بروح TradingView الحقيقية، قام مبتكر هذا النص البرمجي بجعله مفتوح المصدر، بحيث يمكن للمتداولين مراجعة وظائفه والتحقق منها. شكرا للمؤلف! بينما يمكنك استخدامه مجانًا، تذكر أن إعادة نشر الكود يخضع لقواعد الموقع الخاصة بنا.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.
نص برمجي مفتوح المصدر
بروح TradingView الحقيقية، قام مبتكر هذا النص البرمجي بجعله مفتوح المصدر، بحيث يمكن للمتداولين مراجعة وظائفه والتحقق منها. شكرا للمؤلف! بينما يمكنك استخدامه مجانًا، تذكر أن إعادة نشر الكود يخضع لقواعد الموقع الخاصة بنا.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.