lahahaha 發表於 15-5-13 00:37
第(2)部分的不停trade問題我已解決, 但我用:
setstopposition;
setpercenttrailing(100,50);
貼上PosTradeEntryPrice 加碼 範例給你參考
if mp = 1 then
begin
if PosTradeEntryPrice(0,0) <> 0 and currentcontracts = 1 * LTT then
buy("b2") LTT shares next bar at PosTradeEntryPrice(0,0) + (0.5 * Myatr ) stop ;
if PosTradeEntryPrice(0,1) <> 0 and currentcontracts = 2 * LTT then
buy("b3") LTT shares next bar at PosTradeEntryPrice(0,1) + (1.0 * Myatr ) stop ;
if PosTradeEntryPrice(0,2) <> 0 and currentcontracts = 3 * LTT then
buy("b4") LTT shares next bar at PosTradeEntryPrice(0,2) + (1.5 * Myatr ) stop ;
end ;
if mp = -1 then
begin
if PosTradeEntryPrice(0,0) <> 0 and currentcontracts = LTT then
sellshort("s2") LTT shares next bar PosTradeEntryPrice(0,0) - (0.5 * Myatr ) stop ;
if PosTradeEntryPrice(0,1) <> 0 and currentcontracts = 2 * LTT then
sellshort("s3") LTT shares next bar PosTradeEntryPrice(0,1) - (1.0 * Myatr ) stop ;
if PosTradeEntryPrice(0,2) <> 0 and currentcontracts = 3 * LTT then
sellshort("s4") LTT shares next bar PosTradeEntryPrice(0,2) - (1.5 * Myatr ) stop ;
end;
|