停損停利訊號程式碼

  

保留字介紹

 

StopLossAmount     代表總損失的金額

 

Commission_B        代表手續費

 

PointValue 1點的價值,例如台指期1點為200

 

EntryPrice  特定部位的進場價格

 

Orderprice  表示每xxxxx元相當於幾點

 

以台指期為例,pointvalue=200假設多單停利利潤設定為10000元所以orderprice=50è200*50=10000

 

 

停損訊號程式碼

 

Parameter DollarRisk(10000)

Variables StopLossAmount(0), OrderPrice(0)

 

If MarketPosition = 1 Then

StopLossAmount = DollarRisk + Commission_B

OrderPrice = Entryprice(0) - (StopLossAmount  PointValue)

ExitLong (停損L) this Bar at OrderPrice Stop

End if

 

If MarketPosition = -1 Then

StopLossAmount = DollarRisk + Commission_S

OrderPrice = EntryPrice(0) + (StopLossAmount PointValue)

ExitShort (停損S) this Bar at OrderPrice Stop

End if

 

 

If MarketPosition = 1 Then

StopLossAmount = DollarRisk + Commission_B

OrderPrice = Entryprice(0) - (StopLossAmount  PointValue)

ExitLong (停損L) this Bar at OrderPrice Stop

End if

 

 

停利訊號程式碼

Parameter profit(10000)

Variables OrderPrice(0)

 

If MarketPosition = 1 Then

OrderPrice = Entryprice(0) + (profit  PointValue)

ExitLong (停利L) this Bar OrderPrice limit

End if

 

 

If MarketPosition = -1 Then

OrderPrice = EntryPrice(0) - (profit PointValue)

ExitShort (停利S) this Bar OrderPrice limit

End if

 

 

If MarketPosition = 1 Then

OrderPrice = Entryprice(0) + (profit  PointValue)

ExitLong (停利L) this Bar OrderPrice limit

End if

 

 

arrow
arrow
    全站熱搜

    阿豪 發表在 痞客邦 留言(0) 人氣()