請問小幫手,以下程式結果有誤,不曉得原因?
Input: FastLength(12, "MACD指標-DIF短期期數");
Input: SlowLength(26, "MACD指標-DIF長期期數");
Input: MACDLength(9, "MACD指標-MACD期數");
variable: difValue(0), macdValue(0), oscValue(0);
SetTotalBar(200);
MACD(weightedclose(), FastLength, SlowLength, MACDLength, difValue, macdValue, oscValue);.
//--- Debug ---//
if symbol= "3376.TW" then begin
Print(file(param_path),"[MACD]");
Print(file(param_path),"CurrentTime: "+datetoString(Date)+" "+timetoString(CurrentTime));
Print(file(param_path),"difValue[1]: "+NumToStr(difValue[1], 2));
Print(file(param_path),"difValue: "+NumToStr(difValue, 2));
Print(file(param_path),"macdValue[1]: "+NumToStr(macdValue[1], 2));
Print(file(param_path),"macdValue: "+NumToStr(macdValue, 2));
Print(file(param_path),"oscValue[1]: "+NumToStr(oscValue[1], 2));
Print(file(param_path),"oscValue: "+NumToStr(oscValue, 2));
end;
結果3376新日興 在2023/10/16的 macdValue, macdValue[1] 數值明顯有誤,
[MACD]
CurrentTime: 2023/10/16 09:00:00
difValue[1]: -0.15
difValue: 0.12
macdValue[1]: -0.03
macdValue: 0.00
oscValue[1]: -0.12
oscValue: 0.12
[MACD]
CurrentTime: 2023/10/16 09:01:00
difValue[1]: -0.15
difValue: 0.15
macdValue[1]: -0.03
macdValue: 0.01
oscValue[1]: -0.12
oscValue: 0.14
[MACD]
CurrentTime: 2023/10/16 09:02:00
difValue[1]: -0.15
difValue: 0.15
macdValue[1]: -0.03
macdValue: 0.01
oscValue[1]: -0.12
oscValue: 0.15
//中間略過
[MACD]
CurrentTime: 2023/10/16 13:22:00
difValue[1]: -0.15
difValue: 0.27
macdValue[1]: -0.03
macdValue: 0.03
oscValue[1]: -0.12
oscValue: 0.24
[MACD]
CurrentTime: 2023/10/16 13:23:00
difValue[1]: -0.15
difValue: 0.27
macdValue[1]: -0.03
macdValue: 0.03
oscValue[1]: -0.12
oscValue: 0.24
[MACD]
CurrentTime: 2023/10/16 13:24:00
difValue[1]: -0.15
difValue: 0.27
macdValue[1]: -0.03
macdValue: 0.03
oscValue[1]: -0.12
oscValue: 0.24
[MACD]
CurrentTime: 2023/10/16 13:29:00
difValue[1]: -0.15
difValue: 0.27
macdValue[1]: -0.03
macdValue: 0.03
oscValue[1]: -0.12
oscValue: 0.24
3 評論