We use 2 separate arrays, one for all positive values and one for all negative values within a defined lookback period. Then the current value is compared to those arrays to find it's percentile ranking.
For example, a ranking of 75 means the is in the 75th percentile of all POSITIVE values over the lookback period.
A ranking of -80 is in the 80th percentile of all NEGATIVE values over the lookback period.
Most scripts use raw values (or smoothed or otherwise altered), or have formula applied to them, I've not seen one that displays as percentile ranking of previous positive/negative values.
What is the advantage?
Raw data only gives half the picture. What we want to do is compare the to previous values, to give a sense of scale. Raw values don't give you that context and you can only compare visually, usually limited to the number of bars you can see on your screen.
Using a percentile ranking gives us the context of current relative to the previous over a large lookback period, and not just visually but mathematically.
Why not using a long ROC? The problem with stochastics in general is that an outlier data point can ruin the data for the rest of the lookback period.
For example, imagine a huge outlier 8% . The 2nd largest is 4% and the 3rd largest is 2%, with all other values below this.
In this example, a would display the 8% outlier as 100, the 4% as 50, the 2% as 25 and all other data would be squeezed down between 0-25.
Additionally, a value of 60 may have vastly different meaning depending on whether the lookback period contains a large outlier or not.
With a percentile ranking, that 8% outlier would still have a value of 100. But the 4% and 2% would be 99 and 98 respectively (this assumes 100 data points in the series, in reality values will usually be decimals).
This effectively flattens the curve and gives a more consistent and dependable experience, allowing you to more accurately assess the relative importance of the current .
The line of circles is set at the 50 and -50 values for quick comparison.
Values > 50 represent greater than 50% of previous positive values.
Values < -50 represent greater than 50% of previous negative values.
*** LIKE and FOLLOW if you enjoy the content! ***
Please leave any questions or comments below and I will respond!
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.
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.