OPEN-SOURCE SCRIPT

Adaptive Ehlers Deviation Scaled Moving Average (AEDSMA)

Mis à jour
AEDSMA INTRODUCTION

This indicator is a functional enhancement to “Ehlers Deviation Scaled Moving Average (EDSMA / DSMA)”. I’ve used Volume Breakout and Volatility for dynamic length adaption and further Slope too for trend evaluation.
EDSMA was originally developed by John F. Ehlers (Stocks & Commodities V. 36:8: The Deviation-Scaled Moving Average).


IDEA PLACEMENT

I’ve traded almost every kind of market with different volatility conditions using Moving Averages. It was too much of a hassle to select and use different MA length depending upon market trend. So, the journey started with adapting Moving Averages with another parameter and that’s how “MZ SAMA” came into being where Slope was used to adapt Adaptive Moving Average with trend change. The problem was still pretty much the same as SAMA might not be effective on every market condition. Hence, I worked on Volume to adapt Moving Averages accordingly. I cane up with “MZ RVSI” which I used in “MZ DVAMA” to adapt dynamic length in Adaptive Moving Average and also used “MZ RVSI" alongside Slope as confirmation of trend changes.
Meanwhile, I started using DVAMA methodology on different types on Moving Averages that allow dynamic length for example Hull Moving Average, Linear Regression Curve, SMA, WMA, TMA and many more. All of my tested Mas showed too much flexibility because of volume based Adaptive length.
I came across a script of “Adaptive Hull Moving Average” which pretty much used the similar methodology as DVAMA but when I looked into its depth, its volume oscillator wasn’t working at all and only volatility based dynamic length was used. It was an interesting idea so, I decided to use Volume and Volatility alongside for better results but was nearly impossible to achieve what I wanted using only Hull Moving Average.
I had been using EDSMA in “MA MTF Cross Strategy” and “MZ SRSI Strategy V1.0” previously. It was the perfect choice when comparing to usage of slope on it. DSMA works perfectly as support and resistance as its Deviation Scaled. So, I tried using it to adapt dynamic length based on Volume and Volatility and I wasn’t disappointed. It worked like a charm when I adapted dynamic length between 50 and 255.


DYNAMIC LENGTH BENEFITS
  • Dynamic length adaption methodology works in a way of adapting Relatively Lower Length leading toward overfitting if trend is supported by Volume and Volatility. Similarly, adapting Relatively Higher Length leading toward underfitting if trend isn’t supported by Volume and Volatility.
  • Dynamic length adaption makes Moving Average to work better for both Bull and Bear-runs avoiding almost every fake break-in and breakouts. Hence, adaptive MA becomes more reliable for breakout trading.
  • MA would be more useful as it would adapt almost every chart based on its Volume and Volatility data.

DYNAMIC COLORS AND TREND CORRELATION

I’ve used dynamic coloring to identify trends with more detail which are as follows:
  • Lime Color: Strong Uptrend supported by Volume and Volatility or whatever you’ve chosen from both of them.
  • Fuchsia Color: Weak uptrend only supported by Slope or whatever you’ve selected.
  • Red Color: Strong Downtrend supported by Volume and Volatility or whatever you’ve chosen from both of them.
  • Grey Color: Weak Downtrend only supported by Slope or whatever you’ve selected.
  • Yellow Color: Possible reversal indication by Slope if enabled. Market is either sideways, consolidating or showing choppiness during that period.

SIGNALS
  • Green Circle: Market good for long with support of Volume and Volatility or whatever you’ve chosen from both of them.
  • Red Circle: Market good to short with support from Volume and Volatility or whatever you’ve chosen from both of them.
  • Yellow Cross: Market either touched top or bottom ATR band and can act as good TP or SL.
  • EDSMA EVELOPE/BANDS: I’ve included ATR based bands to the Adaptive EDSMA which act as good support/resistance despite from main Adaptive EDSMA Curve.

DEFAULT SETTINGS
  • I’ve set default Minimum length to 50 and Maximum length to 255 which I’ve found works best for almost all timeframes but you can change this delta to adapt your timeframe accordingly with more precision.
  • Dynamic length adoption is enabled based on both Volume and Volatility but only one or none of them can also be selected.
  • Trend signals are enabled based on Slope and Volume but Volatility can be enabled for more precise confirmations.
  • In “RVSI” settings TFS Volume Oscillator is set to default but others work good too especially Volume Zone Oscillator. For more details about Volume Breakout you can check “MZ RVSI Indicator".
  • ATR breakout is set to be positive if period 14 exceeds period 46 but can be changed if more adaption with volatility is required.
  • EDSMA super smoother filter length is set to 20 which can be increased to 50 or more for better smoothing but this will also change slope results accordingly.
  • EDSMA super smoother filter poles are set to 2 because found better results with 2 instead of 3.

FURTHER ENHANCEMENTS

So far, I’ve seen better results with Volume Breakout and Volatility but other parameters such as Linear Slope of Particular MA, MACD, “MZ SRSI”, a Conditional Uptrend MA or simply KDJ can also be used for dynamic length adaption.
I haven't yet gotten used to pine script arrays so, defining and using conditional operators is pretty much lazy programming for me. Would be great redefining everything through truth matrix instead of using if-else conditions.
Notes de version
Updated Envelope settings and plots for clear identifications.
Notes de version
  • Converted Script to Pine Script V5
  • Used original Heiken Ashi calculation formulas to solve problems being faced on Multi Timeframe (MTF)
  • Added extra source calculations
  • Added extra long term alerts
  • Cleaned and simplified Dynamic Color function
  • Default settings are still same as before only price source calculations are added with option to apply "Symmetrically Weighted Moving Average (SWMA)" that may result indicator repainting though.
Notes de version
Applied gradient colors between Red and Green to Envelope Bands
Notes de version
  • Changed RVSI script with RVSI library call.
  • Improved Envelope Colors
adaptiveehlerehlersehlersfilterMoving AveragesTrend AnalysistrendtradingVolume

Script open-source

Dans le plus pur esprit TradingView, l'auteur de ce script l'a publié en open-source, afin que les traders puissent le comprendre et le vérifier. Bravo à l'auteur! Vous pouvez l'utiliser gratuitement, mais la réutilisation de ce code dans une publication est régie par nos Règles. Vous pouvez le mettre en favori pour l'utiliser sur un graphique.

Vous voulez utiliser ce script sur un graphique ?


Aussi sur:

Clause de non-responsabilité