停損停利,也是買賣信號中很重要的一項決策,話不多說,把下面這組文字加入您的信號中即可

請在信號最上方加入以下文字
------------------------------------------------------------------------------------------------------------------------------------




PARAM:停損點(50)
PARAM:停利點(50)

請在信號最下方加入以下文字
------------------------------------------------------------------------------------------------------------------------------------


if CurrentContracts > 0 then exitlong("多停損點")  next bar EntryPrice(0)-停損點 stop end if
if CurrentContracts < 0 then exitshort("空停損點")  next bar EntryPrice(0)+停損點 stop end if

if CurrentContracts > 0 then exitlong("多停利")  next bar EntryPrice(0)+停利點 limit end if
if CurrentContracts < 0 then exitshort("空停利")  next bar EntryPrice(0)-停利點 limit end if

 

什麼?太複雜看不懂嗎?那麼,使用範例如下,以下以MA交叉來說明:

MA交叉原本如下
------------------------------------------------------------------------------------------------------------------------------------

Parameter:fast(5),slow(10)

if ma(close,fast) > ma(close,slow) then buy next bar at market
end if

if ma(close,slow) > ma(close,fast) then sell next bar at market
end if


加入停損停利(以藍色字表示)後:
------------------------------------------------------------------------------------------------------------------------------------

Parameter:fast(5),slow(10)

 PARAM:停損點(50)

PARAM:停利點(50)

if ma(close,fast) > ma(close,slow) then buy next bar at market
end if

if ma(close,slow) > ma(close,fast) then sell next bar at market
end if

if CurrentContracts > 0 then exitlong("多停損")  next bar EntryPrice(0)-停損點 stop end if

if CurrentContracts < 0 then exitshort("空停損")  next bar EntryPrice(0)+停損點 stop end if

if CurrentContracts > 0 then exitlong("多停利")  next bar EntryPrice(0)+停利點 limit end if
if CurrentContracts < 0 then exitshort("空停利")  next bar EntryPrice(0)-停利點 limit end if

    全站熱搜

    日盛期貨程式交易 發表在 痞客邦 留言(6) 人氣()