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
tradingpro salve io faccio spread trading e volevo sapere come impostare un profitto da chiudere in a...
Nicolas Per favore non fare domande generali, non correlate al post. Usa invece il forum.
Bard Incredible, that is the clearest depiction of the trend I've ever seen Nicolas. (I just chan...
Vonasi Discussion on this indicator/filter can be found here: https://www.prorealcode.com/topic/121...
Appsoluxions Hi Nicolas, do you have the MT4 version of the indicator? I am not sure if these kind of que...
Nicolas Hi, don't have one sorry. But you can still ask for private coding through our programming s...
Appsoluxions Cool. Thanks for the response.
Domenec Claro Juanjo de todas maneras en deinversoratrader.com tienes estsos osciladores evolucionad...
Dron Hola Domenec, en la descripción hablas del indicador velas de colores, no lo encuentro en la...
Domenec Hola Dron mira en el blog deinversoratrader.com en formacion indicadores ahi hay varios grat...
rama I want to use this indicator in trading system, it says zig zag is obsolete and not supported
Nicolas Right, due to its repainting behavior, the zigzag is not allowed in automated trading with r...
rama I noticed it changes as time progress, I am 7 as the average, how many period it wont chang...
Gordon101 Hi when I added your Guppy indicator to my chart it went below the chart beside the oscilla...
Nicolas Add it on the price by using the wrench located on the left upper side of your price chart.
Gordon101 Thanks Nicolas, worked a treat.
Geronima Ortiz I watched the video three times, but I can not put the npips parameter as a variable. I do...
Geronima Ortiz I think the video is for an old version of prorealtime, the images do not correspond at all ...
Nicolas indicator1 = CALL “PRC_StopReversal”[npips, 1] and define npips in the optimization window ...
Rafa And the PriceMAPeriod? aren´t the same?
Nicolas The PriceMAPeriod is the period to make the average of all the last X medianprice found.
Rafa Thanks a lot Nicolás. Have a nice day
Caribeengeek Bonjour j’avais vu que vous proposiez d’écrire des codes pour ceux qui s’y connaisse pas Mai...
Caribeengeek Les devises unité
Nicolas Merci d'utiliser le forum pour les demandes de programmation personnalisée
ullle73 nicolas, can you somehome make this to be in the background of the price chart?
jonpt88 none did that yet right?
Nicolas You can ask for a code modification on forums, please open a new topic with your request.
Toto le Heros Thanks Nicolas. I read somewhere that in the calculation, we should round the value of the A...
Nicolas aADX = round(adx[10])
bolsatrilera
7 years ago
Rainbow Oscillator
Rainbow Oscillator
1
Indicators
Maxime Baudin Interesting, thanks! Combine this indicator with the bollinger bands there is enough to make...
ak5hay2 Works like crazy on bitcoin. Use different timeframes. Thanks a lot Doc!!!
richyowen Hi, great code thanks. Very new to this forum. Is there a way to add a 100point target on an...
lisamitch50 Morning all, Just backtested on quite a few instruments, worked well on backtesting, but tel...
supertiti Bonsoir à tous For those who like me want to calibrate this indicator on a scale of 0 to ...
verdi55 You can find me at www.FXautomate.com Ahh. So i got it ? 4 different supertrends without th...
juanj What? This has nothing to do with the website. The site is simply a service to help people ...
Nicolas Advertising is allowed,as long as people are helping others and if provided services are abo...
styrke Hello Nicolas, Nice screener, I appreciate the way you always try to condense at maximum th...
Nicolas There's no particular reason. RSI is widely use with its default period and results seems re...
Vonasi I noticed a couple of typo errors in the code. The list of variables lines 4 to 11 should be...
Genotik Thank you for your important contribution this week which is much appreciated! Happy New Yea...
Vonasi No problem. I hope they are useful to someone. Happy and hopefully prosperous New Year to y...

Top