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
Screw27 Salut nicolas j'aimerais savoir tes résulats grace a cettte methode
eva.g.forsgren It dose not work, I get a strap instead of candels???????????????????????????????????????????
Nicolas That indicator is the one below the chart. The indicator to put on the price chart is this o...
pyhrus P.S : IG , que j'ai contacté ,m'indique que la version V11 , ne sera pas disponible avant un...
Hasardeur Dear Nicolas, is there someting at the arry to modify in order to run the trend at the actu...
MALIMALO Dear Nicolas, just try touse your indicator with backtest but it's not working. is anybody...
ribes65 Bonjour Nicolas, Merci pour votre travail. Est-il envisageable de créer un screener pour ...
Nicolas Bien sûr, merci de formuler une demande dans le forum des screeners pour prorealtime. En res...
ipbvba Est il possible de le transformer en indicateur (pour ne plus avoir les lignes mais uniqueme...
supertiti Bonjour Nicolas, Je ne comprend pas bien , le trend change de couleur quand les prix sont a...
Nicolas Oui ce serait possible, cependant l'indicateur est bien prévu pour conserver la couleur de l...
supertiti Quand tu pourras si tu peux nous coder la troisième couleur cela améliorerait les trades cou...
Nicolas How to import file page: in the help section of the website explains howto
kenssa import through the indicator page/window in the Proreal time
chicoteca Buenas, no consigo que se me muestre en el chart de DAX. ¿Cómo procedo? Gracias.-
Ciccarelli Franco Per lasciare che la strategia venga eseguita (dopo aver importato il file): Basta eliminare...
JADINVEST Hello Jan, hello everyone, Thanks Jan for this strategy! Since 2020, have any of you found a...
Alessandro Furlani Hi Ian, hope you still use PRT and so you can read this post. I have tested a lot your work ...
Stockastiss Can this code be simply transferred into Backtestingcode so one doesnt need to use call ? (i...
Vonasi Sorry for the late reply. Add the code to your strategy and remove line 5 and line 39. Chang...
viktorthunss Hi! How many averages are there? Can I see the somewhere?
FXmike hey my friends, thank you for this great code. my problem is he make no trade open. backtest...
FXmike Can i put a Action that my start contract is smaller than 1 ? 0.3 or 0.5 ? In wich Position...
phoentzs I wrote the code for M15 back then and also variants in H1 and M1. Everything works so far....
leofi https://www.prorealcode.com/topic/simple-average-with-visual-color/
leofi Go visit www.prorealcode.com/topic/simple-average-with-visual-color/ and watch 2em post
Dritan Hi,I am new on Prorealtime and coding.I downloaded the indi but I have it on a separate wind...
Alps007 Hi Nicolas. Happy New Year. Can you please program me several MACD divergence screeners ...
Arlei Zanin Hello Nicolas, would it be possible to convert the Cloud to Pascal language? Thank you.
ashee i want it in MT4
Marie-Eve Vergoz Bonsoir - Voici l'erreur qui est signalée lorsque je souhaite utiliser cet indicateur : il...
Nicolas Just add it on the price series.
yomisadiku Hello Nicolas, Can I use high and low price at lines hh=max(hh,close) and ll=min(ll,close) ...
Nicolas Yes you can do that, the impact will be that the trailing stop line will be much close to th...
Byggtrader Hi Nicolas! How do I get the indicator in the price chart? It only stays under i new chart.
Nicolas Just add it on the price chart by using the wrench on the left upper side of the chart (pric...
Dom Hello, hello....je commence le trading et découvre par la même occasion le codage....et ce n...
Nicolas Merci, ça fait plaisir !
Be-n Bonjour tout le monde ! Dans l'indicateur de tendance, j'ai du mal à saisir la nuance entre ...
Vonasi Sure that is possible. I will code it and make a post in the English ProBuilder forum and pu...
Vonasi Vama v2 with Hull moving average included can be found here: https://www.prorealcode.com/top...
JMat45 Thank you, Vonasi.
Globalmarkets79 Thank you Vonasi for the answer. I have an other question. When i tried to run the indicator...
Vonasi Lines is either 0 or 1 to turn on or off the drawing of them. Once again if you download and...
Globalmarkets79 Thank you Vonasi, this indicator is very helpful!!!
Nicolas
6 years ago
Bateson Merci pour la réponse Nicolas. C'est bien ce que j'ai fait mais ça ne fonctionne toujours pa...
Enzo Paliotti Veramente ottimo, era quello che cercavo, si potrebbe modificare inserendo come variazione a...
Nicolas Perché no, chiedetelo con una descrizione dettagliata nel forum degli indicatori, per favore!
Nicolas
6 years ago
LRMA
LRMA
0
Indicators
jiddan78 how to convert to afl amibroker ?
Nicolas We do not supply free coding assistance for AFL Amibroker on the website. You can ask for pa...
Ngomsi @ Vonasi, how to use timeframe , 13 minutes ,21 minutes, 34 minutes,et 55 minutes with this...
manchokcity can we have it in mql4 platform? or how or which platform do we use it?
camporan I don't use MetaTrader so I won't be able to do the translation myself. Sorry!
Alexander9 This can for amibroker ? . Thanks

Top