OPEN-SOURCE SCRIPT

Previous Candle Sweep Indicator

Mis à jour
This script identifies candlesticks where the current candle's high is higher than the previous candle's high, and the current candle's low is lower than the previous candle's low. If both conditions are met, the candle's body is highlighted in blue on the chart, allowing traders to quickly spot these patterns.

Features:

Highlights candles with both higher highs and lower lows.
Uses clear visual cues (blue body) for easy identification.
Ideal for traders looking to identify specific volatility patterns or reversals.
Notes de version
Customizable Parameters:

Show Percentage (show_percentage): This option allows you to toggle the visibility of the percentage. If set to true, the percentage change will be displayed on the chart; if false, it will not be shown.
Percentage Position (position): This option allows you to select where the percentage will be displayed on the candle. The available options are:
Above: The percentage will be placed above the candle.
Middle: The percentage will be placed in the middle of the candle (between the high and low).
Below: The percentage will be placed below the candle.
Percentage Color (label_color): This option lets you change the text color of the percentage. You can choose any color.
Font Size (label_size): This option allows you to adjust the font size. Available sizes are:
Small: Small text size.
Normal: Standard text size.
Large: Large text size.
Higher Highs and Lower Lows Condition:

The condition that is evaluated is whether the current candle's high is higher than the previous candle's high and the current candle's low is lower than the previous candle's low. This is defined in the variable higher_highs_lows.
If both conditions are true (higher high and lower low), the script proceeds to calculate the percentage and display it.
Percentage Change Calculation:

The difference between the current candle's range and the previous candle's range is calculated:
range_current: The range of the current candle (the difference between the high and low of the candle).
range_previous: The range of the previous candle (the difference between the high and low of the previous candle).
The percentage change between these two ranges is calculated using the formula:
percentage_change = (range_current / range_previous - 1) * 100.
This value is what will be displayed on the chart.
Bar Color Change:

If the higher_highs_lows condition is true, the bar color is changed to blue using barcolor(color.blue). If the condition is not met, no specific color is applied.
Displaying the Percentage:

If the condition is true and the show_percentage option is enabled, the percentage is displayed on the chart:
y_position: Defines the vertical position of the percentage label based on the user selection ("Above", "Middle", or "Below").
label.new: Creates a new label with the percentage text, using the custom settings for font size, color, and text alignment.
x=bar_index: The horizontal position of the label, corresponding to the index of the current bar on the chart.
y=y_position: The vertical position of the label, determined by the chosen position (above, middle, or below the candle).
text: The text to display, which is the percentage calculated with two decimal points.
textcolor: The color of the text, as defined by the user.
size: The font size, which can be small, normal, or large depending on the configuration.
textalign: Text alignment (centered).
Summary of Options:
Show or hide the percentage: The user can choose whether or not to see the percentage change between the current candle's range and the previous candle's range.
Position of the percentage: The percentage can be displayed above, in the middle, or below the candle.
Customization of color and size: The user can adjust the color and size of the percentage text.
This indicator is useful for quickly visualizing how the range of a candle changes compared to the previous one, helping to identify significant market moves.
regressionsVolatilityVolume

Script open-source

Dans le plus pur esprit TradingView, l'auteur de ce script l'a publié en open-source, afin que les traders puissent le comprendre et le vérifier. Bravo à l'auteur! Vous pouvez l'utiliser gratuitement, mais la réutilisation de ce code dans une publication est régie par nos Règles. Vous pouvez le mettre en favori pour l'utiliser sur un graphique.

Vous voulez utiliser ce script sur un graphique ?

Clause de non-responsabilité