OPEN-SOURCE SCRIPT
Adaptive MA

Adaptive Moving Average (AMA)
Overview
The Adaptive Moving Average (AMA) script is designed to calculate and plot a moving average that adapts dynamically based on market conditions. This script uses pivot-based periods for its calculation, allowing it to adjust its behavior in response to market volatility and trends. It supports both Simple Moving Average (SMA) and Exponential Moving Average (EMA).
Features
Inputs
Source (src): Data source for the moving average (e.g., close price).
Default: close
Length Type (length_type): Determines the type of period calculation.
Options: Fast, Slow, Manual
MA Type (ma_type): Specifies the type of moving average to calculate.
Options: SMA, EMA
Manual Parameters (used when length_type is set to Manual):
Left Bars (left_bars): Number of left-hand bars for pivot detection.
Right Bars (right_bars): Number of right-hand bars for pivot detection.
Number of Pivots (num_pivots): Minimum number of pivots for dynamic period calculation.
Length Multiplier (length_mult): Multiplier applied to the calculated period.
Use Cases
Example Usage
Overview
The Adaptive Moving Average (AMA) script is designed to calculate and plot a moving average that adapts dynamically based on market conditions. This script uses pivot-based periods for its calculation, allowing it to adjust its behavior in response to market volatility and trends. It supports both Simple Moving Average (SMA) and Exponential Moving Average (EMA).
Features
- Dynamic Period Calculation: Leverages the DynamicPeriodPublic library to compute periods based on pivot points, providing an adaptive length for the moving average.
- Customizable Parameters: Users can choose predefined "Fast" and "Slow" settings or manually configure the parameters for greater control.
- Supports SMA and EMA: Flexibility to choose between SMA and EMA for the moving average calculation.
Inputs
Source (src): Data source for the moving average (e.g., close price).
Default: close
Length Type (length_type): Determines the type of period calculation.
Options: Fast, Slow, Manual
MA Type (ma_type): Specifies the type of moving average to calculate.
Options: SMA, EMA
Manual Parameters (used when length_type is set to Manual):
Left Bars (left_bars): Number of left-hand bars for pivot detection.
Right Bars (right_bars): Number of right-hand bars for pivot detection.
Number of Pivots (num_pivots): Minimum number of pivots for dynamic period calculation.
Length Multiplier (length_mult): Multiplier applied to the calculated period.
Use Cases
- Trend Analysis: Identify market trends with an average that adapts to changing conditions.
- Volatility-Based Strategies: Adjust strategies dynamically in response to market volatility.
- Custom Configurations: Fine-tune pivot parameters for specific markets or assets using the "Manual" mode.
Example Usage
- Select the desired length type (Fast, Slow, or Manual).
- If Manual is selected, configure the pivot detection parameters and length multiplier.
- Choose the moving average type (SMA or EMA).
- Observe the adaptive moving average plotted on the chart.
開源腳本
本著TradingView的真正精神,此腳本的創建者將其開源,以便交易者可以查看和驗證其功能。向作者致敬!雖然您可以免費使用它,但請記住,重新發佈程式碼必須遵守我們的網站規則。
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。
開源腳本
本著TradingView的真正精神,此腳本的創建者將其開源,以便交易者可以查看和驗證其功能。向作者致敬!雖然您可以免費使用它,但請記住,重新發佈程式碼必須遵守我們的網站規則。
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。