Cronex_Impulse_CD
Download scriptThe Cronex Impulse CD is a technical analysis tool designed to provide traders with a visual representation of market momentum and price deviations. It operates by comparing different types of moving averages to identify whether the current price action is gaining strength or showing signs of exhaustion.
Core Logic Overview
The script functions by calculating three distinct components that work together to reveal the underlying "impulse" of the market:
1. The Impulse MACD (Primary Momentum) Unlike a standard MACD which often looks at simple price averages, this indicator identifies extreme price boundaries. It tracks:
- The smoothed average of the market's highs.
- The smoothed average of the market's lows.
- A weighted average of the current price.
The tool compares the current price weight against these highs and lows. If the weighted price exceeds the high boundary, it captures that upward momentum; if it falls below the low boundary, it captures the downward momentum. This creates a "histogram" that represents how far the price is pushing beyond its normal boundaries.
2. The Signal Line (Smoothing) To filter out minor market "noise" and identify the primary trend of the impulse, the script takes the data from the Impulse MACD and runs it through another smoothing process. This creates a "Signal Line." Think of this as the baseline; it represents the average direction of the momentum over a set period.
3. The Impulse CD (Convergence/Divergence) The final component—the "CD" value—is calculated by measuring the gap between the Impulse MACD and its Signal Line.
- When the impulse and the signal line are moving in tandem, the gap is small.
- When the impulse pulls significantly away from the signal line, it indicates a strong, active move (an "impulse").
- When the gap begins to shrink or change direction while price movement slows, it can alert the user to potential shifts in momentum.
Visual Representation
On your chart, these calculations are displayed as histograms in a separate window below the price action:
- Impulse MACD: Shows the raw strength of the current price move relative to its boundaries.
- Impulse CD: Shows the difference between that momentum and its moving average, helping traders visualize the "stretch" of the market movement.
By observing these three elements together, a trader can better understand if a trend is healthy, accelerating, or beginning to lose steam.
//+------------------------------------------------------------------+
//| Cronex Impulse CD.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 3
#property indicator_color1 SteelBlue
#property indicator_color2 DarkOrange
#property indicator_color3 DarkOrange
//---- indicator parameters
extern int SlowMA=34;
extern int FastMA=14;
extern int SignalMA=9;
//---- indicator buffers
double MacdDivrBuffer[];
double SignalBuffer[];
double CDDivrBuffer[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicator buffers mapping
SetIndexBuffer(0,MacdDivrBuffer);
SetIndexBuffer(1,SignalBuffer);
SetIndexBuffer(2,CDDivrBuffer);
//---- drawing settings
SetIndexStyle(0,DRAW_HISTOGRAM);
SetIndexStyle(1,DRAW_NONE);
SetIndexStyle(2,DRAW_HISTOGRAM);
SetIndexEmptyValue(0,0) ;
SetIndexEmptyValue(1,0) ;
SetIndexEmptyValue(2,0) ;
IndicatorDigits(Digits);
//---- name for DataWindow and indicator subwindow label
IndicatorShortName("Cronex Impulse CD("+SlowMA+","+FastMA+","+SignalMA+")");
SetIndexLabel(0,"Impulse MACD");
SetIndexLabel(1,"Signal");
SetIndexLabel(2,"Impulse CD");
//---- 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,SlowMA,0,MODE_SMMA,PRICE_HIGH,i);
LoInd=iMA(NULL,0,SlowMA,0,MODE_SMMA,PRICE_LOW,i);
MasterInd=iMA(NULL,0,FastMA,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);
for(i=0; i<limit; i++)
CDDivrBuffer[i]=MacdDivrBuffer[i]-SignalBuffer[i];
//---- done
return(0);
}
//+------------------------------------------------------------------+
Comments