双线双色MACD指标
//+------------------------------------------------------------------+
//| MACD_color_new.mq4 |
//| Copyright @2004, MetaQuotes Software Corp. |
//+------------------------------------------------------------------+
#property copyright "下载更多外汇EA,外汇指标,交易系统,就到【外汇EA之家】"
#property link "http://www.eazhijia.com"
#propertyindicator_separate_window
#propertyindicator_buffers 6
#propertyindicator_color1Red
#propertyindicator_color2LimeGreen
#propertyindicator_color3Red
#propertyindicator_color4LimeGreen
#propertyindicator_color5Blue
#propertyindicator_color6Yellow
#propertyindicator_level10
extern int FastEMA=12;
extern int SlowEMA=26;
extern int SignalSMA=9;
double ind_buffer1[];
double ind_buffer2[];
double ind_buffer1b[];
double ind_buffer2b[];
double ind_buffer3[];
double ind_buffer4[];
double b;
int init() {
SetIndexStyle(0,DRAW_HISTOGRAM,STYLE_SOLID,2,indicator_color1);
SetIndexStyle(1,DRAW_HISTOGRAM,STYLE_SOLID,2,indicator_color2);
SetIndexStyle(2,DRAW_HISTOGRAM,STYLE_SOLID,2,indicator_color3);
SetIndexStyle(3,DRAW_HISTOGRAM,STYLE_SOLID,2,indicator_color4);
SetIndexStyle(4,DRAW_LINE,EMPTY,1,indicator_color5);
SetIndexStyle(5,DRAW_LINE,EMPTY,1,indicator_color6);
SetIndexBuffer(0,ind_buffer1);
SetIndexBuffer(1,ind_buffer2);
SetIndexBuffer(2,ind_buffer1b);
SetIndexBuffer(3,ind_buffer2b);
SetIndexBuffer(4,ind_buffer3);
SetIndexBuffer(5,ind_buffer4);
IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS)+1);
Comment("www.eazhijia.com");
return(0);
}
int start(){
int limit;
int counted_bars=IndicatorCounted();
if(counted_bars<0) return(-1);
if(counted_bars>0) counted_bars--;
limit=Bars-counted_bars;
for(int i=limit; i>=0; i--) {
b = iMA(NULL,0,FastEMA,0,MODE_EMA,PRICE_CLOSE,i)-iMA(NULL,0,SlowEMA,0,MODE_EMA,PRICE_CLOSE,i);
ind_buffer1=iMA(NULL,0,FastEMA,0,MODE_EMA,PRICE_CLOSE,i)-iMA(NULL,0,SlowEMA,0,MODE_EMA,PRICE_CLOSE,i);
clearBuffers(i);
if (b < 0 ) {
if (b > b) {
ind_buffer1 = b;
ind_buffer1b = 0;
} else if (b < b) {
ind_buffer1b = b;
ind_buffer1 = 0;
}
} else if (b > 0) {
if (b < b) {
ind_buffer2 = b;
ind_buffer2b = 0;
} else if (b > b) {
ind_buffer2b = b;
ind_buffer2 = 0;
}
}
ind_buffer3=iMA(NULL,0,FastEMA,0,MODE_EMA,PRICE_CLOSE,i)-iMA(NULL,0,SlowEMA,0,MODE_EMA,PRICE_CLOSE,i);
}
for(i=0; i<limit; i++) {
ind_buffer4=iMAOnArray(ind_buffer3,Bars,SignalSMA,0,MODE_SMA,i);
}
return(0);
}
void clearBuffers (int i) {
ind_buffer1 = NULL;
ind_buffer1b = NULL;
ind_buffer2 = NULL;
ind_buffer2b = NULL;
}
我非了几天才改好,没想到大神早就有了。现在弄成单线双色了 这个指标好用 运行报错啊,真是郁闷了 我是来刷分的,嘿嘿 谢谢楼主,共同发展 MQ4怎么转换成EX4文件啊。。。。。。 {:1_181:}{:1_181:}{:1_181:}{:1_181:}{:1_181:}{:1_181:} 学习了,不错 顶下
页:
[1]
2