firos_meethal

Difference from Highest Price (Last N Candles)

The output of this TradingView indicator is a label that appears below the latest candle on the chart. This label provides information about:

The highest high of the last N candles.
The highest close of the last N candles.
The current trading price.
The percentage difference between the highest high and the current trading price.
The percentage difference between the highest close and the current trading price.
The percentage change in price from the previous candle.
The N-day average percentage change.
This information is useful for traders to understand the relationship between the current price and recent price action, as well as to identify potential overbought or oversold conditions based on the comparison with recent highs and closes.

Here's a breakdown of what the code does:

It takes an input parameter for the number of days (or candles) to consider (input_days).
It calculates the highest high and highest close of the last N candles (highest_last_n_high and highest_last_n_close).
It calculates the difference between the close of the current candle and the close of the previous candle (diff), along with the percentage change.
It maintains an array of percentage changes of the last N days (percentage_changes), updating it with the latest percentage change.
It calculates the sum of percentage changes and the N-day average percentage change.
It calculates the difference between the highest high/highest close of the last N candles and the current trading price, along with their percentage differences.
Finally, it plots this information as a label below the candle for the latest bar.

Script open-source

Dans le véritable esprit de 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 le règlement. Vous pouvez le mettre en favori pour l'utiliser sur un graphique.

Clause de non-responsabilité

Les informations et les publications ne sont pas destinées à être, et ne constituent pas, des conseils ou des recommandations en matière de finance, d'investissement, de trading ou d'autres types de conseils fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.

Vous voulez utiliser ce script sur un graphique ?