|
3#
楼主 |
发表于 2009-12-29 10:47:07
|
只看该作者
其实只是雕虫小技,见笑了。
#property indicator_separate_window
#property indicator_buffers 4
#property indicator_color1 0X13DBA5
#property indicator_color2 0XCA9A66
#property indicator_color3 0X1A18B1
#property indicator_color4 0X5644BC
#property indicator_width1 6
#property indicator_width2 4
#property indicator_width3 3
#property indicator_width4 2
//计算数据组数量
double Hind_buf_01[];
double Hind_buf_02[];
double Hind_buf_03[];
double Hind_buf_04[];
int init() {
IndicatorBuffers(8);
SetIndexDrawBegin(5, 9);
IndicatorDigits(Digits + 2);
SetIndexStyle(0, DRAW_LINE);
SetIndexBuffer(0, Hind_buf_01);
SetIndexStyle(1, DRAW_LINE);
SetIndexBuffer(1, Hind_buf_02);
SetIndexStyle(2, DRAW_LINE);
SetIndexBuffer(2, Hind_buf_03);
SetIndexStyle(3, DRAW_LINE);
SetIndexBuffer(3, Hind_buf_04);
return (0);
}
int start() {
int ID = 0;
int ID_M5 = 0;
for (ID =0 ; ID < Bars; ID++)
{
if(ID ==0 ){
ID_M5 = 0;
Hind_buf_01[ID]=iMACD(NULL,PERIOD_M5,12,26,9,PRICE_CLOSE,MODE_SIGNAL,ID_M5);
Hind_buf_02[ID]=iMACD(NULL,PERIOD_M5,12,26,9,PRICE_CLOSE,MODE_MAIN,ID_M5);
}
else if(MathMod(TimeMinute(Time[ID+1]),5)>MathMod(TimeMinute(Time[ID]),5)){
ID_M5++;
Hind_buf_01[ID]=iMACD(NULL,PERIOD_M5,12,26,9,PRICE_CLOSE,MODE_SIGNAL,ID_M5);
Hind_buf_02[ID]=iMACD(NULL,PERIOD_M5,12,26,9,PRICE_CLOSE,MODE_MAIN,ID_M5);}
else {
Hind_buf_01[ID]=Hind_buf_01[ID-1];
Hind_buf_02[ID]=Hind_buf_02[ID-1]; }
Hind_buf_03[ID]=iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_SIGNAL,ID);
Hind_buf_04[ID]=iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_MAIN,ID);}
return (0);
} |
|