The Hyperbolic Tangent Volatility Stop (HTVS) is an advanced technical analysis tool that combines the smoothing capabilities of the Hyperbolic Tangent Moving Average (HTMA) with a volatility-based stop mechanism. This indicator is designed to identify trends and reversals while accounting for market volatility.
Hyperbolic Tangent Moving Average (HTMA):
The HTMA is at the heart of the HTVS. This custom moving average uses a hyperbolic tangent transformation to smooth out price fluctuations, focusing on significant trends while ignoring minor noise. The transformation reduces the sensitivity to sharp price movements, providing a clearer view of the underlying market direction.
The hyperbolic tangent function (tanh) is commonly used in mathematical fields like calculus, machine learning and signal processing due to its properties of “squashing” inputs into a range between -1 and 1. The function provides a non-linear transformation that can reduce the impact of extreme values while retaining a certain level of smoothness.
The HTMA is calculated by applying a non-linear transformation to the difference between the source price and its simple moving average, then adjusting it using the standard deviation of the price data. The result is a moving average that better tracks the real market direction.
Important Note: The Hyperbolic Tangent function becomes less accurate with very high prices. For assets priced above 100,000, the results may deteriorate, and for prices exceeding 1 million, the function may stop functioning properly. Therefore, this indicator is better suited for assets with lower prices or lower price ratios.
Volatility Stop (VolStop):
HTVS employs a Volatility Stop mechanism based on the Average True Range (ATR). This stop dynamically adjusts based on market volatility, ensuring that the indicator adapts to changing conditions and avoids false signals in choppy markets.
The VolStop follows the price, with a higher ATR pushing the stop farther away to avoid premature exits during volatile periods. Conversely, when volatility is low, the stop tightens to lock in profits as the trend progresses.
The ATR Length and ATR Multiplier are customizable, allowing traders to control how tightly or loosely the stop follows the price.
HTVS includes a built-in backtest mode, allowing traders to evaluate the indicator's performance on historical data. In backtest mode, it calculates the cumulative equity curve and compares it to a simple buy and hold strategy.
Backtesting features can be adjusted to focus on specific signal types, such as Long Only, Short Only, or Long & Short.
An optional Buy and Hold Equity plot provides insight into how the indicator performs relative to simply holding the asset over time.
The indicator includes a Hints Table, which provides useful recommendations on how to best display the indicator for different use cases. For example, when using the overlay mode, it suggests displaying the indicator in the same pane as price action, while backtest mode is recommended to be used in a separate pane for better clarity.
The Hyperbolic Tangent Volatility Stop offers traders a balanced approach to trend-following, using the robustness of the HTMA for smoothing and the adaptability of the Volatility Stop to avoid whipsaw trades during volatile periods. With its backtesting features and alert system, this indicator provides a comprehensive toolkit for active traders.
진정한 TradingView 정신에 따라, 이 스크립트의 저자는 트레이더들이 이해하고 검증할 수 있도록 오픈 소스로 공개했습니다. 저자에게 박수를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 출판물에서 이 코드를 재사용하는 것은 하우스 룰에 의해 관리됩니다. 님은 즐겨찾기로 이 스크립트를 차트에서 쓸 수 있습니다.