OPEN-SOURCE SCRIPT

Average Up and Down Candles Streak with Predicted Next Candle

This indicator is designed to analyze price trends by examining the patterns of up and down streaks (consecutive bullish or bearish candles) over a defined period. It uses this data to provide insights on whether the next candle is likely to be bullish or bearish, and it visually displays relevant information on the chart.

Here’s a breakdown of what the indicator does:

1. Inputs and Parameters
Period (Candles): Defines the number of candles used to calculate the average length of bullish and bearish streaks. For example, if the period is set to 20, the indicator will analyze the past 20 candles to determine average up and down streak lengths.
Bullish/Bearish Bias Signal Toggle: These options allow users to show or hide visual signals (green or red circles) when there’s a bullish or bearish bias in the trend based on the indicator’s calculations.

2. Streak Calculation
The indicator looks at each candle within the period to identify if it closed up (bullish) or down (bearish).
Up Streak: The indicator counts consecutive bullish candles. When there’s a bearish candle, it resets the up streak count.
Down Streak: Similarly, it counts consecutive bearish candles and resets when a bullish candle appears.
Averages: Over the defined period, the indicator calculates the average length of up streaks and average length of down streaks. This provides a baseline to assess whether the current streak is typical or extended.

3. Current and Average Streak Display

The indicator displays the current up and down streak lengths alongside the average streak lengths for comparison. This data appears in a table on the chart, allowing you to see at a glance:
The current streak length (for both up and down trends)
The average streak length for up and down trends over the chosen period

4. Trend Prediction for the Next Candle

Next Candle Prediction: Based on the current streak and its comparison to the average, the indicator predicts the likely direction of the next candle:
Bullish: If the current up streak is shorter than the average up streak, suggesting that the bullish trend could continue.
Bearish: If the current down streak is shorter than the average down streak, indicating that the bearish trend may continue.
Neutral: If the current streak length is near the average, which could signal an upcoming reversal.
This prediction appears in a table on the chart, labeled as “Next Candle.”

5. Previous Candle Analysis
The Previous Candle entry in the table reflects the last completed candle (directly before the current candle) to show whether it was bullish, bearish, or neutral.
This data gives a reference point for recent price action and helps validate the next candle prediction.

6. Visual Signals and Reversal Zones
Bullish/Bearish Bias Signals: The indicator can plot green circles on bullish bias and red circles on bearish bias to highlight points where the trend is likely to continue.
Reversal Zones: If the current streak length reaches or exceeds the average, it suggests the trend may be overextended, indicating a potential reversal zone. The indicator highlights these zones with shaded backgrounds (green for possible bullish reversal, red for bearish) on the chart.

Summary of What You See on the Chart
Bullish and Bearish Bias Signals: Green or red circles mark areas of expected continuation in the trend.
Reversal Zones: Shaded areas in red or green suggest that the trend might be about to reverse.

Tables:
The Next Candle prediction table displays the trend direction of the previous candle and the likely trend of the next candle.
The Streak Information table shows the current up and down streak lengths, along with their averages for easy comparison.

Practical Use
This indicator is helpful for traders aiming to understand trend momentum and potential reversals based on historical patterns. It’s particularly useful for swing trading, where knowing the typical length of bullish or bearish trends can help in timing entries and exits.
Candlestick analysisChart patternsCyclesdailybias

Script de código aberto

No verdadeiro espírito do TradingView, o autor desse script o publicou como código aberto, para que os traders possam compreendê-lo e analisá-lo. Parabéns ao autor! Você pode usá-lo gratuitamente, mas a reutilização desse código em publicações é regida pelas Regras da Casa. Você pode favoritá-lo para usá-lo em um gráfico.

Quer usar esse script no gráfico?

Aviso legal