Author: Copyright � 2009, Ivan Kornilov. All rights reserved.

This technical indicator is designed to provide visual clarity on market momentum by analyzing the "velocity" and "acceleration" of price movements. Instead of simply looking at where the price is currently located, this tool calculates how fast the price is moving and, more importantly, whether that speed is increasing or decreasing.

Core Methodology

The logic functions through a multi-layered mathematical process:

1. Establishing a Baseline (Moving Average) The script begins by calculating a standard smoothed average of the market price. This serves as the foundation for all subsequent calculations, filtering out minor price flickers to focus on the primary trend.

2. Calculating Velocity (The "Line" Value) By comparing the current baseline against its own values from several steps back in time, the tool determines the rate of change. Think of this as the "speed" of the market—it tells us how much momentum the price has gathered over a specific period.

3. Calculating Acceleration (The First Derivative) The script then performs a second layer of calculation on that velocity. It measures the change in speed. In physics terms, if speed is how fast you are moving, acceleration is whether you are pressing down harder on the gas pedal or hitting the brakes. This identifies shifts in strength before they become obvious in the price chart.

4. The Double Calculation (AOC2) To achieve high stability and reduce false signals, the script applies this logic a second time to the acceleration values. This "double" calculation smoothens the data further, ensuring that only significant, sustained changes in market force are highlighted.

Visual Output and Interpretation

The final result is displayed as a histogram in a separate window at the bottom of your trading platform. The logic uses a secondary smoothing filter to determine the color of the bars:

  • Green Bars: These appear when the calculated momentum is moving upward or strengthening relative to its average. It suggests that the current trend has positive "push."
  • Red Bars: These appear when the momentum is trending downward or losing strength. It indicates that the "force" behind a move is weakening or reversing.

Summary for Traders

Rather than telling you what price is doing, this script tells you what the price wants to do by measuring the underlying physics of the market. By highlighting where acceleration is peaking or fading, it provides a visual cue of momentum shifts, helping users identify potential trend exhaustion or strength.

Indicators Used
Moving average indicatorMoving average indicator
Miscellaneous
Implements a curve of type %1
1 Views
0 Downloads
0 Favorites
AOC2P4N3
//+------------------------------------------------------------------+
//|                                   Copyright © 2010, Ivan Kornilov|
//|                                                       AOCP4N3.mq4|
//+------------------------------------------------------------------+
#property copyright "Copyright © 2009, Ivan Kornilov. All rights reserved."
#property link "excelf@gmail.com"

#property indicator_separate_window 
#property indicator_buffers 2
#property indicator_color1 DarkOliveGreen 
#property indicator_color2 LightCoral    

extern int periodMa=5;
extern int step=8;
extern double speedSens= 1.3;
extern int noiseFilter = 0;

double line[];
double green[];
double red[];
double acceleration[];
double aoc2[];
double ma[];

int step2;
int step3;
int step4;
int step5;
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int init()
  {
   IndicatorBuffers(6);
   SetIndexStyle(0,DRAW_HISTOGRAM,STYLE_SOLID,3);
   SetIndexStyle(1,DRAW_HISTOGRAM,STYLE_SOLID,3);

   SetIndexBuffer(0,green);
   SetIndexBuffer(1,red);

   SetIndexBuffer(2,acceleration);
   SetIndexBuffer(3,ma);
   SetIndexBuffer(4,line);
   SetIndexBuffer(5,aoc2);

   IndicatorDigits(Digits+3);

   SetIndexDrawBegin(0,periodMa*2);
   SetIndexDrawBegin(1,periodMa*2);

   step2 =  step  *  speedSens;
   step3 =  step2 *  speedSens;
   step4 =  step3 *  speedSens;
   step5 =  step4 *  speedSens;

   IndicatorShortName("AOC2P4N3("+periodMa+","+step+","+DoubleToStr(speedSens,2)+","+noiseFilter+")");
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int start()
  {
   int n;
   int i;
   int counted_bars=IndicatorCounted();
   if(counted_bars<0) return(-1);
   if(counted_bars>0) counted_bars--;
   int limit=Bars-counted_bars;
   if(counted_bars==0) limit-=1+MathMax(step,MathMax(MathMax(step2,step3),MathMax(step4,step5)));

   i=limit;
   while(i>=0)
     {
      ma[i]=iMA(NULL,0,periodMa,0,MODE_LWMA,PRICE_TYPICAL,i)/Point;
      line[i]=(5*ma[i]-(ma[i+step]+ma[i+step2]+ma[i+step3]+ma[i+step4]+ma[i+step5]))/5;
      acceleration[i]=(5*line[i]-(line[i+step]+line[i+step2]+line[i+step3]+line[i+step4]+line[i+step5]))/5;
      aoc2[i]=(5*acceleration[i]-(acceleration[i+step]+acceleration[i+step2]+acceleration[i+step3]+acceleration[i+step4]+acceleration[i+step5]))/5;
      i--;
     }

//   i=Bars-IndicatorCounted();
   i=limit;
   while(i>=0)
     {
      double slowingEMA=iMAOnArray(aoc2,Bars,noiseFilter,0,MODE_LWMA,i);
      if(
         slowingEMA>aoc2[i]
         )
        {
         red[i]=aoc2[i];
         green[i]=EMPTY_VALUE;
           } else {
         red[i]=EMPTY_VALUE;
         green[i]=aoc2[i];
        }
      i--;
     }
  }
//+------------------------------------------------------------------+

Comments