# 请高手来帮我翻译神奇指标的意思，我翻译到一半，实在是搞不定了，请高手帮帮忙，附代码

141

#property copyright "Copyright ?2006, TrendLaboratory Ltd."
#property link "http://finance.groups.yahoo.com/group/TrendLaboratory"

#property indicator_minimum 0.0
#property indicator_buffers 6
#property indicator_color1 Black
#property indicator_color2 Black
#property indicator_color3 Black
#property indicator_color4 Black
#property indicator_color5 RoyalBlue
#property indicator_color6 Red

extern int Length = 20;
extern int Deviation = 1;
extern double MoneyRisk = 1.0;
extern int Signal = 1;
extern int Line = 1;
extern int Nbars = 1000;
double shuzu1[];
double shuzu2[];
double shuzu3[];
double shuzu4[];
double shuzu5[];
double shuzu6[];
extern bool SoundON = TRUE;
bool gi_132 = FALSE;
bool gi_136 = FALSE;

int init() {
SetIndexBuffer(0, shuzu1);
SetIndexBuffer(1, shuzu2);
SetIndexBuffer(2, shuzu3);
SetIndexBuffer(3, shuzu4);
SetIndexBuffer(4, shuzu5);
SetIndexBuffer(5, shuzu6);
SetIndexStyle(0, DRAW_NONE);
SetIndexStyle(1, DRAW_NONE);
SetIndexStyle(2, DRAW_NONE);
SetIndexStyle(3, DRAW_NONE);
SetIndexStyle(4, DRAW_HISTOGRAM);
SetIndexStyle(5, DRAW_HISTOGRAM);
IndicatorDigits(MarketInfo(Symbol(), MODE_DIGITS));
string ls_0 = "波段之星";
IndicatorShortName(ls_0);
SetIndexLabel(0, "UpTrend Stop");
SetIndexLabel(1, "DownTrend Stop");
SetIndexLabel(2, "UpTrend Signal");
SetIndexLabel(3, "DownTrend Signal");
SetIndexLabel(4, "UpTrend Line");
SetIndexLabel(5, "DownTrend Line");
SetIndexDrawBegin(0, Length);
SetIndexDrawBegin(1, Length);
SetIndexDrawBegin(2, Length);
SetIndexDrawBegin(3, Length);
SetIndexDrawBegin(4, Length);
SetIndexDrawBegin(5, Length);
return (0);
}

int start() {
int aa;
double id1[25000];
double id2[25000];
double id3[25000];
double id4[25000];
for (int i = Nbars; i >= 0; i--) {
shuzu1[i] = 0;
shuzu2[i] = 0;
shuzu3[i] = 0;
shuzu4[i] = 0;
shuzu5[i] = EMPTY_VALUE;
shuzu6[i] = EMPTY_VALUE;
}
for (i = Nbars - Length - 1; i >= 0; i--) {
id1[i] = iBands(NULL, 0, Length, Deviation, 0, PRICE_CLOSE, MODE_UPPER, i);
id2[i] = iBands(NULL, 0, Length, Deviation, 0, PRICE_CLOSE, MODE_LOWER, i);
if (Close[i] > id1[i + 1]) aa = 1; //close[i]大于上根的UPER价 aa =1
if (Close[i] < id2[i + 1]) aa = -1; //close[i]小于上根的LOWER价 aa=-1

if (aa < 0 && id1[i] > id1[i + 1]) id1[i] = id1[i + 1]; //close[i]小于上根的LOWER价 且本根uper价
//大于上根uper价 则本根uper价＝上根uper价
if (aa > 0 && id2[i] < id2[i + 1]) id2[i] = id2[i + 1]; //如果aa>0且本根LOWER价小于上根LOWER价
//则本根lower价==上根lower价
id3[i] = id1[i] + (MoneyRisk - 1.0) / 2.0 * (id1[i] - id2[i]); //id3[i]=id1[i]
id4[i] = id2[i] - (MoneyRisk - 1.0) / 2.0 * (id1[i] - id2[i]); //id4[i]=id2[i]
if (aa < 0 && id3[i] > id3[i + 1]) id3[i] = id3[i + 1]; //如果close[i]<lower[i+1]且uper[i]>uper[i+1]
// id1[i]=id1[i+1]
if (aa > 0 && id4[i] < id4[i + 1]) id4[i] = id4[i + 1]; //
if (aa > 0) {
if (Signal > 0 && shuzu1[i + 1] == -1.0) { //这里我始终不明白，这个shuzu[]在定议之后没有赋值就可以直接调用吗？
shuzu3[i] = id4[i];
shuzu1[i] = id4[i];
if (Line > 0) shuzu5[i] = id4[i];
if (SoundON == TRUE && i == 0 && !gi_132) {
Alert("Alert!!! BUY..Major on ", Symbol(), "-", Period());
gi_132 = TRUE;
gi_136 = FALSE;
}
} else {
shuzu1[i] = id4[i];
if (Line > 0) shuzu5[i] = id4[i];
shuzu3[i] = -1;
}
if (Signal == 2) shuzu1[i] = 0;
shuzu4[i] = -1;
shuzu2[i] = -1.0;
shuzu6[i] = EMPTY_VALUE;
}
if (aa < 0) {
if (Signal > 0 && shuzu2[i + 1] == -1.0) {
shuzu4[i] = id3[i];
shuzu2[i] = id3[i];
if (Line > 0) shuzu6[i] = id3[i];
if (SoundON == TRUE && i == 0 && !gi_136) {
Alert("Alert!!! SELL..Major on ", Symbol(), "-", Period());
gi_136 = TRUE;
gi_132 = FALSE;
}
} else {
shuzu2[i] = id3[i];
if (Line > 0) shuzu6[i] = id3[i];
shuzu4[i] = -1;
}
if (Signal == 2) shuzu2[i] = 0;
shuzu3[i] = -1;
shuzu1[i] = -1.0;
shuzu5[i] = EMPTY_VALUE;
}
}
return (0);

}