Sem MACD+CCI
Download scriptThis tool is designed to act as a visual trend and momentum analyzer for traders. It operates by synthesizing two well-known technical indicators—the MACD (Moving Average Convergence Divergence) and the CCI (Commodity Channel Index)—to identify specific market conditions at a glance.
Instead of showing complex wavy lines, this script translates mathematical data into a simplified color-coded histogram. The logic works by evaluating the relationship between these two indicators to categorize the market into four distinct states:
How the Logic Works
The script constantly monitors the current price movement and compares it against historical averages. It looks for specific "coincidences" between momentum (MACD) and relative strength (CCI):
- Bullish Strength (Green): The tool identifies a positive trend when the MACD's main momentum is rising above its signal line while the CCI is in positive territory. This suggests a strong upward movement.
- Bullish Caution (Green): The tool highlights a different type of upward trend where the MACD shows positive momentum, but the CCI has dipped into negative territory.
- Bearish Strength (Red): The tool identifies a downward trend when the MACD's momentum falls below its signal line while the CCI is also in negative territory, suggesting heavy selling pressure.
- Bearish Caution (Red): The tool highlights a downward trend where the MACD is falling below the signal line, but the CCI remains in positive territory.
Visual Interpretation
By combining these two data points, the script removes much of the "noise" from the market. Rather than forcing you to interpret multiple overlapping lines, it provides a direct visual cue:
- Green Histograms indicate various forms of upward price pressure.
- Red Histograms indicate various forms of downward price pressure.
This allows a user to quickly see whether the current market environment is favoring buyers or sellers based on a dual-confirmation logic, making it easier to spot potential trend shifts in real-time.
//+------------------------------------------------------------------+
//| Áîëüøàÿ Êîëëåêöèÿ Ñåìàôîðîâ.mq4 |
//+------------------------------------------------------------------+
#property copyright "Ñåðãååâ Àëåêñåé (ñ) 2007"
#property indicator_separate_window
#property indicator_minimum 0
#property indicator_maximum 1
#property indicator_buffers 4
#property indicator_color1 LimeGreen
#property indicator_color2 LimeGreen
#property indicator_color3 Crimson
#property indicator_color4 Crimson
#property indicator_width1 2
#property indicator_width2 1
#property indicator_width3 2
#property indicator_width4 1
#property indicator_style1 STYLE_SOLID
#property indicator_style2 STYLE_SOLID
#property indicator_style3 STYLE_SOLID
#property indicator_style4 STYLE_SOLID
extern int FastEMA=8;
extern int SlowEMA=12;
extern int SignalMA=3;
extern int Price=PRICE_CLOSE;//0-close, 1-open, 2-high, 3-low, 4-median, 5-typic, 6-wieight
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
double ExtMapBuffer4[];
int init()
{
SetIndexStyle(0,DRAW_HISTOGRAM); SetIndexBuffer(0,ExtMapBuffer1);
SetIndexStyle(1,DRAW_HISTOGRAM); SetIndexBuffer(1,ExtMapBuffer2);
SetIndexStyle(2,DRAW_HISTOGRAM); SetIndexBuffer(2,ExtMapBuffer3);
SetIndexStyle(3,DRAW_HISTOGRAM); SetIndexBuffer(3,ExtMapBuffer4);
IndicatorShortName("MACD+CCI");
return(0);
}
int deinit() { return(0); }
int start()
{
double macdM, macdS, cci;
int i;
for ( i = 0; i <=Bars; i++ )
{
ExtMapBuffer1[i]=0; ExtMapBuffer2[i]=0; ExtMapBuffer3[i]=0; ExtMapBuffer4[i]=0;
macdM=iMACD(NULL,0, FastEMA, SlowEMA, SignalMA, Price, MODE_MAIN, i);
macdS=iMACD(NULL,0, FastEMA, SlowEMA, SignalMA, Price, MODE_SIGNAL, i);
cci = iCCI(NULL,0,12,PRICE_CLOSE,i) ;
if (macdM>macdS && cci>0) ExtMapBuffer1[i] = 1;
if (macdM>macdS && cci<0) ExtMapBuffer2[i] = 1;
if (macdM<macdS && cci<0) ExtMapBuffer3[i] = 1;
if (macdM<macdS && cci>0) ExtMapBuffer4[i] = 1;
}
return(0);
}
//+------------------------------------------------------------------+
Comments