PROTECTED SOURCE SCRIPT

PRICE STREAK [DIGGERDOG]

PRICE STREAK [DIGGERDOG]

This Pine Script, titled **"PRICE STREAK [DIGGERDOG]"**, tracks the number of consecutive up or down price closes and visualizes the result in a histogram-style plot. It provides a visual representation of price momentum by counting the number of consecutive days where the closing price is either higher or lower than the previous day. The histogram changes color depending on whether the streak is upward (green) or downward (red).

Key Features:

1. **Upcount and Dncount Calculation:**
- **Upcount** is incremented each time the current close is higher than the previous close. It resets when the close price decreases.
- **Dncount** is incremented each time the current close is lower than the previous close. It resets when the close price increases.
- The script does not differentiate between upward and downward streak lengths in terms of plotting; it combines them in one cumulative count.

2. **Plot with Color-Coded Streaks:**
- The script plots the sum of **Upcount** and **Dncount** as a histogram, where:
- **Green bars** represent upward price streaks (the price is closing higher).
- **Red bars** represent downward price streaks (the price is closing lower).

3. **Threshold Line:**
- A horizontal line is plotted at a value of **2** as a visual threshold to help identify periods where streaks exceed this value. This can be adjusted as needed to indicate different threshold levels for streak significance.

How It Works:

1. **Price Streak Logic:**
- For each bar, the script compares the closing price to the previous bar's closing price:
- If the current close is greater than the previous close, the **Upcount** is incremented, and **Dncount** is reset.
- If the current close is less than the previous close, the **Dncount** is incremented, and **Upcount** is reset.
- The cumulative count of these streaks is plotted.

2. **Color-Coded Histogram:**
- The histogram uses a dynamic color based on whether the streak is upward or downward:
- **Green** for upward streaks.
- **Red** for downward streaks.

Visualization:
- The histogram will help you easily spot whether there has been a significant price streak, whether upward or downward, and how long the streaks last.
- The threshold line helps in identifying when the streaks are significant by providing a reference point (e.g., streaks greater than 2).

Customizations:
- **Threshold**: You can adjust the value of the horizontal line (`hline(2)`) to any number that suits your strategy.
- **Colors**: The green and red colors can be changed to your preference for visual clarity.

Use Case:
This script is ideal for traders who want to track the **momentum** in price movements. If a stock has several consecutive up days or down days, it may indicate **strong momentum** or **trend exhaustion**, depending on the length of the streak. This indicator can help identify potential trend continuation or reversal points.

If you need additional customizations or have any questions, feel free to ask!
Momentum Indicator (MOM)

Skrip terproteksi

Skrip ini dipublikasikan secara closed-source dan anda dapat menggunakannya dengan bebas. Anda dapat memfavoritkannya untuk digunakan pada grafik. Anda tidak dapat melihat atau mengubah kode sumbernya.

Inggin menggunakan skrip ini pada chart?

Pernyataan Penyangkalan