MT4指标,彩色自动绘制背离MACD---- MACD_Histogram

标签:
股票mt4自定义指标外汇mt4智能交易系统ea |
分类: MT4指标收集 |
有关MACD指标的用法,请百度搜索
http://s16/mw690/001DXNpCgy6SD7CnAXZ9f&690MACD_Histogram" TITLE="MT4指标,彩色自动绘制背离MACD----MACD_Histogram" />
//-----------------------------------------------------
//+------------------------------------------------------------------+
//|
MACD_Histogram.mq4 |
//|
Copyright ?2008, MetaQuotes Software Corp. |
//|
http://www.frankie-prasetio.blogspot.com |
//+------------------------------------------------------------------+
#property copyright "Copyright ?2008, MetaQuotes Software Corp."
#property link
"http://www.frankie-prasetio.blogspot.com"
#property indicator_separate_window
#property indicator_buffers 5
#property indicator_color1 DodgerBlue
#property indicator_color2 Red
#property indicator_color3 Silver
#property indicator_color4 Lime
#property indicator_color5 Red
#property indicator_level1 0
//----
#define arrowsDisplacement 0.0001
//---- input parameters
extern string separator1 = "*** MACD Settings ***";
extern int FastMAPeriod = 12;
extern int SlowMAPeriod = 26;
extern int SignalMAPeriod = 9;
extern string separator2 = "*** Indicator Settings ***";
extern bool
drawIndicatorTrendLines = true;
extern bool drawPriceTrendLines
= true;
extern bool displayAlert =
true;
//---- buffers
double MACDLineBuffer[];
double SignalLineBuffer[];
double HistogramBuffer[];
double bullishDivergence[];
double bearishDivergence[];
//---- variables
double alpha = 0;
double alpha_1 = 0;
//----
static datetime lastAlertTime;
static string
indicatorName;
//+------------------------------------------------------------------+
//| Custom indicator initialization function
|
//+------------------------------------------------------------------+
int init()
{
IndicatorDigits(Digits +
1);
//---- indicators
SetIndexStyle(0,
DRAW_LINE);
SetIndexBuffer(0,
MACDLineBuffer);
SetIndexDrawBegin(0,
SlowMAPeriod);
SetIndexStyle(1,
DRAW_LINE);
SetIndexBuffer(1,
SignalLineBuffer);
SetIndexDrawBegin(1,
SlowMAPeriod + SignalMAPeriod);
SetIndexStyle(2,
DRAW_HISTOGRAM, STYLE_SOLID,2);
SetIndexBuffer(2,
HistogramBuffer);
SetIndexDrawBegin(2,
SlowMAPeriod + SignalMAPeriod);
SetIndexStyle(3,
DRAW_ARROW);
SetIndexArrow(3, 233);
SetIndexBuffer(3,
bullishDivergence);
SetIndexStyle(4,
DRAW_ARROW);
SetIndexArrow(4, 234);
SetIndexBuffer(4,
bearishDivergence);
//---- name for DataWindow and
indicator subwindow label
indicatorName =("MACD(" +
FastMAPeriod+"," + SlowMAPeriod + "," + SignalMAPeriod +
")");
SetIndexLabel(2,
"MACD");
SetIndexLabel(3,
"Signal");
SetIndexLabel(4,
"Histogr");
IndicatorShortName(indicatorName);
//----
alpha = 2.0 / (SignalMAPeriod + 1.0);
alpha_1 = 1.0 - alpha;
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function
|
//+------------------------------------------------------------------+
int deinit()
{
for(int i = ObjectsTotal() -
1; i >= 0; i--)
{
string label = ObjectName(i);
if(StringSubstr(label, 0, 19) != "MACD_DivergenceLine")
continue;
ObjectDelete(label);
http://s16/mw690/001DXNpCgy6SD7CnAXZ9f&690MACD_Histogram" TITLE="MT4指标,彩色自动绘制背离MACD----
//-----------------------------------------------------
//+------------------------------------------------------------------+
//|
//|
//|
//+------------------------------------------------------------------+
#property copyright "Copyright ?2008, MetaQuotes Software Corp."
#property link
#property indicator_separate_window
#property indicator_buffers 5
#property indicator_color1 DodgerBlue
#property indicator_color2 Red
#property indicator_color3 Silver
#property indicator_color4 Lime
#property indicator_color5 Red
#property indicator_level1 0
//----
#define arrowsDisplacement 0.0001
//---- input parameters
extern string separator1 = "*** MACD Settings ***";
extern int FastMAPeriod = 12;
extern int SlowMAPeriod = 26;
extern int SignalMAPeriod = 9;
extern string separator2 = "*** Indicator Settings ***";
extern bool
extern bool
extern bool
//---- buffers
double MACDLineBuffer[];
double SignalLineBuffer[];
double HistogramBuffer[];
double bullishDivergence[];
double bearishDivergence[];
//---- variables
double alpha = 0;
double alpha_1 = 0;
//----
static datetime lastAlertTime;
static string
//+------------------------------------------------------------------+
//| Custom indicator initialization function
//+------------------------------------------------------------------+
int init()
{
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function
//+------------------------------------------------------------------+
int deinit()