Impulse MACD

Impulse MACD

This indicator is designed to help traders identify significant price momentum and "impulses" by analyzing the relationship between different types of moving averages. Unlike standard oscillators that simply track price trends, this tool looks for specific deviations where price action pushes beyond established boundaries.

How the Logic Works

The core functionality of the script relies on three distinct calculations performed simultaneously to determine market strength:

1. Establishing Price Boundaries The script first identifies two different types of "price ceilings" and "floors":

  • It calculates a smoothed average based on the highest prices reached over a set period.
  • It simultaneously calculates a smoothed average based on the lowest prices reached over that same period.

2. Identifying the Impulse The indicator then creates a third, primary "Master" average. This master average is calculated using a weighted method, which gives more importance to recent price movements. The script compares this Master average against the high and low boundaries:

  • If the Master average rises above the high boundary, it indicates an upward impulse.
  • If the Master average falls below the low boundary, it indicates a downward impulse.

The difference between these values is plotted as a histogram. When the histogram expands, it signals that the market is moving with significant strength in one direction; when it contracts, it suggests the momentum is fading.

3. The Signal Smoothing To make this data easier to read and to filter out minor market "noise," the script applies a secondary smoothing layer over the impulse data. This creates a trend line (the Signal Line).

How to Interpret the Results

The visual output provides two primary pieces of information:

  • The Histogram: Represents the raw intensity of the current price impulse. It shows you how far the market is deviating from its normal range.
  • The Signal Line: Acts as a guide for the overall direction of that impulse. By observing the relationship between the histogram and this line, traders can better identify when a move is gaining strength or starting to exhaust itself.
Indicators Used
Moving average indicatorMoving average indicator
Miscellaneous
Implements a curve of type %1
15 Views
0 Downloads
0 Favorites
Impulse MACD
//+------------------------------------------------------------------+
//|                                          Cronex Impulse MACD.mq4 |
//|                                        Copyright © 2007, Cronex. |
//|                                       http://www.metaquotes.net/ |
//+------------------------------------------------------------------+
#property  copyright "Copyright © 2008, Cronex"
#property  link      "http://www.metaquotes.net/"
//---- indicator settings
#property  indicator_separate_window
#property  indicator_buffers 2
#property  indicator_color1  SteelBlue
#property  indicator_color2  DarkOrange

//---- indicator parameters
extern int MasterMA=34;
extern int SignalMA=9;
//---- indicator buffers

double     MacdDivrBuffer[];
double     SignalBuffer[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
  
  //---- indicator buffers mapping
   SetIndexBuffer(0,MacdDivrBuffer);
   SetIndexBuffer(1,SignalBuffer);  
//---- drawing settings
 
   SetIndexStyle(0,DRAW_HISTOGRAM);   
   SetIndexStyle(1,DRAW_LINE);   
   
   SetIndexEmptyValue(0,0) ;
   IndicatorDigits(Digits+1);

//---- name for DataWindow and indicator subwindow label
   IndicatorShortName("Impulce MACD("+MasterMA+","+SignalMA+")");
   SetIndexLabel(0,"Impulce MACD");
   SetIndexLabel(1,"Signal");
//---- initialization done
   return(0);
  }
//+------------------------------------------------------------------+
//| Moving Averages Convergence/Divergence                           |
//+------------------------------------------------------------------+
int start()
  {
   int limit;
   int counted_bars=IndicatorCounted();
   double HiInd,LoInd,MasterInd;
//---- last counted bar will be recounted
   if(counted_bars>0) counted_bars--;
   limit=Bars-counted_bars;
//---- macd counted in the 1-st buffer
   for(int i=0; i<limit; i++)
    {
     HiInd=iMA(NULL,0,MasterMA,0,MODE_SMMA,PRICE_HIGH,i);
     LoInd=iMA(NULL,0,MasterMA,0,MODE_SMMA,PRICE_LOW,i);
     MasterInd=iMA(NULL,0,MasterMA,0,MODE_LWMA,PRICE_WEIGHTED,i);

     if(MasterInd>HiInd)
      MacdDivrBuffer[i]=MasterInd-HiInd;
      
     if(MasterInd<LoInd)
      MacdDivrBuffer[i]=MasterInd-LoInd;  
    }
//---- signal line counted in the 2-nd buffer
   for(i=0; i<limit; i++)
       SignalBuffer[i]=iMAOnArray(MacdDivrBuffer,Bars,SignalMA,0,MODE_SMA,i);
//---- done
   return(0);
  }
//+------------------------------------------------------------------+

Comments