附图的黄粗线代表 柱状线面积 ,很好用的背离指标。就是不知道怎么改报警。
源码附上
#property indicator_separate_window
#property indicator_buffers 5
#property indicator_color1 Red
#property indicator_color2 Blue
#property indicator_color3 Fuchsia
#property indicator_color4 Aqua
#property indicator_color5 Yellow
extern int FastEMA = 12;
extern int SlowEMA = 26;
extern int SignalEMA = 9;
double Gda_88[];
double Gda_92[];
double Gda_96[];
double Gda_100[];
double Gda_104[];
int Gi_108 = 0;
int init() {
SetIndexStyle(0, DRAW_LINE);
SetIndexBuffer(0, Gda_88);
SetIndexStyle(1, DRAW_LINE);
SetIndexBuffer(1, Gda_92);
SetIndexStyle(2, DRAW_HISTOGRAM);
SetIndexBuffer(2, Gda_96);
SetIndexStyle(3, DRAW_HISTOGRAM);
SetIndexBuffer(3, Gda_100);
SetIndexStyle(4, DRAW_LINE);
SetIndexBuffer(4, Gda_104);
IndicatorShortName("Zen_MACD(" + FastEMA + "," + SlowEMA + "," + SignalEMA + ")");
SetIndexLabel(0, "DIFF");
SetIndexLabel(1, "DEA");
SetIndexLabel(2, "MACD");
SetIndexLabel(3, "MACD");
SetIndexLabel(4, "面积");
return (0);
}
int deinit() {
return (0);
}
int start() {
double Ld_16;
int Li_8 = IndicatorCounted();
double Ld_24 = 0;
if (Li_8 > 0) Li_8--;
int Li_0 = Bars - Li_8;
for (int Li_12 = 0; Li_12 = 0; Li_12--) {
Gda_92[Li_12] = iMAOnArray(Gda_88, Bars, SignalEMA, 0, MODE_EMA, Li_12);
Gda_96[Li_12] = EMPTY_VALUE;
Gda_100[Li_12] = EMPTY_VALUE;
Ld_16 = 2.0 * (Gda_88[Li_12] - Gda_92[Li_12]);
if (Ld_16 > 0.0) Gda_96[Li_12] = Ld_16;
else Gda_100[Li_12] = Ld_16;
if (Ld_16 * Ld_24 > 0.0) Ld_24 += Ld_16;
else Ld_24 = Ld_16;
Gda_104[Li_12] = Ld_24 / 10.0;
}
return (0);
}
|