OPEN-SOURCE SCRIPT

Deviation Adjusted MA

已更新
Overview

The Deviation Adjusted MA is a custom indicator that enhances traditional moving average techniques by introducing a volatility-based adjustment. This adjustment is implemented by incorporating the standard deviation of price data, making the moving average more adaptive to market conditions. The key feature is the combination of a customizable moving average (MA) type and the application of deviation percentage to modify its responsiveness. Additionally, a smoothing layer is applied to reduce noise, improving signal clarity.

Key Components

Customizable Moving Averages
The script allows the user to select from four different types of moving averages:

Simple Moving Average (SMA): A basic average of the closing prices over a specified period.

Exponential Moving Average (EMA): Gives more weight to recent prices, making it more responsive to recent price changes.

Weighted Moving Average (WMA): Weights prices differently, favoring more recent ones but in a linear progression.

Volume-Weighted Moving Average (VWMA): Adjusts the average by trading volume, placing more weight on high-volume periods.

Standard Deviation Calculation
The script calculates the standard deviation of the closing prices over the selected maLength period.
Standard deviation measures the dispersion or volatility of price movements, giving a sense of market volatility.

Deviation Percentage and Adjustment

Deviation Percentage is calculated by dividing the standard deviation by the base moving average and multiplying by 100 to express it as a percentage.
The base moving average is adjusted by this deviation percentage, making the indicator responsive to changes in volatility. The result is a more dynamic moving average that adapts to market conditions.
The parameter devMultiplier is available to scale this adjustment, allowing further fine-tuning of sensitivity.

Smoothing the Adjusted Moving Average

After adjusting the moving average based on deviation, the script applies an additional Exponential Moving Average (EMA) with a length defined by the smoothingLength input.
This EMA serves as a smoothing filter to reduce the noise that could arise from the raw adjustments of the moving average. The smoothing makes trend recognition more consistent and removes short-term fluctuations that could otherwise distort the signal.

Use cases

The Deviation Adjusted MA indicator serves as a dynamic alternative to traditional moving averages by adjusting its sensitivity based on volatility. The script offers extensive customization options through the selection of moving average type and the parameters controlling smoothing and deviation adjustments.

By applying these adjustments and smoothing, the script enables users to better track trends and price movements, while providing a visual cue for changes in market sentiment.
版本注释
Added watermark to code
Moving AveragesStandard DeviationTrend Analysis

开源脚本

本着真正的TradingView精神,此脚本的作者已将其开源,以便交易者可以理解和验证它。向作者致敬!您可以免费使用它,但在出版物中重复使用此代码受网站规则约束。 您可以收藏它以在图表上使用。

想在图表上使用此脚本?


更多:

免责声明