PINE LIBRARY

AdaptiveMovingAverages

已更新
AdaptiveMovingAverages Library Documentation
This library provides functions for adaptive moving averages using various adaptation styles.

---

get_coeff
*Description:
Calculates the adaptation coefficient based on the selected adaptation style.

*Usage:


*Parameters:
- src: *(series float)* Input price series or data (e.g., `close`, `high`, or a custom calculation).
- length: *(simple int)* Length of the adaptation calculation.
- style: *(AdaptationStyle)* Selected adaptation style:
- AdaptationStyle.atr: Average True Range
- AdaptationStyle.roc: Rate of Change
- AdaptationStyle.stddev: Standard Deviation
- AdaptationStyle.rsi: Relative Strength Index
- AdaptationStyle.bbw: Bollinger Band Width
- AdaptationStyle.hv: Historical Volatility
- AdaptationStyle.fdi: Fractal Dimension Index
- AdaptationStyle.volumen: Volume-Based

*Returns:
*(float)* Adaptation coefficient in the range [0.01, 1.0].

---

adaptive_ema
*Description:
Calculates an Adaptive Exponential Moving Average (Adaptive EMA) using the specified adaptation style.

*Usage:


*Parameters:
- src: *(series float)* Input price series or data.
- length: *(int)* EMA length.
- adaptation_style: *(AdaptationStyle)* Adaptation style (e.g., AdaptationStyle.atr, AdaptationStyle.roc).
- adaptation_length: *(int)* Length used for calculating the adaptation coefficient.

*Returns:
*(float)* Adaptive EMA value.

---

adaptive_dema
*Description:
Calculates an Adaptive Double Exponential Moving Average (Adaptive DEMA).

*Usage:


*Parameters:
- src: *(series float)* Input price series or data.
- length: *(int)* DEMA length.
- adaptation_style: *(AdaptationStyle)* Adaptation style.
- adaptation_length: *(int)* Length used for calculating the adaptation coefficient.

*Returns:
*(float)* Adaptive DEMA value.

---

adaptive_tema
*Description:
Calculates an Adaptive Triple Exponential Moving Average (Adaptive TEMA).

*Usage:


*Parameters:
- src: *(series float)* Input price series or data.
- length: *(int)* TEMA length.
- adaptation_style: *(AdaptationStyle)* Adaptation style.
- adaptation_length: *(int)* Length used for calculating the adaptation coefficient.

*Returns:
*(float)* Adaptive TEMA value.

---

adaptive_wma
*Description:
Calculates an Adaptive Weighted Moving Average (Adaptive WMA).

*Usage:


*Parameters:
- src: *(series float)* Input price series or data.
- length: *(int)* WMA length.
- adaptation_style: *(AdaptationStyle)* Adaptation style.
- adaptation_length: *(int)* Length used for calculating the adaptation coefficient.

*Returns:
*(float)* Adaptive WMA value.

---

adaptive_hma
*Description:
Calculates an Adaptive Hull Moving Average (Adaptive HMA) using a combination of adaptive WMA and adaptive EMA.

*Usage:


*Parameters:
- src: *(series float)* Input price series or data.
- length: *(int)* HMA length.
- adaptation_style: *(AdaptationStyle)* Adaptation style.
- adaptation_length: *(int)* Length used for calculating the adaptation coefficient.

*Returns:
*(float)* Adaptive HMA value.

---

AdaptationStyle Enum
*Description:
The `AdaptationStyle` enum provides predefined options for selecting the adaptation method.

*Options:
- AdaptationStyle.atr: Average True Range
- AdaptationStyle.roc: Rate of Change
- AdaptationStyle.stddev: Standard Deviation
- AdaptationStyle.rsi: Relative Strength Index
- AdaptationStyle.bbw: Bollinger Band Width
- AdaptationStyle.hv: Historical Volatility
- AdaptationStyle.fdi: Fractal Dimension Index
- AdaptationStyle.volumen: Volume-Based

---

Example Usage

發行說明
v2
發行說明
v2
adaptiveAdaptive Moving Average (AMA)moving_averagetechindicator

Pine腳本庫

在真正的TradingView精神中,作者將這段Pine程式碼發佈為開源程式庫,以便我們社群的其他Pine程式設計師可以重複使用它。請向作者致敬!您可以私下使用這個函式庫,或在其他開源出版品中使用,但在出版物中再次使用這段程式碼將受到網站規則的約束。

免責聲明