2014/04/02

MC, TS保留字轉HTS

原文出處: http://money-flower.blogspot.tw/2010/03/tradestationhts.html

TradeStation裡幾個好用的保留字,使用方式就不介紹了,查EL的Dictionary吧
SetStopLoss(DollarValue)
SetProfitTarget(DollarValue)
SetPercentTrailing(FloorAmnt, Percent)
SetDollarTrailing(DollarValue)

困擾的是要如何在HTS中也能方便使用呢?

這邊提供的方法是直接用程式表達出來,若直接轉成function也是一種方法

SetStopLoss(200*20)以台指為例
HTS:
exitlong this bar at Entryprice(0)-20 stop
exitshort this bar at Entryprice(0)+20 stop

SetProfitTarget(200*20)以台指為例
HTS:
exitlong this bar at Entryprice(0)+20 limit
exitshort this bar at Entryprice(0)-20 limit

SetPercentTrailing(20000, 20)以拉回20%為例
HTS:
if CurrentContracts=1 and MaxPositionProfit(0)>=20000 then
exitlong this bar at Entryprice(0)+MaxPositionProfit(0)*(100-20)/100/200 limit
end if
if CurrentContracts=-1 and MaxPositionProfit(0)>=20000 then
exitshort this bar at Entryprice(0)-MaxPositionProfit(0)*(100-20)/100/200 limit
end if

SetDollarTrailing(pointvalue*20)以20點為例
HTS:
exitlong this bar at entryprice(0)+MaxPositionProfit(0)/pointvalue -20 stop
exitshort this bar at entryprice(0)-MaxPositionProfit(0)/pointvalue +20 stop

0 意見 :

張貼留言

.

.
Related Posts Plugin for WordPress, Blogger...