mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-17 10:08:05 +00:00
Merge branch 'dev'
This commit is contained in:
@@ -13,9 +13,7 @@
|
||||
| **PineScript** | [adr.pine](adr.pine) |
|
||||
|
||||
- The Average Daily Range (ADR) measures the average distance between High and Low prices over a specified period.
|
||||
- Parameterized by `period`, `method` (default adrmethod.sma).
|
||||
- Output range: $\geq 0$.
|
||||
- Requires `ma.WarmupPeriod` bars of warmup before first valid output (IsHot = true).
|
||||
- **Similar:** [ATR](../atr/atr.md) | **Complementary:** Session range targets | **Trading note:** Average Daily Range; intraday range expectation.
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
The Average Daily Range (ADR) measures the average distance between High and Low prices over a specified period. Unlike its cousin ATR, ADR ignores gaps entirely. It answers a straightforward question: "How much does this asset typically move within a single bar?"
|
||||
@@ -148,4 +146,4 @@ O(1) sliding mean of daily ranges. Same running-sum pattern as SMA but applied t
|
||||
- **Confusing ADR with ATR**: They measure different things. ADR ignores gaps; ATR accounts for them. Know which you need.
|
||||
- **Wrong smoothing method**: SMA is stable but can jump when old values exit the window. EMA is smoother for trending volatility. Match the method to your use case.
|
||||
- **Scale dependence**: Like ATR, ADR is absolute. An ADR of 5 on a \$100 stock is 5% volatility; on a \$10 stock, it's 50% volatility. Normalize if comparing across assets.
|
||||
- **Assuming direction**: High ADR means wide bars, not up or down. Crashes and rallies both produce high ADR.
|
||||
- **Assuming direction**: High ADR means wide bars, not up or down. Crashes and rallies both produce high ADR.
|
||||
@@ -13,9 +13,7 @@
|
||||
| **PineScript** | [atr.pine](atr.pine) |
|
||||
|
||||
- The Average True Range measures market "heat" with complete disregard for direction.
|
||||
- Parameterized by `period`.
|
||||
- Output range: $\geq 0$.
|
||||
- Requires `rma.WarmupPeriod` bars of warmup before first valid output (IsHot = true).
|
||||
- **Similar:** [NATR](../natr/natr.md), [TR](../tr/tr.md) | **Complementary:** SuperTrend, Keltner Channel | **Trading note:** Wilder's ATR; most popular volatility measure. 14-period standard.
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
The Average True Range measures market "heat" with complete disregard for direction. It ignores whether the market is screaming upward or crashing downward. ATR cares only about magnitude. When ATR is high, expect wide swings. When ATR is low, expect narrow consolidation. Most traders mistakenly use ATR to find entries. Its true power lies in exits and position sizing. ATR answers the critical question: "How far can this asset move against me in a single day?"
|
||||
@@ -219,4 +217,4 @@ var atr14 = new Atr(source, 14);
|
||||
|
||||
- Wilder, J. W. (1978). *New Concepts in Technical Trading Systems*. Trend Research. Chapter: Average True Range.
|
||||
- Kaufman, P. (2013). *Trading Systems and Methods*. Wiley. (ATR-based position sizing)
|
||||
- Kase, C. (1996). "Trading with the True Range." *Technical Analysis of Stocks & Commodities*. (TR variations)
|
||||
- Kase, C. (1996). "Trading with the True Range." *Technical Analysis of Stocks & Commodities*. (TR variations)
|
||||
@@ -13,9 +13,7 @@
|
||||
| **PineScript** | [atrn.pine](atrn.pine) |
|
||||
|
||||
- ATRN transforms the absolute ATR into a relative measure by normalizing it to a [0,1] scale using min-max scaling over a lookback window.
|
||||
- Parameterized by `period`.
|
||||
- Output range: $\geq 0$.
|
||||
- Requires 1 bar of warmup before first valid output (IsHot = true).
|
||||
- **Similar:** [ATR](../atr/atr.md), [NATR](../natr/natr.md) | **Complementary:** Position sizing | **Trading note:** Normalized ATR; percentage-based for cross-asset comparison.
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
ATRN transforms the absolute ATR into a relative measure by normalizing it to a [0,1] scale using min-max scaling over a lookback window. This answers the question: "Is current volatility high or low *compared to recent history*?"
|
||||
@@ -151,4 +149,4 @@ ATRN is a QuanTAlib-specific indicator. Validation confirms:
|
||||
|
||||
3. **Regime Detection**: Use ATRN thresholds to switch between mean-reversion (low ATRN) and trend-following (high ATRN) strategies.
|
||||
|
||||
4. **Volatility Breakout**: Look for moves from ATRN < 0.2 to ATRN > 0.5 as potential breakout confirmation.
|
||||
4. **Volatility Breakout**: Look for moves from ATRN < 0.2 to ATRN > 0.5 as potential breakout confirmation.
|
||||
@@ -13,9 +13,7 @@
|
||||
| **PineScript** | [bbw.pine](bbw.pine) |
|
||||
|
||||
- Bollinger Band Width measures the distance between upper and lower Bollinger Bands, normalized by the middle band.
|
||||
- Parameterized by `period`, `multiplier` (default 2.0).
|
||||
- Output range: $\geq 0$.
|
||||
- Requires `period` bars of warmup before first valid output (IsHot = true).
|
||||
- **Similar:** [BBands](../../channels/bbands/bbands.md) | **Complementary:** Squeeze detection | **Trading note:** Bollinger BandWidth; quantifies band expansion/contraction.
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
Bollinger Band Width measures the distance between upper and lower Bollinger Bands, normalized by the middle band. When BBW is low, the bands are squeezing together, signaling compressed volatility and impending breakout. When BBW is high, the market is in an expanded volatility state. BBW transforms Bollinger Bands from a visual channel indicator into a quantifiable volatility oscillator, enabling algorithmic detection of "squeeze" conditions that often precede significant price moves.
|
||||
@@ -223,4 +221,4 @@ var bbw = new Bbw(source, period: 20, multiplier: 2.0);
|
||||
|
||||
- Bollinger, J. (2001). *Bollinger on Bollinger Bands*. McGraw-Hill. (Original Bollinger Band methodology)
|
||||
- Bollinger, J. "Bollinger Band Width." BollingerBands.com. (BBW definition and squeeze strategy)
|
||||
- Connors, L., & Raschke, L. (1995). *Street Smarts*. M. Gordon Publishing. (Squeeze trading strategies)
|
||||
- Connors, L., & Raschke, L. (1995). *Street Smarts*. M. Gordon Publishing. (Squeeze trading strategies)
|
||||
@@ -13,9 +13,7 @@
|
||||
| **PineScript** | [bbwn.pine](bbwn.pine) |
|
||||
|
||||
- Bollinger Band Width Normalized (BBWN) extends the standard BBW by normalizing it to a [0,1] range based on historical minimum and maximum values o...
|
||||
- Parameterized by `period`, `multiplier` (default 2.0), `lookback` (default 252).
|
||||
- Output range: $\geq 0$.
|
||||
- Requires `period + lookback` bars of warmup before first valid output (IsHot = true).
|
||||
- **Similar:** [BBW](../bbw/bbw.md) | **Complementary:** Cross-asset comparison | **Trading note:** Normalized BandWidth for cross-asset comparison.
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
Bollinger Band Width Normalized (BBWN) extends the standard BBW by normalizing it to a [0,1] range based on historical minimum and maximum values over a lookback period. This normalization enables better comparison across different timeframes, instruments, and market conditions, making it easier to identify relative volatility levels consistently.
|
||||
@@ -285,4 +283,4 @@ $$
|
||||
- **CPU Complexity**: O(1) per update, O(lookback) for min/max search
|
||||
- **Batch Processing**: Optimized vectorized calculations available
|
||||
|
||||
BBWN transforms absolute volatility measurements into relative, comparable signals that work consistently across different market conditions and instruments. The normalization provides context that pure BBW cannot offer, making it particularly valuable for systematic trading strategies that need consistent volatility thresholds.
|
||||
BBWN transforms absolute volatility measurements into relative, comparable signals that work consistently across different market conditions and instruments. The normalization provides context that pure BBW cannot offer, making it particularly valuable for systematic trading strategies that need consistent volatility thresholds.
|
||||
@@ -13,9 +13,7 @@
|
||||
| **PineScript** | [bbwp.pine](bbwp.pine) |
|
||||
|
||||
- BBWP (Bollinger Band Width Percentile) measures where the current Bollinger Band Width falls within its historical distribution, expressing the res...
|
||||
- Parameterized by `period`, `multiplier` (default 2.0), `lookback` (default 252).
|
||||
- Output range: $\geq 0$.
|
||||
- Requires `period + lookback` bars of warmup before first valid output (IsHot = true).
|
||||
- **Similar:** [BBW](../bbw/bbw.md) | **Complementary:** Percentile rank | **Trading note:** BandWidth Percentile; ranks current width in historical context.
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
BBWP (Bollinger Band Width Percentile) measures where the current Bollinger Band Width falls within its historical distribution, expressing the result as a percentile rank between 0 and 1. Unlike BBWN which normalizes using min/max values, BBWP uses percentile ranking which is more robust to outliers.
|
||||
@@ -129,4 +127,4 @@ where L = lookback period (default 252)
|
||||
## References
|
||||
|
||||
- Bollinger, J. (2001). "Bollinger on Bollinger Bands." McGraw-Hill.
|
||||
- QuanTAlib PineScript reference implementation (bbwp.pine)
|
||||
- QuanTAlib PineScript reference implementation (bbwp.pine)
|
||||
@@ -13,9 +13,7 @@
|
||||
| **PineScript** | [ccv.pine](ccv.pine) |
|
||||
|
||||
- Close-to-Close Volatility (CCV) calculates the annualized standard deviation of logarithmic returns using only closing prices.
|
||||
- Parameterized by `period`, `method` (default 1).
|
||||
- Output range: $\geq 0$.
|
||||
- Requires `period + 1` bars of warmup before first valid output (IsHot = true).
|
||||
- **Similar:** [HV](../hv/hv.md) | **Complementary:** Close-to-close analysis | **Trading note:** Close-to-Close volatility; simplest vol estimator.
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
Close-to-Close Volatility (CCV) calculates the annualized standard deviation of logarithmic returns using only closing prices. This is the foundational volatility measure in quantitative finance, serving as a benchmark against which more sophisticated estimators are compared. The implementation supports three smoothing methods (SMA, EMA, WMA) and annualizes using the standard √252 factor for daily data.
|
||||
@@ -212,4 +210,4 @@ CCV is a standard volatility measure implemented consistently across platforms:
|
||||
- Black, F., & Scholes, M. (1973). "The Pricing of Options and Corporate Liabilities." *Journal of Political Economy*.
|
||||
- Parkinson, M. (1980). "The Extreme Value Method for Estimating the Variance of the Rate of Return." *Journal of Business*.
|
||||
- Garman, M., & Klass, M. (1980). "On the Estimation of Security Price Volatilities from Historical Data." *Journal of Business*.
|
||||
- Yang, D., & Zhang, Q. (2000). "Drift-Independent Volatility Estimation Based on High, Low, Open, and Close Prices." *Journal of Business*.
|
||||
- Yang, D., & Zhang, Q. (2000). "Drift-Independent Volatility Estimation Based on High, Low, Open, and Close Prices." *Journal of Business*.
|
||||
@@ -13,9 +13,7 @@
|
||||
| **PineScript** | [cv.pine](cv.pine) |
|
||||
|
||||
- Conditional Volatility (CV) implements the GARCH(1,1) model for volatility forecasting, the most widely used time-varying volatility model in finan...
|
||||
- Parameterized by `period` (default 20), `alpha` (default 0.2), `beta` (default 0.7).
|
||||
- Output range: $\geq 0$.
|
||||
- Requires `period + 1` bars of warmup before first valid output (IsHot = true).
|
||||
- **Similar:** [HV](../hv/hv.md) | **Complementary:** Volatility analysis | **Trading note:** Coefficient of Variation; ratio of std dev to mean.
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
Conditional Volatility (CV) implements the GARCH(1,1) model for volatility forecasting, the most widely used time-varying volatility model in financial econometrics. Unlike simple historical volatility measures, GARCH captures two key empirical features of financial returns: volatility clustering (large moves tend to follow large moves) and mean reversion (volatility eventually returns to a long-run average). The output is annualized volatility expressed as a percentage.
|
||||
@@ -213,4 +211,4 @@ CV/GARCH is proprietary with no direct open-source equivalents using the same ap
|
||||
- Engle, R. F. (1982). "Autoregressive Conditional Heteroscedasticity with Estimates of the Variance of United Kingdom Inflation." *Econometrica*, 50(4), 987-1007.
|
||||
- Bollerslev, T. (1986). "Generalized Autoregressive Conditional Heteroskedasticity." *Journal of Econometrics*, 31(3), 307-327.
|
||||
- Engle, R. F. (2001). "GARCH 101: The Use of ARCH/GARCH Models in Applied Econometrics." *Journal of Economic Perspectives*, 15(4), 157-168.
|
||||
- Hansen, P. R., & Lunde, A. (2005). "A Forecast Comparison of Volatility Models: Does Anything Beat a GARCH(1,1)?" *Journal of Applied Econometrics*, 20(7), 873-889.
|
||||
- Hansen, P. R., & Lunde, A. (2005). "A Forecast Comparison of Volatility Models: Does Anything Beat a GARCH(1,1)?" *Journal of Applied Econometrics*, 20(7), 873-889.
|
||||
@@ -13,9 +13,7 @@
|
||||
| **PineScript** | [cvi.pine](cvi.pine) |
|
||||
|
||||
- Chaikin's Volatility (CVI) measures the rate of change of the EMA-smoothed high-low trading range.
|
||||
- Parameterized by `roclength` (default 10), `smoothlength` (default 10).
|
||||
- Output range: $\geq 0$.
|
||||
- Requires 1 bar of warmup before first valid output (IsHot = true).
|
||||
- **Similar:** [ATR](../atr/atr.md) | **Complementary:** BandWidth | **Trading note:** Chaikin Volatility; ROC of high-low EMA range.
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
Chaikin's Volatility (CVI) measures the rate of change of the EMA-smoothed high-low trading range. Unlike traditional volatility measures that focus on returns, CVI directly tracks the expansion and contraction of price ranges over time. A positive CVI indicates expanding volatility (wider trading ranges), while a negative CVI signals contracting volatility (narrower ranges). This makes CVI particularly useful for identifying breakout conditions and market transitions.
|
||||
@@ -244,4 +242,4 @@ Avoid range trades when: CVI rising sharply
|
||||
|
||||
- Chaikin, M. (1966). "Stock Market Trading Systems." Various publications and interviews.
|
||||
- Achelis, S. B. (2000). "Technical Analysis from A to Z." McGraw-Hill. Chapter on Chaikin Volatility.
|
||||
- Murphy, J. J. (1999). "Technical Analysis of the Financial Markets." New York Institute of Finance.
|
||||
- Murphy, J. J. (1999). "Technical Analysis of the Financial Markets." New York Institute of Finance.
|
||||
@@ -13,9 +13,7 @@
|
||||
| **PineScript** | [etherm.pine](etherm.pine) |
|
||||
|
||||
- Elder's Thermometer (ETHERM) measures how far today's price bar protrudes beyond yesterday's range, capturing the maximum outward extension in either direction.
|
||||
- Parameterized by `period` (default 22) for the EMA signal line.
|
||||
- Output range: $\geq 0$ (same units as price).
|
||||
- Requires `period` bars of warmup before first valid output (IsHot = true).
|
||||
- **Similar:** [ATR](../atr/atr.md) | **Complementary:** Trend detection | **Trading note:** Elder Thermometer; measures current bar's range vs previous.
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
Elder's Thermometer (ETHERM) measures bar-to-bar range extension — the maximum outward protrusion of the current bar beyond the previous bar's high or low. Developed by Dr. Alexander Elder, it captures only outward expansions; inward contractions clamp to zero. An EMA signal line with bias compensation provides a smoothed reference for detecting explosive moves (temperature significantly exceeding the signal).
|
||||
@@ -122,4 +120,4 @@ Not beneficial — the recursive EMA dependency prevents vectorization. Each bar
|
||||
## References
|
||||
|
||||
- **Elder, Alexander** (2002). *Come Into My Trading Room: A Complete Guide to Trading*, Wiley. p. 162.
|
||||
- **Elder, Alexander** (1993). *Trading for a Living*, Wiley. (Earlier discussion of volatility-based stops.)
|
||||
- **Elder, Alexander** (1993). *Trading for a Living*, Wiley. (Earlier discussion of volatility-based stops.)
|
||||
@@ -13,9 +13,7 @@
|
||||
| **PineScript** | [ewma.pine](ewma.pine) |
|
||||
|
||||
- EWMA Volatility calculates market volatility using an exponentially weighted moving average of squared log returns with bias correction.
|
||||
- Parameterized by `period` (default 20), `annualize` (default true), `annualperiods` (default 252).
|
||||
- Output range: $\geq 0$.
|
||||
- Requires `period` bars of warmup before first valid output (IsHot = true).
|
||||
- **Similar:** [HV](../hv/hv.md), [ATR](../atr/atr.md) | **Complementary:** Risk management | **Trading note:** Exponentially-Weighted Moving Average volatility; RiskMetrics standard.
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
EWMA Volatility calculates market volatility using an exponentially weighted moving average of squared log returns with bias correction. Unlike simple historical volatility that weights all observations equally, EWMA gives more weight to recent observations while still considering historical data, making it more responsive to current market conditions.
|
||||
@@ -181,4 +179,4 @@ Note: This implementation is based on the PineScript reference at `ewma.pine`. T
|
||||
|
||||
- J.P. Morgan/Reuters. (1996). "RiskMetrics Technical Document." Fourth Edition.
|
||||
- Bollerslev, T. (1986). "Generalized Autoregressive Conditional Heteroskedasticity." Journal of Econometrics.
|
||||
- Hull, J. (2018). "Options, Futures, and Other Derivatives." Chapter on Volatility Estimation.
|
||||
- Hull, J. (2018). "Options, Futures, and Other Derivatives." Chapter on Volatility Estimation.
|
||||
@@ -13,9 +13,7 @@
|
||||
| **PineScript** | [gkv.pine](gkv.pine) |
|
||||
|
||||
- Garman-Klass Volatility (GKV) is a range-based volatility estimator that uses all four OHLC prices to provide more efficient volatility estimates t...
|
||||
- Parameterized by `period` (default 20), `annualize` (default true), `annualperiods` (default 252).
|
||||
- Output range: $\geq 0$.
|
||||
- Requires `period` bars of warmup before first valid output (IsHot = true).
|
||||
- **Similar:** [YZV](../yzv/yzv.md), [HV](../hv/hv.md) | **Complementary:** Options pricing | **Trading note:** Garman-Klass; full OHLC, more efficient than close-to-close.
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
Garman-Klass Volatility (GKV) is a range-based volatility estimator that uses all four OHLC prices to provide more efficient volatility estimates than traditional close-to-close methods. Developed by Mark Garman and Michael Klass in 1980, this estimator achieves theoretical efficiency gains of 7-8x over simple close-to-close variance by incorporating intraday price information. The implementation includes RMA (Wilder's) smoothing with bias correction and optional annualization.
|
||||
@@ -292,4 +290,4 @@ Confirmation: Wait for directional move
|
||||
- Garman, M. B., & Klass, M. J. (1980). "On the Estimation of Security Price Volatilities from Historical Data." *Journal of Business*, 53(1), 67-78.
|
||||
- Parkinson, M. (1980). "The Extreme Value Method for Estimating the Variance of the Rate of Return." *Journal of Business*, 53(1), 61-65.
|
||||
- Rogers, L. C. G., & Satchell, S. E. (1991). "Estimating Variance from High, Low and Closing Prices." *Annals of Applied Probability*, 1(4), 504-512.
|
||||
- Yang, D., & Zhang, Q. (2000). "Drift-Independent Volatility Estimation Based on High, Low, Open, and Close Prices." *Journal of Business*, 73(3), 477-491.
|
||||
- Yang, D., & Zhang, Q. (2000). "Drift-Independent Volatility Estimation Based on High, Low, Open, and Close Prices." *Journal of Business*, 73(3), 477-491.
|
||||
@@ -13,9 +13,7 @@
|
||||
| **PineScript** | [hlv.pine](hlv.pine) |
|
||||
|
||||
- *Also known as: PV (Parkinson Volatility)*
|
||||
- Parameterized by `period` (default 20), `annualize` (default true), `annualperiods` (default 252).
|
||||
- Output range: $\geq 0$.
|
||||
- Requires `period` bars of warmup before first valid output (IsHot = true).
|
||||
- **Similar:** [GKV](../gkv/gkv.md), [ATR](../atr/atr.md) | **Complementary:** ATR comparison | **Trading note:** Parkinson high-low volatility; ~5x more efficient than close-to-close.
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
*Also known as: PV (Parkinson Volatility)*
|
||||
@@ -308,4 +306,4 @@ Note: HLV may underestimate true volatility due to drift bias
|
||||
- Parkinson, M. (1980). "The Extreme Value Method for Estimating the Variance of the Rate of Return." *Journal of Business*, 53(1), 61-65.
|
||||
- Garman, M. B., & Klass, M. J. (1980). "On the Estimation of Security Price Volatilities from Historical Data." *Journal of Business*, 53(1), 67-78.
|
||||
- Rogers, L. C. G., & Satchell, S. E. (1991). "Estimating Variance from High, Low and Closing Prices." *Annals of Applied Probability*, 1(4), 504-512.
|
||||
- Alizadeh, S., Brandt, M. W., & Diebold, F. X. (2002). "Range-Based Estimation of Stochastic Volatility Models." *Journal of Finance*, 57(3), 1047-1091.
|
||||
- Alizadeh, S., Brandt, M. W., & Diebold, F. X. (2002). "Range-Based Estimation of Stochastic Volatility Models." *Journal of Finance*, 57(3), 1047-1091.
|
||||
@@ -13,9 +13,7 @@
|
||||
| **PineScript** | [hv.pine](hv.pine) |
|
||||
|
||||
- Historical Volatility (HV), also known as close-to-close volatility or realized volatility, is the classical measure of price volatility using the ...
|
||||
- Parameterized by `period` (default 20), `annualize` (default true), `annualperiods` (default 252).
|
||||
- Output range: $\geq 0$.
|
||||
- Requires `period + 1` bars of warmup before first valid output (IsHot = true).
|
||||
- **Similar:** [RVI](../rvi/rvi.md), [ATR](../atr/atr.md) | **Complementary:** Implied volatility for HV/IV ratio | **Trading note:** Historical Volatility; annualized std dev of log returns.
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
Historical Volatility (HV), also known as close-to-close volatility or realized volatility, is the classical measure of price volatility using the standard deviation of logarithmic returns. First formalized in the early 20th century and central to the Black-Scholes option pricing model, HV remains the benchmark against which all other volatility estimators are compared. This implementation uses population standard deviation with a rolling window and optional annualization.
|
||||
@@ -306,4 +304,4 @@ HV is the standard for regulatory risk calculations (VaR, ES) because:
|
||||
- Black, F., & Scholes, M. (1973). "The Pricing of Options and Corporate Liabilities." *Journal of Political Economy*, 81(3), 637-654.
|
||||
- Parkinson, M. (1980). "The Extreme Value Method for Estimating the Variance of the Rate of Return." *Journal of Business*, 53(1), 61-65.
|
||||
- Garman, M. B., & Klass, M. J. (1980). "On the Estimation of Security Price Volatilities from Historical Data." *Journal of Business*, 53(1), 67-78.
|
||||
- Merton, R. C. (1980). "On Estimating the Expected Return on the Market: An Exploratory Investigation." *Journal of Financial Economics*, 8(4), 323-361.
|
||||
- Merton, R. C. (1980). "On Estimating the Expected Return on the Market: An Exploratory Investigation." *Journal of Financial Economics*, 8(4), 323-361.
|
||||
@@ -13,9 +13,7 @@
|
||||
| **PineScript** | [jvolty.pine](jvolty.pine) |
|
||||
|
||||
- Jurik Volatility (JVOLTY) is the adaptive volatility component extracted from Mark Jurik's JMA algorithm.
|
||||
- Parameterized by `period`.
|
||||
- Output range: $\geq 0$.
|
||||
- Requires 1 bar of warmup before first valid output (IsHot = true).
|
||||
- **Similar:** [ATR](../atr/atr.md) | **Complementary:** JMA bands | **Trading note:** Jurik Volatility; adaptive volatility from JMA internals.
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
Jurik Volatility (JVOLTY) is the adaptive volatility component extracted from Mark Jurik's JMA algorithm. Unlike traditional volatility measures that treat all price movements equally, JVOLTY uses a 128-bar trimmed mean distribution to compute a robust volatility reference that rejects outliers by design. The result: a volatility measure that remains stable during flash crashes, earnings surprises, and 5-sigma events while still tracking genuine regime changes.
|
||||
@@ -255,4 +253,4 @@ JVOLTY is proprietary. No open-source library implements it. Validation is perfo
|
||||
|
||||
- Jurik Research. (1998-2005). "JMA White Papers." *jurikres.com* (archived).
|
||||
- Kositsin, Nikolay. (2007). "Digital Indicators for MetaTrader 4." *Alpari Forum Archives*.
|
||||
- Wilcox, R. R. (2012). "Introduction to Robust Estimation and Hypothesis Testing." *Academic Press*. (Trimmed mean statistics)
|
||||
- Wilcox, R. R. (2012). "Introduction to Robust Estimation and Hypothesis Testing." *Academic Press*. (Trimmed mean statistics)
|
||||
@@ -13,9 +13,7 @@
|
||||
| **PineScript** | [jvoltyn.pine](jvoltyn.pine) |
|
||||
|
||||
- Normalized Jurik Volatility (JVOLTYN) maps the raw JVOLTY dynamic exponent to a 0-100 scale.
|
||||
- Parameterized by `period`.
|
||||
- Output range: $\geq 0$.
|
||||
- Requires 1 bar of warmup before first valid output (IsHot = true).
|
||||
- **Similar:** [JVolty](../jvolty/jvolty.md) | **Complementary:** Normalized comparison | **Trading note:** Normalized Jurik Volatility; percentage-based.
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
Normalized Jurik Volatility (JVOLTYN) maps the raw JVOLTY dynamic exponent to a 0-100 scale. While JVOLTY outputs values in the range [1, logParam] (where logParam is period-dependent), JVOLTYN transforms this to a universal scale where 0 represents minimum volatility and 100 represents maximum volatility. This normalization enables direct comparison across different periods and instruments.
|
||||
@@ -228,4 +226,4 @@ public Jvoltyn(int period = 14)
|
||||
## References
|
||||
|
||||
- Jurik Research. (1998-2005). "JMA White Papers." *jurikres.com* (archived).
|
||||
- QuanTAlib. "JVOLTY: Jurik Volatility." [Documentation](../jvolty/Jvolty.md).
|
||||
- QuanTAlib. "JVOLTY: Jurik Volatility." [Documentation](../jvolty/Jvolty.md).
|
||||
@@ -13,9 +13,7 @@
|
||||
| **PineScript** | [massi.pine](massi.pine) |
|
||||
|
||||
- The Mass Index, developed by Donald Dorsey and introduced in the June 1992 issue of *Technical Analysis of Stocks & Commodities*, identifies potent...
|
||||
- Parameterized by `emalength` (default 9), `sumlength` (default 25).
|
||||
- Output range: $\geq 0$.
|
||||
- Requires 1 bar of warmup before first valid output (IsHot = true).
|
||||
- **Similar:** [BBW](../bbw/bbw.md) | **Complementary:** Reversal signals | **Trading note:** Mass Index; detects range bulges signaling reversals (>27 = reversal setup).
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
The Mass Index, developed by Donald Dorsey and introduced in the June 1992 issue of *Technical Analysis of Stocks & Commodities*, identifies potential trend reversals by measuring the narrowing and widening of the range between high and low prices. Unlike directional indicators, MASSI focuses on the *pattern* of range expansion and contraction, particularly the characteristic "reversal bulge" that often precedes significant market turns.
|
||||
@@ -221,4 +219,4 @@ Massi.Calculate(ranges, output, emaLength: 9, sumLength: 25);
|
||||
|
||||
- Dorsey, Donald. (1992). "The Mass Index." *Technical Analysis of Stocks & Commodities*, June 1992.
|
||||
- Achelis, Steven B. (2000). *Technical Analysis from A to Z*. McGraw-Hill.
|
||||
- Pring, Martin J. (2002). *Technical Analysis Explained*. McGraw-Hill.
|
||||
- Pring, Martin J. (2002). *Technical Analysis Explained*. McGraw-Hill.
|
||||
@@ -13,9 +13,7 @@
|
||||
| **PineScript** | [natr.pine](natr.pine) |
|
||||
|
||||
- NATR normalizes the Average True Range (ATR) as a percentage of the closing price.
|
||||
- Parameterized by `period` (default 14).
|
||||
- Output range: $\geq 0$.
|
||||
- Requires 1 bar of warmup before first valid output (IsHot = true).
|
||||
- **Similar:** [ATR](../atr/atr.md), [ATRN](../atrn/atrn.md) | **Complementary:** Cross-asset comparison | **Trading note:** Normalized ATR as percentage of close.
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
NATR normalizes the Average True Range (ATR) as a percentage of the closing price. This is mathematically identical to ATRP (Average True Range Percent)—both compute `(ATR / Close) × 100`. The difference is purely nomenclature: NATR is the term used in TA-Lib and many charting platforms.
|
||||
@@ -210,4 +208,4 @@ Ensures equal percentage risk per position regardless of asset price.
|
||||
|
||||
- Wilder, J.W. (1978). *New Concepts in Technical Trading Systems*. Trend Research.
|
||||
- TA-Lib documentation: NATR function specification
|
||||
- TradingView PineScript: `ta.natr()` implementation
|
||||
- TradingView PineScript: `ta.natr()` implementation
|
||||
@@ -13,9 +13,7 @@
|
||||
| **PineScript** | [rsv.pine](rsv.pine) |
|
||||
|
||||
- Rogers-Satchell Volatility (RSV) is a drift-adjusted OHLC-based volatility estimator that uses all four price points (Open, High, Low, Close) to pr...
|
||||
- Parameterized by `period` (default 20), `annualize` (default true), `annualperiods` (default 252).
|
||||
- Output range: $\geq 0$.
|
||||
- Requires `period` bars of warmup before first valid output (IsHot = true).
|
||||
- **Similar:** [HV](../hv/hv.md) | **Complementary:** Options pricing | **Trading note:** Rogers-Satchell volatility; handles drift without bias.
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
Rogers-Satchell Volatility (RSV) is a drift-adjusted OHLC-based volatility estimator that uses all four price points (Open, High, Low, Close) to provide more accurate volatility estimates than simpler range-based methods. Developed by L.C.G. Rogers and S.E. Satchell in 1991, this estimator is unique in its ability to account for price drift, making it particularly suitable for trending markets. The implementation uses SMA smoothing and optional annualization.
|
||||
@@ -352,4 +350,4 @@ rsVariance = Math.FusedMultiplyAdd(lnHO, lnHC, lnLO * lnLC);
|
||||
- Parkinson, M. (1980). "The Extreme Value Method for Estimating the Variance of the Rate of Return." *Journal of Business*, 53(1), 61-65.
|
||||
- Garman, M. B., & Klass, M. J. (1980). "On the Estimation of Security Price Volatilities from Historical Data." *Journal of Business*, 53(1), 67-78.
|
||||
- Yang, D., & Zhang, Q. (2000). "Drift-Independent Volatility Estimation Based on High, Low, Open, and Close Prices." *Journal of Business*, 73(3), 477-492.
|
||||
- Alizadeh, S., Brandt, M. W., & Diebold, F. X. (2002). "Range-Based Estimation of Stochastic Volatility Models." *Journal of Finance*, 57(3), 1047-1091.
|
||||
- Alizadeh, S., Brandt, M. W., & Diebold, F. X. (2002). "Range-Based Estimation of Stochastic Volatility Models." *Journal of Finance*, 57(3), 1047-1091.
|
||||
@@ -13,9 +13,7 @@
|
||||
| **PineScript** | [rv.pine](rv.pine) |
|
||||
|
||||
- Realized Volatility (RV) measures price volatility using the sum of squared logarithmic returns over a rolling window, then applying SMA smoothing ...
|
||||
- Parameterized by `period` (default 5), `smoothingperiod` (default 20), `annualize` (default true), `annualperiods` (default 252).
|
||||
- Output range: $\geq 0$.
|
||||
- Requires 1 bar of warmup before first valid output (IsHot = true).
|
||||
- **Similar:** [HV](../hv/hv.md), [EWMA](../ewma/ewma.md) | **Complementary:** High-frequency analysis | **Trading note:** Realized Volatility; sum of squared returns.
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
Realized Volatility (RV) measures price volatility using the sum of squared logarithmic returns over a rolling window, then applying SMA smoothing for stability. Unlike traditional Historical Volatility (HV) which calculates standard deviation of returns, RV directly accumulates squared returns—the raw building blocks of variance—providing a more direct measure of realized price variation.
|
||||
@@ -276,4 +274,4 @@ Diverging (short < long): Volatility compression
|
||||
- Andersen, T. G., Bollerslev, T., Diebold, F. X., & Labys, P. (2001). "The Distribution of Realized Exchange Rate Volatility." *Journal of the American Statistical Association*, 96(453), 42-55.
|
||||
- Andersen, T. G., Bollerslev, T., Diebold, F. X., & Ebens, H. (2001). "The Distribution of Realized Stock Return Volatility." *Journal of Financial Economics*, 61(1), 43-76.
|
||||
- Barndorff-Nielsen, O. E., & Shephard, N. (2002). "Econometric Analysis of Realized Volatility and Its Use in Estimating Stochastic Volatility Models." *Journal of the Royal Statistical Society: Series B*, 64(2), 253-280.
|
||||
- McAleer, M., & Medeiros, M. C. (2008). "Realized Volatility: A Review." *Econometric Reviews*, 27(1-3), 10-45.
|
||||
- McAleer, M., & Medeiros, M. C. (2008). "Realized Volatility: A Review." *Econometric Reviews*, 27(1-3), 10-45.
|
||||
@@ -14,9 +14,7 @@
|
||||
|
||||
- The Relative Volatility Index (RVI) implements Dorsey's **revised (1995)** version: computes original RVI separately on High and Low series, then averages.
|
||||
- When fed single-price data (TValue), both channels receive the same value, reducing to the original (1993) formula.
|
||||
- Parameterized by `stdevLength` (default 10), `rmaLength` (default 14).
|
||||
- Output range: $0$ to $100$.
|
||||
- Requires `stdevLength` bars of warmup before first valid output (IsHot = true).
|
||||
- **Similar:** [HV](../hv/hv.md), [ATR](../atr/atr.md) | **Complementary:** Bollinger Bands | **Trading note:** Relative Volatility Index; direction of volatility.
|
||||
- Validated against FM Labs revised RVI specification.
|
||||
|
||||
The Relative Volatility Index (RVI) is a directional volatility oscillator that distinguishes between upward and downward price volatility. Originally developed by Donald Dorsey in 1993 using close prices only, RVI was **revised in 1995** to compute separate RVI values on the High and Low price series and average them. This implementation follows the revised version: when fed OHLCV bars (TBar), it runs independent RVI channels on High and Low; when fed single prices (TValue), both channels receive the same value, reducing to the original formula.
|
||||
@@ -285,4 +283,4 @@ Price making lower lows + RVI making higher lows: Bullish divergence
|
||||
- Dorsey, D. (1993). "The Relative Volatility Index." *Technical Analysis of Stocks & Commodities*, 11(6), 253-256.
|
||||
- Dorsey, D. (1995). "Refining the Relative Volatility Index." *Technical Analysis of Stocks & Commodities*, 13(9).
|
||||
- FM Labs. "Relative Volatility Index." https://www.fmlabs.com/reference/RVI.htm (Original vs Revised versions).
|
||||
- TradingView. (2024). "PineScript Reference Implementation." rvi.pine source file.
|
||||
- TradingView. (2024). "PineScript Reference Implementation." rvi.pine source file.
|
||||
@@ -13,9 +13,8 @@
|
||||
| **PineScript** | [tr.pine](tr.pine) |
|
||||
|
||||
- True Range (TR) is a volatility measure that captures the maximum price movement for each bar, including any gap from the previous close.
|
||||
- **Similar:** [ATR](../atr/atr.md) | **Complementary:** ATR for smoothed version | **Trading note:** True Range; single-bar volatility including gaps.
|
||||
- No configurable parameters; computation is stateless per bar.
|
||||
- Output range: $\geq 0$.
|
||||
- Requires `1` bars of warmup before first valid output (IsHot = true).
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
True Range (TR) is a volatility measure that captures the maximum price movement for each bar, including any gap from the previous close. Developed by J. Welles Wilder Jr. in 1978, TR forms the foundation for Average True Range (ATR) and numerous other volatility-based indicators. Unlike simple High-Low range, TR accounts for overnight gaps and opening jumps, providing a complete picture of price movement.
|
||||
@@ -289,4 +288,4 @@ If gap contribution > 50% of TR: Significant gap move
|
||||
|
||||
- Wilder, J. W. (1978). *New Concepts in Technical Trading Systems*. Trend Research.
|
||||
- Kaufman, P. J. (2013). *Trading Systems and Methods* (5th ed.). Wiley.
|
||||
- Murphy, J. J. (1999). *Technical Analysis of the Financial Markets*. New York Institute of Finance.
|
||||
- Murphy, J. J. (1999). *Technical Analysis of the Financial Markets*. New York Institute of Finance.
|
||||
@@ -13,9 +13,7 @@
|
||||
| **PineScript** | [ui.pine](ui.pine) |
|
||||
|
||||
- Ulcer Index (UI) is a downside volatility measure that quantifies the depth and duration of drawdowns from recent highs.
|
||||
- Parameterized by `period` (default 14).
|
||||
- Output range: $\geq 0$.
|
||||
- Requires `period` bars of warmup before first valid output (IsHot = true).
|
||||
- **Similar:** [HV](../hv/hv.md) | **Complementary:** Martin ratio | **Trading note:** Ulcer Index; measures drawdown depth and duration.
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
Ulcer Index (UI) is a downside volatility measure that quantifies the depth and duration of drawdowns from recent highs. Developed by Peter G. Martin in 1987, UI captures what most volatility measures miss: the pain of being underwater. Unlike standard deviation or ATR that treat upside and downside moves equally, UI measures only the decline from peaks—the psychological stress that keeps investors awake at night.
|
||||
@@ -263,4 +261,4 @@ Strategy B is better risk-adjusted despite lower returns
|
||||
|
||||
- Martin, P. G., & McCann, B. B. (1989). *The Investor's Guide to Fidelity Funds*. John Wiley & Sons.
|
||||
- Martin, P. G. (1987). "Ulcer Index, An Alternative Approach to the Measurement of Investment Risk & Risk-Adjusted Performance."
|
||||
- Kaufman, P. J. (2013). *Trading Systems and Methods* (5th ed.). Wiley.
|
||||
- Kaufman, P. J. (2013). *Trading Systems and Methods* (5th ed.). Wiley.
|
||||
@@ -13,9 +13,7 @@
|
||||
| **PineScript** | [vov.pine](vov.pine) |
|
||||
|
||||
- Volatility of Volatility (VOV) measures the standard deviation of volatility itself, quantifying how much volatility fluctuates over time.
|
||||
- Parameterized by `volatilityperiod` (default 20), `vovperiod` (default 10).
|
||||
- Output range: $\geq 0$.
|
||||
- Requires `volatilityPeriod + vovPeriod - 1` bars of warmup before first valid output (IsHot = true).
|
||||
- **Similar:** [HV](../hv/hv.md) | **Complementary:** Regime detection | **Trading note:** Volatility of Volatility; GARCH-style clustering indicator.
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
Volatility of Volatility (VOV) measures the standard deviation of volatility itself, quantifying how much volatility fluctuates over time. While standard volatility tells you how much prices move, VOV tells you how stable or unstable that movement pattern is. High VOV indicates volatility is erratic and unpredictable; low VOV suggests volatility is relatively stable and consistent.
|
||||
@@ -270,4 +268,4 @@ The formula $\sqrt{E[X^2] - E[X]^2}$ can produce small negative values due to fl
|
||||
|
||||
- Heston, S. L. (1993). "A Closed-Form Solution for Options with Stochastic Volatility with Applications to Bond and Currency Options." *Review of Financial Studies*, 6(2), 327-343.
|
||||
- Gatheral, J. (2006). *The Volatility Surface: A Practitioner's Guide*. Wiley Finance.
|
||||
- CBOE. "VVIX Index." Chicago Board Options Exchange white paper on volatility-of-volatility indices.
|
||||
- CBOE. "VVIX Index." Chicago Board Options Exchange white paper on volatility-of-volatility indices.
|
||||
@@ -13,9 +13,7 @@
|
||||
| **PineScript** | [vr.pine](vr.pine) |
|
||||
|
||||
- Volatility Ratio (VR) measures the current bar's True Range relative to its Average True Range (ATR), providing a normalized indicator of short-ter...
|
||||
- Parameterized by `period` (default 14).
|
||||
- Output range: $\geq 0$.
|
||||
- Requires `period` bars of warmup before first valid output (IsHot = true).
|
||||
- **Similar:** [HV](../hv/hv.md), [ATR](../atr/atr.md) | **Complementary:** Volatility regimes | **Trading note:** Volatility Ratio; current vs historical for regime detection.
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
Volatility Ratio (VR) measures the current bar's True Range relative to its Average True Range (ATR), providing a normalized indicator of short-term volatility expansion or contraction. Values above 1.0 indicate above-average volatility (potential breakouts), while values below 1.0 suggest below-average volatility (consolidation). This simple yet powerful ratio helps traders identify when markets are moving unusually, often preceding significant price moves.
|
||||
@@ -285,4 +283,4 @@ The implementation uses:
|
||||
|
||||
- Wilder, J. W. (1978). *New Concepts in Technical Trading Systems*. Trend Research.
|
||||
- Kaufman, P. J. (2013). *Trading Systems and Methods* (5th ed.). John Wiley & Sons.
|
||||
- Kirkpatrick, C. D., & Dahlquist, J. R. (2010). *Technical Analysis: The Complete Resource for Financial Market Technicians* (2nd ed.). FT Press.
|
||||
- Kirkpatrick, C. D., & Dahlquist, J. R. (2010). *Technical Analysis: The Complete Resource for Financial Market Technicians* (2nd ed.). FT Press.
|
||||
@@ -13,9 +13,7 @@
|
||||
| **PineScript** | [yzv.pine](yzv.pine) |
|
||||
|
||||
- Yang-Zhang Volatility is a sophisticated volatility estimator that combines overnight (close-to-open) returns with Rogers-Satchell intraday volatil...
|
||||
- Parameterized by `period` (default 20).
|
||||
- Output range: $\geq 0$.
|
||||
- Requires `period` bars of warmup before first valid output (IsHot = true).
|
||||
- **Similar:** [GKV](../gkv/gkv.md), [HV](../hv/hv.md) | **Complementary:** HV/IV comparison | **Trading note:** Yang-Zhang; most efficient OHLC estimator, handles gaps and drift.
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
Yang-Zhang Volatility is a sophisticated volatility estimator that combines overnight (close-to-open) returns with Rogers-Satchell intraday volatility to capture the full spectrum of price dynamics. Unlike simple close-to-close volatility that misses overnight gaps, or purely intraday measures that ignore opening moves, Yang-Zhang provides a theoretically unbiased estimate that remains consistent whether markets gap or drift.
|
||||
@@ -314,4 +312,4 @@ The implementation uses:
|
||||
- Yang, D., & Zhang, Q. (2000). "Drift-Independent Volatility Estimation Based on High, Low, Open, and Close Prices." *Journal of Business*, 73(3), 477-491.
|
||||
- Rogers, L. C. G., & Satchell, S. E. (1991). "Estimating Variance from High, Low and Closing Prices." *Annals of Applied Probability*, 1(4), 504-512.
|
||||
- Parkinson, M. (1980). "The Extreme Value Method for Estimating the Variance of the Rate of Return." *Journal of Business*, 53(1), 61-65.
|
||||
- Garman, M. B., & Klass, M. J. (1980). "On the Estimation of Security Price Volatilities from Historical Data." *Journal of Business*, 53(1), 67-78.
|
||||
- Garman, M. B., & Klass, M. J. (1980). "On the Estimation of Security Price Volatilities from Historical Data." *Journal of Business*, 53(1), 67-78.
|
||||
Reference in New Issue
Block a user