請問,我寫了一個XS指標,希望當MACD裡面的DIF線,數值大於5時,給他一分;小於 -5時,則扣一分
但是,實測時,卻是小於 -5會加一分,大於5卻會扣一分
是哪邊有錯誤呢?

input: FastLength(12), SlowLength(26);
variable: price(0);
price = WeightedClose();
Value1 = 0;
//計算MACD的DIF數值
Value2 = XAverage(price, FastLength) - XAverage(price, SlowLength);
if condition1 = Value2 > 5 then Value1 = Value1 + 1; //DIF > 5
if condition2 = Value2 < -5 then Value1 = Value1 - 1; //DIF < -5
plot1(Value1, "分數");
plot2(Value2, "DIF");
1 評論