Relative Risk Metric

The Relative Risk Metric is designed to provide a relative measure of an asset's price, within a specified range, over a log scale.
PURPOSE
- Relative Position Assessment: Visualizes where the current price stands within a user-defined range, adjusted for log scale.
- Logarithmic Transformation: Utilizes the natural log to account for a log scale of prices, offering a more accurate representation of relative positions.
- Calculation: The indicator calculates a normalized value via the function Relative Price = [log(CurrentPrice) − log(LowerBound)] / log(UpperBound) − log(LowerBound). The result is a value between 0 and 1, where 0 corresponds to the lower bound and 1 corresponds to the upper bound on a log scale.
VISUALIZATION
The indicator plots three series:
- Risk Metric - a plot of the risk metric value that’s computed from an asset's relative price so that it lies within a logarithmic range between 0.0 & 1.0.
- Smoothed Risk Metric - a plot of the risk metric that’s been smoothed.
- Entry/Exit - a scatter plot for identified entry and exit. Values are expressed as percent and are coded as red being exit and green being entity. E.g., a red dot at 0.02 implies exit 2% of the held asset. A green dot at 0.01 implies use 1% of a designated capital reserve.
USAGE
Risk Metric
The risk metric transformation function has several parameters. These control aspects such as decay, sensitivity, bounds and time offset.
- Decay - Acts as an exponent multiplier and controls how quickly dynamic bounds change as a function of the bar_index.
- Time Offset - provides a centering effect of the exponential transformation relative to the current bar_index.
- Sensitivity - controls how sensitive to time the dynamic bound adjustments should be.
- Baseline control - Serves as an additive offset for dynamic bounds computation which ensures that bounds never become too small or negative.
- UpperBound - provides headroom to accomodate growth an assets price from the baseline. For example, an upperbound of 3.5 accommodates a 3.5x growth from the baseline value (e.g., $100 -> $350).
- LowerBound - provides log scale compression such that the overall metric provides meaningful insights for prices well below the average whilst avoiding extreme scaling. A lowerbound of 0.25 corresponds to a price that is approx one quarter of a normalised baseline in a log context.
Weighted Entry/Exit
This feature provides a weighted system for identifying DCA entry and exit. This weighting mechanism adjusts the metric's interpretation to highlight conditions based on dynamic thresholds and user-defined parameters to identify high-probability zones for entry/exit actions and provide risk-adjusted insights.
Weighting Parameters
The weighting function supports fine-tuning of the computed weighted entry/exit values
- Base: determines the foundational multiplier for weighting the entry/exit value. A higher base amplifies the weighting effect, making the weighted values more pronounced. It acts as a scaling factor to control the overall magnitude of the weighting.
- Exponent: adjusts the curve of the weighting function. Higher exponent values increase sensitivity, emphasizing differences between risk metric values near the entry or exit thresholds. This creates a steeper gradient for the computed entry/exit value making it more responsive to subtle shifts in risk levels.
- Cut Off: specifies the maximum percentage (expressed as a fraction of 1.0) that the weighted entry/exit value can reach. This cap ensures the metric remains within a meaningful range and avoids skewing
- Exit condition: Defines a threshold for exit. When the risk metric is below the exit threshold (but above the entry threshold) then entry/exit is neutral.
- Entry condition: Defines a threshold for entry. When the risk metric is above the entry threshold (but below the exit threshold) then entry/exit is neutral.
Weighting Behaviour
- For entry conditions - value is more heavily weighted as the metric approaches the entry threshold, emphasizing lower risk levels.
- For exit conditions - value is more heavily weighted as the metric nears the exit threshold, emphasizing increased risk levels.
USE-CASES
- Identifying potential overbought or oversold conditions within the specified logarithmic range.
- Assisting in assessing how the current price compares to historical price levels on a logarithmic scale.
- Guiding decision-making processes by providing insights into the relative positioning of prices within a log context
CONSIDERATIONS
- Validation: It's recommended that backtesting over historical data be done before acting on any identified entry/exit values.
- User Discretion: This indicator focus on price risk. Consider other risk factors and general market conditions as well.
Script open-source
In pieno spirito TradingView, il creatore di questo script lo ha reso open-source, in modo che i trader possano esaminarlo e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricorda che la ripubblicazione del codice è soggetta al nostro Regolamento.
Per un accesso rapido a un grafico, aggiungi questo script ai tuoi preferiti: per saperne di più clicca qui.
Declinazione di responsabilità
Script open-source
In pieno spirito TradingView, il creatore di questo script lo ha reso open-source, in modo che i trader possano esaminarlo e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricorda che la ripubblicazione del codice è soggetta al nostro Regolamento.
Per un accesso rapido a un grafico, aggiungi questo script ai tuoi preferiti: per saperne di più clicca qui.