我想把這個程式編譯成MC語言使用,但一直編譯不過,懇請武林高手出手相助
HTS突破N次進場買賣法 //指標判斷範例
Parameter: 突破N次(3) value1=Highest( h, 突破N次 ) value2=Lowest( l, 突破N次 )
Draw1( value1, "最高",red) Draw2( value2, "最低",blue)
//買賣策略範例
Parameter: 突破N次(3) Parameter: 空停損(10000),空停利(999999999),多停損(10000),多停利(99999999) variables:StopLossAmount(0), OrderPrice(0)
value1=Highest( h, 突破N次 ) value2=Lowest( l, 突破N次 )
IF C > value1[1] then buy("買進")next bar market end if
IF C < value2[1] then sell("賣出")next bar market end if
If MarketPosition = 1 Then StopLossAmount = 多停損 + Commission_B OrderPrice = Entryprice(0) - (StopLossAmount / PointValue) ExitLong ("多停損") this Bar at OrderPrice Stop End if
If MarketPosition = -1 Then StopLossAmount = 空停損 + Commission_S OrderPrice = EntryPrice(0) + (StopLossAmount/ PointValue) ExitShort ("空停損") this Bar at OrderPrice Stop End if
If MarketPosition = 1 Then StoplossAmount = 多停利 + Commission_B OrderPrice = Entryprice(0) + (StoplossAmount / PointValue) ExitLong ("多停利") this Bar OrderPrice limit End if
If MarketPosition = -1 Then StoplossAmount = 空停利 + Commission_S OrderPrice = EntryPrice(0) - (StoplossAmount/ PointValue) ExitShort ("空停利") this Bar OrderPrice limit End if
請使用以下工具把 HTS->TS,再從 TS->MC
記得把中文改成英文,next bar at market 不能省略。
再修一下格式,應該就可以了。
http://www.multicharts.com.tw/dis/dis_Content.aspx?rd=1&D_ID=2&SN=1482