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
DarioMazza Hi Vonasi, i have a question for you, the comand "pricetype" where did you found it in the ...
Vonasi PriceType is just a variable that I use. The value decides what type of price is used in the...
Vonasi I noticed a couple of typo errors in the code. The list of variables lines 4 to 11 should be...
swapping merci gabri, on va le mettre à l'essai ;)
Nicolas
7 years ago
Trinity Impulse
Trinity Impulse
5
Indicators
ribou ah d'accord merci beaucoup
domenico nlevel1 non modifica la curva al variare del suo valore
tiger_man_no1 Very nice ; what is the best period input date for DAILY CHART ?
Nicolas
7 years ago
Genotik Merci !
WarningTrading Comment peut on la comparer ? comme ceci ? cela ne me donne plus le message d'erreur manque...
sally31120 Bonjour, je n'arrive pas à créer ce screener close > supertrend extended2[1] la réponse...
Nicolas voir ce sujet pour un screener basé sur Supertrend Extended: https://www.prorealcode.com/top...
Marcel For those who are interested, I post trade opportunities with this indicator on Twitter. (@M...
swapping Thank you for sharing, best regards
Tellie2015 tack ska du ha för dina delningar både här o twitter
Leo Hi all, I posted a new version of this indicator ( I just add arrows to spot the local maxi...
Trading_En_El_Ibex35 Muchas Gracias por compartir este interesante indicador. Un saludo
xavieralava hola gracias leo
Nicolas
8 years ago
Nicolas https://www.prorealcode.com/topic/ayuda-screener-indicador-perfect-trend-line/#post-51291
Manu L. Bonjour Nicolas, suite a une de mes precedentes demande dans le forum indicateur, j'ai touv...
AntoGH C'est selon moi le meilleur indicateur, que j'ai vu, si vous trouvez mieux dîtes moi car dif...
Jiacky mma = average[per,1](close) should be mma = average[per,1](close * 1000). Otherwise TDF will...
bolsatrilera Hi Nicolas, I have this version of the True Balance Power ,created by eykpunter on Tradingvi...
bolsatrilera and the code : REM TRUE BALANCE OF POWER // código original de eykpunter para la plataform...
Steven Bahia Hi Nicolas - great indicator - is there a way to place a alert when the Oscillator crosses ...
Nicolas Alerts can't be programmed, you have to set them yourself with the Alert tool of the platfor...
Steven Bahia just to add to this would there be a way to establish a entry price from the Oscillator
Khaled Thanks, but if I may ask what's EMA Period? The price which reverses the EMA[20] is not the ...
Francesco78 EMA is not a moving average, it is just the name we called the quantity defined above
Khaled My bad. Thank you so much!
juanj And the point of violation is the close of the candle that violates the line by generating a...
juanj For the latest version of the strategy or to follow updates and developments see the thread ...
phanz i backtested it with 10K units of EURUSD 1 hour i get an equity curve that is going one way ...
Wing Not yet but I plan to.
Leo Have a look in this Forum, I got something interesting for you... https://www.prorealcode.co...
Dávid Gyalus Dear Wing, As I am a daytrader, and one of my best friend is a programmer we think your a...
EchnatonX Hallo Im Demomodus bei IG habe ich das Problem, dass oft keine Orders ausgeführt werden kön...
Jan EchnatonX, nice late answer of me: Make the stop loss a percentage of the close, like 100/...
guleny Hello I made some optimization to make it better. But there are 5 transacttion which incr...
rejo007 hello david, i'll try it could you tell me wich strategy do you use in real? thanks
David Somogyi Hello, I have a couple of DAX strategies of breakout and mean reversion. I'll try to post...
Roberto Blázquez Hi David, I just saw your strategy and it's good!!! I'm going to try it from today in real a...
Thomas007 Is there any way to build something similar for FX? I wonder what would be the replacement f...
stratobast Good afternoon everyone. Thanks Doctrading for your work. I have an issue while using this ...
stratobast My bad guys. I understood what was the problem. The indicator uses highs and lows for the Re...
samwarduk Has anyone tried this on Bitcoin GBP1? The results look amazing but every time mine trie...

Top