系統的參數與變數
inputs:LMult(1.4),SMult(2.4),ProfitPt(0),TrailBar(6),MinPf(50); vars: MP(0) ;
MP = MarketPosition ;
作多進場邏輯
將N日的平均振幅乘以一定比例後,再加上次日開盤價作為突破買進價格
Buy at Open next bar + Average(Range,10)*LMult stop ;
作空進場邏輯
將N日的平均振幅乘以一定比例後,再以次日開盤價相減作為跌破賣出價格
Sell at Open next bar - Average(Range,10)*SMult stop ;
出場規則
本系統使用了幾個不一樣的出場規則:1. 當進場後在第一根有獲利的開盤價出場
{ Exit at first Profitable Open }
if MP = 1 and Open next bar > EntryPrice+ProfitPt+Commission*CurrentContracts/BigPointValue
then ExitLong next bar at Open ;
if MP = -1 and Open next bar < EntryPrice-ProfitPt-Commission*CurrentContracts/BigPointValue
then ExitShort next bar at Open ;
2. 移動式追蹤平倉出場
{Trailing Stops }
if MP = 1 then ExitLong next bar at Lowest(Low,TrailBar) Stop ;
if MP = -1 then ExitShort next bar at Highest(High,TrailBar) stop ;
3. 進場後, 4根K棒未達一定獲利則平倉出場
{ Stale Position Exit }
if BarsSinceEntry > 4 and PositionProfit < MinPF*BigPointValue then Begin ExitLong next bar at Market ;
ExitShort next bar at Market ;
end ;
台指期 日K 留倉 交易週期 2004/8/2 ~ 2014/7/31 交易成本 1200
以下為早期修改後的波動性擴張系統 - 目前看起來仍具有創新高的能力
inputs: TradeProfit(375),TradeStopLoss(225),TradeMovPL(180),MinPL(90); Inputs: MultBuy(2.2),MultSell(3.4),BuyLength(12),SellLength(12); vars: TradeCounter(0),IsBalanceDay(False); Vars: KeepPL(True),MP(0);
MP = MarketPosition ;
if DAYofMonth(Date) > 14 and DAYofMonth(Date) < 22 and DAYofWeek(Date)= 3 then isBalanceDay = True else isBalanceDay =False ;
Buy ("VLB") {Next Bar} at Open Next Bar + Average(Range, BuyLength) * MultBuy Stop;
Sell ("VLS") {Next Bar} at Open Next Bar - Average(Range, SellLength) * MultSell Stop;
{ ----- Exit of Long Trade -----}
if MP > 0 then Begin
{ 停利出場 }
if MP > 0 and High > EntryPrice + TradeProfit then ExitLong at EntryPrice + TradeProfit stop;
{ 停損出場 }
if MP > 0 and Low < EntryPrice - TradeStopLoss then ExitLong at EntryPrice - TradeStopLoss stop;
當進場後高點 > 進場價格 MinPL 點以上 , 則以進場後最高價減去 TradeMovPL 作反手單
if IsBalanceDay = False and MP > 0 and KeepPL and Highest(High, BarsSinceEntry)-EntryPrice > MinPL then Sell at Highest(High, BarsSinceEntry)-TradeMovPL Stop;
end;
{ ----- Exit of Short Trade -----}
if MP < 0 then Begin { 停利出場 }
if MP < 0 and Low < EntryPrice - TradeProfit then ExitShort at EntryPrice - TradeProfit stop;
{ 停損出場 }
if MP < 0 and High > EntryPrice + TradeStopLoss then ExitShort at EntryPrice + TradeStopLoss stop;
當進場後低點 < 進場價格 MinPL 點以上 , 則以進場後最低價加上 TradeMovPL 作反手單
if IsBalanceDay = False and MP < 0 and KeepPL and EntryPrice-(Lowest(Low, BarsSinceEntry)) > MinPL then Buy at Lowest(Low, BarsSinceEntry) + TradeMovPL Stop;
end;
{ ----- Balance on Monthly BalanceDay -----}
if IsBalanceDay = True then begin
if time >= 1315 then begin
if MP > 0 then ExitLong next bar at market ;
if MP < 0 then ExitShort next bar at market ;
end ;
end;
台指期 15 分K 留倉 交易週期 2004/8/2 ~ 2014/7/31 交易成本 1200
同樣的策略核心元素 ,加上不同的出場反手單 ,也會有意想不到的效果
沒有留言:
張貼留言