Author: ������� ������� (�) 2007
Sem MACD

This tool is designed to provide visual clarity for traders by simplifying complex market momentum data into a clear, actionable signal. Instead of forcing you to interpret the fluctuating lines and overlapping values of a standard MACD (Moving Average Convergence Divergence) indicator, this script distills that information into a binary "Buy" or "Sell" visual cue.

How the Logic Works

The script operates by analyzing two specific components of the MACD indicator simultaneously: the Main Line (which tracks the relationship between two different moving averages) and the Signal Line (which acts as a smoothed average of that main line).

Rather than just showing you these lines, the logic performs a constant comparison between them:

  • The Comparison: The script scans every historical data point on your chart. At each point, it looks at the position of the Main Line relative to the Signal Line.
  • The Signal Generation:
    • When the Main Line falls below the Signal Line, the script identifies this as a specific market condition and marks it with a Crimson visual.
    • When the Main Line stays above the Signal Line, the script marks that period with a LimeGreen visual.

Visual Output

The result is a clean, histogram-style display in a separate window below your price chart. It removes the "noise" of moving averages and provides you with a clear history of market sentiment:

  • Crimson segments represent periods where the momentum is leaning towards a downward trend (potential sell signals).
  • LimeGreen segments represent periods where the momentum is favoring an upward trend (potential buy signals).

By using this logic, you can quickly identify whether the current market trend is bullish or bearish without having to manually interpret the crossing points of technical oscillators.

Indicators Used
MACD Histogram
Miscellaneous
Implements a curve of type %1
19 Views
0 Downloads
0 Favorites
Sem MACD
//+------------------------------------------------------------------+
//|                                  Áîëüøàÿ Êîëëåêöèÿ Ñåìàôîðîâ.mq4 |
//+------------------------------------------------------------------+
#property copyright "Ñåðãååâ Àëåêñåé (ñ) 2007"

#property indicator_separate_window
#property indicator_minimum 0
#property indicator_maximum 1
#property indicator_buffers 2
#property indicator_width1 2
#property indicator_width2 2
#property indicator_color1 Crimson
#property indicator_color2 LimeGreen
#property indicator_style1 STYLE_SOLID
#property indicator_style2 STYLE_SOLID
//---- input parameters
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[];

int init()
{
//---- indicators
	SetIndexStyle(0,DRAW_HISTOGRAM);	SetIndexBuffer(0,ExtMapBuffer1);
	SetIndexStyle(1,DRAW_HISTOGRAM);	SetIndexBuffer(1,ExtMapBuffer2);

   string Name = "MACD("+FastEMA+","+SlowEMA+","+SignalMA+")";
   IndicatorShortName(Name);  

	return(0);
}
int deinit()  { return(0); }

int start()
{
	double macd, macds;
//----

	for (int i = 0; i < Bars; i++)
	{
		ExtMapBuffer1[i]=0;
		ExtMapBuffer2[i]=0;

		macd=iMACD(NULL,0, FastEMA, SlowEMA, SignalMA, Price, MODE_MAIN, i);
		macds=iMACD(NULL,0, FastEMA, SlowEMA, SignalMA, Price, MODE_SIGNAL, i);


		if (macd<macds) ExtMapBuffer1[i] = 1; //ïðîäàåì
		else ExtMapBuffer2[i] = 1; //ïîêóïàåì
      
	}
	return(0);
}
//+------------------------------------------------------------------+

Comments