AutoLength Moving Average Indicator

AutoLength Moving Average Indicator

Introduction

The AutoLength Moving Average is a dynamic adaptation of the traditional moving average that adjusts its length based on market conditions (author Zeiierman). Unlike standard moving averages that rely on fixed periods, this indicator intelligently modifies its length using a counter-based approach, allowing it to adapt to varying market trends. This feature makes it especially useful for traders who need a responsive yet smooth trend-following tool.

Concept and Functionality

The AutoLength Moving Average is designed to dynamically adjust its smoothing period, ensuring that it reacts appropriately to market fluctuations. Here’s how it works:

  • It starts with a base length for the moving average.
  • A counter tracks market conditions and increases or resets based on predefined reset conditions.
  • The length of the moving average dynamically extends based on the counter’s value, up to a maximum limit.
  • This results in a moving average that expands during strong trends and contracts during periods of uncertainty, optimizing its responsiveness to price action.

Key Components

  • Dynamic Length Calculation: The moving average length expands progressively up to a maximum dynamic length, depending on market conditions.
  • Counter Mechanism: A counter increases or resets based on the chosen reset condition, affecting the adaptive length of the moving average.
  • Trend Detection: The indicator determines trend direction by analyzing moving average crosses and confirming trends over a given period.

This approach allows the AutoLength Moving Average to smooth price movements while being flexible enough to capture changes in trend direction efficiently.

Reset Conditions

A critical aspect of this indicator is its ability to reset or reverse the counter based on different market conditions. The trader can select from eight different reset conditions:

  1. Moving Average Slope: The counter resets when the slope of the moving average changes direction.
  2. RSI Overbought/Oversold: A reset occurs when the RSI exceeds overbought or drops below oversold levels.
  3. Volume SMA: The counter resets when the volume exceeds its moving average, indicating an increase in trading activity.
  4. Bollinger Bands Breakout: A reset happens when the price crosses above or below the Bollinger Bands.
  5. MACD Crossover: The reset is triggered when the MACD line crosses above or below the signal line.
  6. Stochastic Overbought/Oversold: A reset occurs based on the stochastic oscillator exceeding thresholds.
  7. CCI Overbought/Oversold: The Commodity Channel Index is used to detect extreme market conditions.
  8. Momentum (Rate of Change): The counter resets when the rate of change of price momentum turns positive or negative.

By selecting the appropriate reset condition, traders can fine-tune the indicator to align with their trading style, whether they prefer trend-following or mean-reversion strategies.

Visualization and Signals

To enhance usability, the AutoLength Moving Average includes visual elements to indicate key trading signals:

  • Trend Confirmation:
    • A strong uptrend is confirmed when the indicator detects a consistent upward trend over a defined period.
    • A downtrend is confirmed similarly for downward movements.
  • Trend Color Coding:
    • Green (Confirmed Uptrend): When the uptrend is validated.
    • Red (Confirmed Downtrend): When the downtrend is validated.
    • Yellow (Uncertain Trend): If the trend is not confirmed.
  • Reversal Signals:
    • An orange marker appears when an uptrend starts.
    • A lime marker appears when a downtrend starts.

These signals help traders quickly identify trend shifts and adjust their strategies accordingly.

Configuration and Customization

To optimize the indicator for different market conditions, traders can adjust several parameters:

Primary Inputs:

  • Base Length (Default: 50): Initial period for the moving average.
  • Max Dynamic Length (Default: 350): The maximum expansion allowed for the adaptive length.
  • Counter Threshold (Default: 70): The limit before the counter stops increasing.
  • Reverse Counter (Default: False): Enables or disables counter reversal after reaching the threshold.
  • Trending Confirmation (Default: 10): The number of periods required to confirm a trend.

Reset Condition Settings:

  • RSI Length, Overbought & Oversold Levels
  • Volume SMA Length
  • Bollinger Bands Length & Multiplier
  • MACD Fast, Slow & Signal Periods
  • Stochastic Length, Overbought & Oversold Levels
  • CCI Length, Overbought & Oversold Levels
  • Momentum Length

Each of these settings allows users to adapt the AutoLength Moving Average to their preferred trading methodology.

ProBuilder Code Implementation

Below is the full ProBuilder code for the AutoLength Moving Average, which can be copied and used directly in ProRealTime:

Conclusion

The AutoLength Moving Average is a powerful and flexible moving average designed for traders who require dynamic adaptation to market conditions. With its intelligent counter-based length adjustment and customizable reset conditions, it provides an edge over traditional moving averages by offering both smoothness and responsiveness.

This indicator is especially beneficial for trend traders, swing traders, and those who prefer adaptive technical analysis tools to improve their decision-making process.

Share this

Risk disclosure:

No information on this site is investment advice or a solicitation to buy or sell any financial instrument. Past performance is not indicative of future results. Trading may expose you to risk of loss greater than your deposits and is only suitable for experienced investors who have sufficient financial means to bear such risk.

ProRealTime ITF files and other attachments : How to import ITF files into ProRealTime platform?

PRC is also on YouTube, subscribe to our channel for exclusive content and tutorials

avatar
Register or

Likes

avatar avatar avatar
Related users ' posts
Iván Hi! just change line13 for this: showsignals=1
Quino Hi Excellent indicator as usual. Just 2 questions: Why LenH and LenL = 15 as Len could be...
Iván Hi! good question. This is a code request traslation from other platform. I took same inputs...
roccafragius Thank you Ivan, very Useful! I would like translation of Trading View CCI_S Indicator, How ...
Iván hi, you can ask here: https://www.prorealcode.com/free-code-conversion/
Gaspare Grazie Ivan, ottimo indicatore posso chiedere, per favore, una strategia che apre posizio...
Iván thanks! maybe I could test it
okeus Ivan, riesci a creare un indicatore per le "evolventi paraboliche" ? grazie
groelandes Impagable tu trabajo cada semana. ¡Gracias!
Iván de nada! :)
Iván
4 months ago
Madrosat Bonjour ivan Quelle différence il y a t il entre Extra trend et ultra trend lequel est le p...
P. Marlowe Muy bueno. ¿Podría hacerse para señalar extremos por el lado bajista? Lo mismo a la inversa....
Miro Esta es una versión del indicador, para ambos extremos. //-------------------------------...
P. Marlowe Muchas gracias ¡¡
MaoRai54 dear Ivan, it seems to be very interesting but please clarify what are all the lines I see i...
Iván Hi! you have the answer in the last line of code... MacdMiddle as "histo" style(histogra...
kats Le Top , a utiliser avec le nuage violet et alerte TN pour plus de précision.
Iván Hi! yes. You can ask for it here: https://www.prorealcode.com/free-code-conversion/
roccafragius Thank you so much Ivan! I created this request in english Translate from TradingView Indicat...
ipbvba Hello, Is it possible to have a screener for the various buy and sell signals?
Regisnew très bel indicateur merci
jordan //---settings MAmode=0 Period=150 NumberOfMA=100 //---end of settings MA2=undefined ...
jordan dites moi si cela correspond à ce que vous cherchez
kats bonjour merci de ta reponse mais non ca fonctionne pas sympa quand même d'avoir essayé cdlt
Jean2139 Bonjour Yvan, Merci pour ton indicateur que je trouve très intéressant. Je suppose que tu ...
Suffi Hier eine kleine Korrektur: //-----Inputs-----------------------------------------// MALengt...
kats Bonjour, J'ai une question etes vous trader? Je m'explique , j'ai téléchargé tous les indi...
Faisalx Hola Ivan. Thanks for your great job. I would appreciate if you have look at my request http...
roccafragius Thank you for all these useful information!! Very great job Ivan! THank you so much
geroniman Merci Ivan, super travail. On peut toujours compter sur toi pour apporter des innovations su...
Stenozar Ciao IVAN , mi da errore per la riga 49 "print tema low"; puoi suggerirmi la modifica da met...
Iván Avete provato a scaricare il file .itf?
AndyB72 Caricato ora sulla V12, nessun errore.
Iván Allora crei un nuovo post. Lo aspetterò.
Stenozar Ciao Ivan, ho inserito il post con la richiesta di traduzione. Se puoi vedere, grazie!
Iván perfect!
kats BONSOIR c bon merci j ai trouve ce weekend merci de votre reponse cdlt
the_giorgio Hi, nice work I would like to understand something about prorealtime code. With your ...
Iván Hello. When you use the drawcandle() instruction then in the configuration window you add ...

Top