AcceleratedMA

Download script
Author: when-money-makes-money.com
AcceleratedMA

This tool is designed to provide traders with a visual guide on price movements by creating a modified version of a standard Moving Average. While a traditional moving average simply smooths out price data to show a general trend, this script introduces "acceleration" logic to make the indicator more responsive to current market conditions.

How it Works

The core logic of this indicator relies on combining three distinct types of market data to calculate its final position on your chart:

  • The Foundation (Simple Moving Average): The primary component of the line is a standard moving average. This provides the baseline trend, helping you see whether the overall direction of the market is moving up or down over a specific period.
  • Volatility Measurement: The script incorporates an "Average True Range" calculation. In simple terms, this measures how much the price is swinging or "jumping" in a given timeframe. By including this, the indicator becomes aware of the market's current intensity.
  • Momentum Tracking: Finally, the script integrates a momentum oscillator. This captures the strength and speed of the price movement. It helps determine if the current trend is gaining power or losing steam.

The Resulting Logic

Instead of just following the price blindly, the indicator performs a dynamic calculation: it takes the basic trend and "nudges" it based on a combination of volatility and momentum.

By dividing the momentum factor by 100 and multiplying it by the volatility, the script creates an Accelerated Moving Average. This means that when the market becomes volatile or shows strong momentum, the indicator reacts more quickly to those changes. For the trader, this provides a smoother trend line that is still sensitive enough to highlight significant shifts in market energy faster than a standard moving average would.

Indicators Used
Indicator of the average true rangeCommodity channel indexMoving average indicator
Miscellaneous
Implements a curve of type %1
11 Views
0 Downloads
0 Favorites
AcceleratedMA
//+------------------------------------------------------------------+
//|                                                AcceleratedMA.mq4 |
//|                                       when-money-makes-money.com |
//|                                       when-money-makes-money.com |
//+------------------------------------------------------------------+
#property copyright "when-money-makes-money.com"
#property link      "when-money-makes-money.com"

#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 Red
//---- buffers
double ma[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,ma);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
extern int p=50;
int start()
  {
   int    counted_bars=IndicatorCounted();
//----
   for(int i=Bars-counted_bars-1;i>=0;i--){
      ma[i]=iMA(Symbol(),Period(),p,0,MODE_SMA,PRICE_CLOSE,i)+(iATR(Symbol(),Period(),p,i)*iCCI(Symbol(),Period(),p,PRICE_CLOSE,i)/100);
   }
//----
   return(0);
  }
//+------------------------------------------------------------------+

Comments