請問:
技術指標的DMI趨向指標,當-DI數值大於+DI,希望可以通知出場賣出。
下圖黃線是-DI,橘線是+DI,希望黃線在橘線上 的每一根K棒都可以跳出警示通知(出場賣出)
請問: 腳本這樣寫ok嗎?
對了,我的頻率是60分K棒
謝謝
// 策略:DMI 趨向指標盤中即時警示
// 執行環境:警示腳本 (盤中即時洗價)
input: Length(14);
var: pdiValue(0), ndiValue(0), adxValue(0);
SetInputName(1, "天數");
DirectionMovement(Length, pdiValue, ndiValue, adxValue);
if CurrentBar >= Length then begin
if pdiValue > ndiValue and pdiValue[1] <= ndiValue[1] then begin
ret = 1;
retmsg = "【DMI進場通知】+DI(" + NumToStr(pdiValue, 2) + ") 大於 -DI(" + NumToStr(ndiValue, 2) + "),建議進場買進。";
end;
if ndiValue > pdiValue and ndiValue[1] <= pdiValue[1] then begin
ret = 1;
retmsg = "【DMI出場通知】-DI(" + NumToStr(ndiValue, 2) + ") 大於 +DI(" + NumToStr(pdiValue, 2) + "),建議出場賣出。";
end;
end;

1 評論