《HTS程式交易教學》通用-移動停損移動停利買賣訊號範例[免費訊號教學]

params:拉回出場(20),移動停損啟動(50)
vars: flag1(0), flag2(0);
//此假設使用6MA與60MA交叉為進場點
if ma(close,5) cross over ma(close,20) then buy NEXT bar at MARKET end if
if ma(close,5) cross under ma(close,20) then sell NEXT bar at MARKET end if
1.系統平台僅供參考,投資人仍需自行判斷負責,本人不負任何法律責任。
2.任何參數請客戶自行設定,本人僅提供介面語法操作說明
3.實際可交易商品相關資訊請以主管機關公告為限。
//以下開始為移動停損使用
value9=BarsSinceEntry(0)
if marketposition = 1 then
 flag2 = 0
if high=highest(high,value9 )   then
  Value1 = high-拉回出場
  flag1  = 1
end if
 if flag1 = 1 and close>entryprice(0)+移動停損啟動 then
  exitlong next bar at Value1 stop
 end if
end if
if marketposition = -1 then
 flag1 = 0
if low=lowest(low,value9)   then
  Value2 = low+ 拉回出場
  flag2 = 1
end if
 if flag2 = 1 and close<entryprice(0)-移動停損啟動 then
     exitshort next bar at Value2 stop
 end if
end if
if marketposition = 0 then
 flag1 = 0
 flag2 = 0
end if

沒有留言:

張貼留言

《HTS程式交易教學》[教學信號]KD買賣訊號範例[免費訊號教學]

Parameters : HighLowTerm(9), kLength(3), dLength(3), OverSold(20), OverBought(80) variables:value(0),value2(0); 1.系統平台僅供參考,投資人仍需自行判斷負責,本人...