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 avatar avatar avatar avatar avatar avatar avatar avatar
Related users ' posts
riz001 thnk u
geroniman bonjour Nicolas, j ai un indicateur le Tiger . J aiemrai placer des fleches buy et sell dire...
Nicolas Merci de formuler les demandes sur le forum. ça n'est pas le bon endroit et hors sujet ici ! ;)
avatar
Anonymous Hi robertogozzi - thank you very much for sharing this strategy. I have performed various ...
robertogozzi Thank you samsampop.
Dotan Hello guys I really appreciate this coding effort but can I use this code for Mt5 Forex Trad...
LucioleLucide Clean view, thanks for sharing
dertopen hi where i can found the window for candle configuration?
paolosab69 Ciao! . I have seen the pictures that explain this metod but i don't understand when is mome...
Alberto Aguilera Hi! Thanks for your strategy Anyone can check it with 200 bars?
TempusFugit Hi, this simple system for DOW and only shorts has worked quite well, maybe because of its q...
phoentzs Unfortunately, I never pursued this strategy further. Maybe I should take a look with what ...
robertogozzi It surely CHANGES even when currently outside time range, as the lookback periods change as ...
SkippyTrader Thanks Roberto, but shouldnt the values in the outside time range not be different? As it sh...
robertogozzi Actually it is a constant (I tested them on a 1-hour TF, 9am to 5pm) and outside that time r...
coscar Ottimo lavoro. come sempre!
luxrun Nello studio di Sepiashvili viene descritto anche un altro indicatore, il Q-indicator, che è...
funkystuff Salut Balmora, Ton indicateur est plutôt intéressant :) Penses-tu qu'il soit possible de l'...
brian gilbert Hello, can you explain to me what are "pipsize" and "ATAN"? What functions do they have and ...
Bodaris Bonjour, Je suis débutant 1 mois :p pipsize ressemble à la fonction pointsize et ATAN...
darbes Hi How does it go on live ? JC
antonio73 Balmora74, io vedo che funziona anche su timeframe ad 1 minuto con piccole ottimizzazioni, t...
Juananantoniorodriguez hola buenas, a este sistema automático, Cómo se le podría poner un stoploss de beneficio sim...
Maik2404 wie kann ich den Code bekommen Paul?
jens_kittner Works with US Crude at 1h as well!
Jean-Claude REGIS Je préconise de regarder les graphiques H1 et M15 pour visualiser la tendance de fond et d'...
Leo I don't know, I just copy paste the strategy. The optimisation of the values I wrote them in...
bertrandpinoy hello Leo I'm spending time on your strategy code. do you agree to try to include this code ...
bertrandpinoy //version a: ajout filtre MM defparam cumulateorders=false // --- paramètres taille =...
capgros Bonjour @Nicolas, Thanks a lot for this tool, it is very useful for me. I would like to s...
Hans63 Would you add the possibility to color also the Heikin Ashi and bar chart?
Nicolas That's possible, please open a new topic in the indicator forum explaining what you need exa...
Nicolas Change line 62 with: drawcandle(flup,fldn,flup,fldn) coloured(169,169,169,80) bordercolor(16...
DimKar Thank you very much from Greece sir , have a nice day ....!!!! Really i do not have words...
mit_ose Bonjour, J'ai d'excellents résultats avec cet indicateur simple et efficace; Merci beaucoup;
ottimo Thank you Nicolas, great indicator, N. 1
tikigai Merci Nicolas! First Happy new Year 2020. Very good indicator BUT (yes the french "oui, m...
Nicolas Whats prorealtime version? Did you try in version prior to v11? indicator's call and loop ca...
Nicolas Yes, that's how it goes when using loops..
JosephFelix Hi, Could I please have help with adding these indicators 'on price'? Every indicator that I...
Nicolas Just add it on price by clicking the wrench on the left upper side of the price chart.
Nicolas
6 years ago
BSTrend
v10.3
BSTrend
10
Indicators
Florian Legeard C’est à dire sur le prix et non sur le temps ? Merci
Rohit82189 bstrend repaints
Nicolas No, it doesn't repaint.
cfta Hi Fulvio, many thanks for sharing this clever indicator, much appreciated. As Pepsmile ment...
cfta Sorry adding the PRT to code didn't work in the above comment so I guess we will have to set...
juanj Something appears to be wrong with this formula as graphing t shows t to almost never be wit...
Nicolas Apply it on the price chart. The indicator plot just one single line. There are two in the...
jamesoc Hi Nicolas, do you happen to know if there is an indicator that can be applied to charts, to...
gustavobp Buenos dias Nicolas, al agregar tu indicador no me reconoce la variable Price ni en la linea...
Nicolas
7 years ago
Maxime Baudin Interesting, Thank you! :)
franck-david Bonjour Nicolas , actuellement je me forme grace a vos videos tres tres bien expliques mer...
Nicolas Merci. ça n'est pas le lieu pour poser ce genre de question :) Merci d'utiliser le forum Pro...

Top