OPEN-SOURCE SCRIPT
Aktualisiert Consecutive Candle Probability by YCGH Capital

Overview
The Consecutive Candle Probability indicator is designed to analyze how often price forms continuous streaks of bullish or bearish candles over a selected lookback period. It scans historical data to identify exact sequences of consecutive green or red candles and calculates their occurrence frequency as a percentage of all detected streak events. The output is presented in a structured table, allowing traders to quickly understand the behavioral tendencies of an asset, whether it favors continuation or frequent reversals.
Concept and Logic
The core logic of the indicator is based on identifying “exact streaks,” meaning a sequence of candles that is strictly bounded on both sides. A bullish streak is counted only if a defined number of consecutive green candles occurs, and the candles immediately before and after the sequence are not green. The same logic applies to bearish streaks. This ensures that longer streaks are not double-counted as smaller ones and that each event represents a clean and independent occurrence in the dataset.
Probability Calculation
For each streak length within the selected range, the indicator counts how many times bullish and bearish streaks occur and then normalizes these counts against the total number of all detected streak events. The result is expressed as a percentage, providing a relative probability distribution rather than raw counts. This allows traders to compare different streak lengths and quickly identify which patterns are statistically more common in the chosen market and timeframe.
Current Market Context
In addition to historical probabilities, the indicator tracks the current live streak on the chart. It determines whether the market is currently in a bullish or bearish sequence and highlights the corresponding row in the table. This contextual layer helps traders immediately relate real-time price action to historical tendencies, offering a perspective on whether the current streak is typical or extended relative to past behavior.
Table Structure and Visualization
The output is displayed in a dynamically generated table that adapts based on user preferences. It includes columns for bullish probability, bearish probability, combined probability, and raw counts of occurrences. The layout is designed to be clean and readable, with alternating row backgrounds and theme-aware colors to ensure clarity in both light and dark chart environments. The table also includes a title section summarizing the lookback period and total number of streak events analyzed.
Customization Options
The indicator provides several configurable inputs to tailor the analysis to different trading styles. Users can select the lookback period to control how much historical data is analyzed, define the maximum streak length to focus on shorter or longer sequences, and toggle the visibility of bullish, bearish, or combined probability columns. Additional options allow adjustment of the table position and text size, ensuring compatibility with different chart layouts and personal preferences.
Use Cases in Trading
This indicator is particularly useful for understanding market structure and behavioral tendencies. Traders can use it to assess whether an asset tends to trend in extended runs or revert quickly after short moves. It can support decision-making in strategies such as momentum trading, mean reversion, or scalping by providing statistical context to streak-based setups. While it does not generate direct buy or sell signals, it acts as a probabilistic tool to improve confidence and filtering in existing trading systems.
Limitations and Considerations
The probabilities produced by the indicator are entirely based on historical data and do not guarantee future outcomes. Market conditions can change over time, and patterns that were previously common may lose relevance. The results are also sensitive to the selected timeframe and lookback window, which means traders should test different configurations to understand how the behavior varies across conditions. This tool should be used as a supplementary layer of analysis rather than a standalone decision-making system.
The Consecutive Candle Probability indicator is designed to analyze how often price forms continuous streaks of bullish or bearish candles over a selected lookback period. It scans historical data to identify exact sequences of consecutive green or red candles and calculates their occurrence frequency as a percentage of all detected streak events. The output is presented in a structured table, allowing traders to quickly understand the behavioral tendencies of an asset, whether it favors continuation or frequent reversals.
Concept and Logic
The core logic of the indicator is based on identifying “exact streaks,” meaning a sequence of candles that is strictly bounded on both sides. A bullish streak is counted only if a defined number of consecutive green candles occurs, and the candles immediately before and after the sequence are not green. The same logic applies to bearish streaks. This ensures that longer streaks are not double-counted as smaller ones and that each event represents a clean and independent occurrence in the dataset.
Probability Calculation
For each streak length within the selected range, the indicator counts how many times bullish and bearish streaks occur and then normalizes these counts against the total number of all detected streak events. The result is expressed as a percentage, providing a relative probability distribution rather than raw counts. This allows traders to compare different streak lengths and quickly identify which patterns are statistically more common in the chosen market and timeframe.
Current Market Context
In addition to historical probabilities, the indicator tracks the current live streak on the chart. It determines whether the market is currently in a bullish or bearish sequence and highlights the corresponding row in the table. This contextual layer helps traders immediately relate real-time price action to historical tendencies, offering a perspective on whether the current streak is typical or extended relative to past behavior.
Table Structure and Visualization
The output is displayed in a dynamically generated table that adapts based on user preferences. It includes columns for bullish probability, bearish probability, combined probability, and raw counts of occurrences. The layout is designed to be clean and readable, with alternating row backgrounds and theme-aware colors to ensure clarity in both light and dark chart environments. The table also includes a title section summarizing the lookback period and total number of streak events analyzed.
Customization Options
The indicator provides several configurable inputs to tailor the analysis to different trading styles. Users can select the lookback period to control how much historical data is analyzed, define the maximum streak length to focus on shorter or longer sequences, and toggle the visibility of bullish, bearish, or combined probability columns. Additional options allow adjustment of the table position and text size, ensuring compatibility with different chart layouts and personal preferences.
Use Cases in Trading
This indicator is particularly useful for understanding market structure and behavioral tendencies. Traders can use it to assess whether an asset tends to trend in extended runs or revert quickly after short moves. It can support decision-making in strategies such as momentum trading, mean reversion, or scalping by providing statistical context to streak-based setups. While it does not generate direct buy or sell signals, it acts as a probabilistic tool to improve confidence and filtering in existing trading systems.
Limitations and Considerations
The probabilities produced by the indicator are entirely based on historical data and do not guarantee future outcomes. Market conditions can change over time, and patterns that were previously common may lose relevance. The results are also sensitive to the selected timeframe and lookback window, which means traders should test different configurations to understand how the behavior varies across conditions. This tool should be used as a supplementary layer of analysis rather than a standalone decision-making system.
Versionshinweise
logic updatedOpen-source Skript
Ganz im Sinne von TradingView hat dieser Autor sein/ihr Script als Open-Source veröffentlicht. Auf diese Weise können nun auch andere Trader das Script rezensieren und die Funktionalität überprüfen. Vielen Dank an den Autor! Sie können das Script kostenlos verwenden, aber eine Wiederveröffentlichung des Codes unterliegt unseren Hausregeln.
For Daily LIVE Trades
Join FREE Telegram:t.me/+xavhcozoJexhZTVl
Join FREE Telegram:t.me/+xavhcozoJexhZTVl
Haftungsausschluss
Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.
Open-source Skript
Ganz im Sinne von TradingView hat dieser Autor sein/ihr Script als Open-Source veröffentlicht. Auf diese Weise können nun auch andere Trader das Script rezensieren und die Funktionalität überprüfen. Vielen Dank an den Autor! Sie können das Script kostenlos verwenden, aber eine Wiederveröffentlichung des Codes unterliegt unseren Hausregeln.
For Daily LIVE Trades
Join FREE Telegram:t.me/+xavhcozoJexhZTVl
Join FREE Telegram:t.me/+xavhcozoJexhZTVl
Haftungsausschluss
Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.