大家好,
分享如何使用策略雷達做到 KD金叉向上買進;KD死叉向下,且停損10點賣出
特別叮嚀:
1. 務必要先使用 "模擬交易" 帳號測試是否OK!
2. 務必要同時啟動進出場策略。
大致撰寫方式:
0. 策略雷達分兩個策略,一個是進場策略;一個是出場策略。兩個策略用同一個腳本即可。
1. 使用 input 宣告買進賣出參數,用來區分此腳本是進場 or 出場。
2. 參考 KD高檔死亡交叉 警示腳本,撰寫 KD。
3. 宣告 var 變數( Forecast_DealPrice ) 紀錄估算的進場價格。
策略雷達 KD金叉向上_買進 內容屬性設定:
策略雷達 KD金叉向上_買進 下單設定:
策略雷達 KD死叉向下_出場 內容屬性設定:
策略雷達 KD死叉向下_出場 下單設定:
警示腳本範例程式碼:
input: _BuyOrSell(-1), Length(9), RSVt(3), Kt(3); SetTotalBar(maxlist(Length,6) * 3 + 8); SetInputName(1, "買進=1;賣出=0"); SetInputName(2, "計算期數"); SetInputName(3, "RSVt權數"); SetInputName(4, "Kt權數"); variable: rsv(0), k(0), _d(0),Forecast_DealPrice(0); Stochastic(Length, RSVt, Kt, rsv, k, _d); if k cross over _d then begin Forecast_DealPrice = close; if _BuyOrSell = 1 then ret = 1; end; if k cross under _d and close < Forecast_DealPrice - 10 and _BuyOrSell = 0 then ret = 1;
以上供參考,有問題歡迎詢問。
10 評論