EasyTrader ArtNo 167
短線交易秘訣中獲利的型態之一,這種型態的關鍵或秘密所在,就是當日的收盤價應該位於上漲當日價差區間下方的 25% 內,而更好的情況則是收盤價甚至低於開盤價。由於這種格局基本上是收盤上漲的局面,所以稱之為“隱蔽的出擊日”。在這段期間所發生的情況是,若不是在開盤時價格一路攀升,到收盤時卻遠低於最高價,就是價格稍微高開之後一路上漲,但最後卻守不住當日的戰果。當然,當日的收盤價會稍微上漲,可是卻遠低於最高價。
但假如第二天價格大幅回升,甚至越過出擊日的最高點,而如果根據我們的市場參考工具,包括每周交易日、每月交易日、市場關系、買超、賣超以及趨勢分析,這個階段應該是上漲格局,那麽這將是漲勢最淩厲的走勢,而且應該做多。
在隱藏的出擊日賣出,情況則正好相反。你應該找出一個收盤下挫的日子,其收盤價在當日價差區間上方的 25% 範圍內,並且高於開盤價。我們的進場點就是:當隔天的價格跌破隱藏的出擊日的最低價時,顯示價格已經漲不起來了,這就是我們進場的時點。
以下的報表為利用台指期日K搭配幾種不同的方式作測試
ExitType 出場方式 , WeekDay 搭配適合買賣的每週交易日 , H>H[1] or L<L[1] 強化型態
加入每周交易日的濾網 ,降低交易次數與 MDD ,績效提升
加入強化型態,雖然績效下降 ,但是 PF值上升 MDD大幅下降
測試程式碼
input:ExitType(0),Ref_L(0),Ratio_L(0.45),Ref_S(0),Ratio_S(0.5) ;
inputs: NBarL(29),NBarS(31),TradeProfit(0.057),TradeStopLoss(0.059) ;
inputs: ATRs_L(16.7),ATRs_S(2.9);
vars: IsBalanceDay(False),MP(0),PF(0),PL(0),HLRange_L(0),HLRange_S(0) ;
MP = MarketPosition ;
if DAYofMonth(Date) > 14 and DAYofMonth(Date) < 22 and DAYofWeek(Date)= 3 then isBalanceDay = True else isBalanceDay =False ;
PF = AvgPrice*TradeProfit ;
PL = AvgPrice*TradeStopLoss ;
{ 計算前日振幅 }
HLRange_L = High[Ref_L+1]-Low[Ref_S+1] ;
HLRange_S = High[Ref_L+1]-Low[Ref_S+1] ;
{多方隱蔽的出擊日}
Condition1 = Close[Ref_L] > Close[Ref_L+1] and (Close[Ref_L]-Low[Ref_L]) <= Ratio_L*HLRange_L {and High[ref_L] > High[Ref_L+1]};
{空方隱蔽的出擊日}
Condition2 = Close[Ref_S] < Close[Ref_S+1] and (High[Ref_S]-Close[Ref_S]) <= Ratio_S*HLRange_S {and Low[ref_L] < Low[Ref_L+1]};
condition3 = (DayofWeek(date) = 1 or DayofWeek(date) = 3 or DayofWeek(date) = 5) ;
condition4 = (DayofWeek(date) = 1 or DayofWeek(date) = 2 or DayofWeek(date) = 3) ;
if condition3 and Condition1 then Buy next bar at High[Ref_L]+3 stop;
if condition4 and Condition2 then Sell next bar at Low[Ref_S]-3 stop;
if ExitType = 1 then SetStopLoss(PL * BigPointValue) ;
if ExitType = 2 then Begin
SetStopLoss(PL * BigPointValue) ;
SetProfitTarget(PF * BigPointValue) ;
end;
if ExitType = 3 then Begin
if MP > 0 and BarsSinceEntry = NBarL then ExitLong next bar at Market ;
if MP < 0 and BarsSinceEntry = NBarS then ExitShort next bar at Market ;
end;
if ExitType = 4 then Begin
SetStopLoss(PL * BigPointValue) ;
SetProfitTarget(PF * BigPointValue) ;
if MP > 0 and BarsSinceEntry = NBarL then Sell {ExitLong} next bar at Market ;
if MP < 0 and BarsSinceEntry = NBarS then Buy {ExitShort} next bar at Market ;
end;
if ExitType = 5 then Begin
if ExitType = 2 then Begin
SetStopLoss(PL * BigPointValue) ;
SetProfitTarget(PF * BigPointValue) ;
end;
if ExitType = 3 then Begin
if MP > 0 and BarsSinceEntry = NBarL then ExitLong next bar at Market ;
if MP < 0 and BarsSinceEntry = NBarS then ExitShort next bar at Market ;
end;
if ExitType = 4 then Begin
SetStopLoss(PL * BigPointValue) ;
SetProfitTarget(PF * BigPointValue) ;
if MP > 0 and BarsSinceEntry = NBarL then Sell {ExitLong} next bar at Market ;
if MP < 0 and BarsSinceEntry = NBarS then Buy {ExitShort} next bar at Market ;
end;
if ExitType = 5 then Begin
{Inputs: ATRs_L(3);}
Variables: PosHigh(0), ATRVal_L(0);
ATRVal_L = AvgTrueRange(10) * ATRs_L;
If BarsSinceEntry = 0 Then PosHigh = High;
If MarketPosition = 1 Then Begin
If High > PosHigh Then PosHigh = High;
ExitLong ("ATR") Next Bar at PosHigh - ATRVal_L Stop;
End else ExitLong ("ATR eb") Next bar at High - ATRVal_L Stop;
{Inputs: ATRs_S(3);}
Variables: PosLow(0), ATRVal_S(0);
ATRVal_S = AvgTrueRange(10) * ATRs_S;
If BarsSinceEntry = 0 Then PosLow = Low;
If MarketPosition = -1 Then Begin
If Low < PosLow Then PosLow = Low;
ExitShort ("ATR_1") Next Bar at PosLow + ATRVal_S Stop;
End else ExitShort ("ATR_1 eb") Next bar at Low + ATRVal_S Stop;
end;
Variables: PosLow(0), ATRVal_S(0);
ATRVal_S = AvgTrueRange(10) * ATRs_S;
If BarsSinceEntry = 0 Then PosLow = Low;
If MarketPosition = -1 Then Begin
If Low < PosLow Then PosLow = Low;
ExitShort ("ATR_1") Next Bar at PosLow + ATRVal_S Stop;
End else ExitShort ("ATR_1 eb") Next bar at Low + ATRVal_S Stop;
end;
if IsBalanceDay then setExitonClose ;
台指期 日K 留倉 最近 3000交易日 交易成本 1200
MagicQS085
沒有留言:
張貼留言