This custom trading indicator, named "Chaikin," is designed to provide traders with a visual representation of market momentum and volume flow. By analyzing the relationship between price action and trading volume, it helps identify underlying trends that might not be immediately obvious from looking at price charts alone.
How the Logic Works
The indicator operates through a multi-layered calculation process to smooth out market "noise" and highlight significant movements:
1. Volume Tracking (OBV) At its core, the script begins by calculating the On-Balance Volume (OBV). This tracks the cumulative total of volume traded, weighted by price movement. Essentially, it identifies whether buying pressure or selling pressure is dominating the market over a specific period.
2. Smoothing the Data Because raw volume data can be very volatile and jagged, the script applies two different types of moving averages to this volume data:
- The Primary Signal: A longer-term average that represents the broader trend of the volume flow.
- The Fast Signal: A shorter-term average that reacts more quickly to immediate changes in market activity.
3. Generating the Final Output The final line you see on your trading chart is produced by subtracting the primary signal from the raw volume data. This creates a "differential" value.
What This Tells the Trader
Instead of just showing you how much volume occurred, this logic highlights the divergence between current volume and its historical average.
- When the indicator line moves significantly above or below its baseline, it suggests that the current trading intensity is deviating from the norm.
- By comparing these movements, traders can better understand whether a price move is being backed by strong, healthy volume (confirming a trend) or if the price is moving on "thin" volume (which may indicate a potential reversal).
In summary, this tool transforms raw volume into a smoother, more readable oscillator that helps you gauge the strength behind market trends.
//+------------------------------------------------------------------+
//| Chaikin.mq4 |
//| Copyright © 2006, Yury V. Reshetov |
//| http://www.metaquotes.net/ |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, Yury V. Reshetov ICQ: 282715499"
#property link "http://antigedel.boom.ru/"
//---- indicator settings
#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 Silver
//---- indicator parameters
extern int FastEMA=12;
extern int SlowEMA=26;
extern int SignalSMA=9;
//---- indicator buffers
double ind_buffer1[];
double ind_buffer2[];
double ind_buffer3[];
double ind_buffer4[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- 2 additional buffers are used for counting.
IndicatorBuffers(4);
//---- drawing settings
SetIndexStyle(0,DRAW_LINE);
SetIndexDrawBegin(0,SignalSMA);
IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS)+2);
//---- 3 indicator buffers mapping
if(!SetIndexBuffer(0,ind_buffer1) &&
!SetIndexBuffer(1,ind_buffer2) &&
!SetIndexBuffer(3,ind_buffer4) &&
!SetIndexBuffer(2,ind_buffer3))
Print("cannot set indicator buffers!");
//---- name for DataWindow and indicator subwindow label
IndicatorShortName("Chaikin");
//---- initialization done
return(0);
}
//+------------------------------------------------------------------+
//| Moving Average of Oscillator |
//+------------------------------------------------------------------+
int start()
{
int limit;
int counted_bars=IndicatorCounted();
//---- check for possible errors
if(counted_bars<0) return(-1);
//---- last counted bar will be recounted
if(counted_bars>0) counted_bars--;
limit=Bars-counted_bars;
//---- macd counted in the 1-st additional buffer
for(int i=0; i<limit; i++)
ind_buffer2[i]=iOBV(NULL, 0, PRICE_CLOSE, i);
//---- signal line counted in the 2-nd additional buffer
for(i=0; i<limit; i++) {
ind_buffer3[i]=iMAOnArray(ind_buffer2,Bars,10,0,MODE_SMA,i);
ind_buffer4[i]=iMAOnArray(ind_buffer2,Bars,3,0,MODE_SMA,i);
}
//---- main loop
for(i=0; i<limit; i++)
ind_buffer1[i]=ind_buffer2[i]-ind_buffer3[i];
//---- done
return(0);
}
//+------------------------------------------------------------------+
Comments