EasyTrader ArtNo 177
在我的事業生涯中,我一度曾以下述的短線交易策略,連續贏了30多筆交易。首先,你必須計算出3根直線高點的移動平均數,以及低點的移動平均數。這項策略就是,根據振蕩點趨勢辨識技巧,如果趨勢是正向的,那我們就在3直線低點的移動平均數的價位上買進,然後在3直線高點的移動平均數的價位獲利了結。賣出信號則完全相反。這個意思是說,你要在3直線高點的移動平均數的價位上賣出,然後在3直線低點的移動平均數的價位上回補。
--- 摘譯 Larry Williams 短線交易祕訣
我們先將三日高點/低點畫線成指標如圖
現在讓我們把這些概念整理一下。
作多邏輯
作空邏輯
input:EntryType(1),ExitType(0) ;
vars: IsBalanceDay(False),MP(0),PF(0),PL(0);
Vars: FastL(5),TrendL(10),EntBarL(9),FastS(8),TrendS(19),EntBarS(7),TradeProfit(0.055),TradeStopLoss(0.028),NBarL(12),NBarS(10),ATRs_L(5.2),ATRs_S(11.5),RangeL(200),RangeS(200),ATR_Ratio(1.5);
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 ;
{ 計算 均高與均低線 }
vars: NBarHigh(0),NBarLow(0) ;
NBarHigh = Average(High,EntBarL) ;
NBarLow = Average(Low,EntBarS) ;
{ 短期/長期均線相對位置判斷趨勢 }
if EntryType = 2 then Begin
If Close < NBarLow and Average(AvgPrice,FastL) > Average(AvgPrice,TrendL) then
我們先將三日高點/低點畫線成指標如圖
現在讓我們把這些概念整理一下。
作多邏輯
- 短期均線大於長期均線
- 價格回落至 N日均低線買進。
- 價格回漲至 N日均高線賣出。
作空邏輯
- 短期均線小於長期均線。
- 收盤價格反彈至 M日均高線賣出。
- 收盤價格回跌至 M日均低線回補。
input:EntryType(1),ExitType(0) ;
vars: IsBalanceDay(False),MP(0),PF(0),PL(0);
Vars: FastL(5),TrendL(10),EntBarL(9),FastS(8),TrendS(19),EntBarS(7),TradeProfit(0.055),TradeStopLoss(0.028),NBarL(12),NBarS(10),ATRs_L(5.2),ATRs_S(11.5),RangeL(200),RangeS(200),ATR_Ratio(1.5);
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 ;
{ 計算 均高與均低線 }
vars: NBarHigh(0),NBarLow(0) ;
NBarHigh = Average(High,EntBarL) ;
NBarLow = Average(Low,EntBarS) ;
{ 短期/長期均線相對位置判斷趨勢 }
if EntryType = 2 then Begin
If Close < NBarLow and Average(AvgPrice,FastL) > Average(AvgPrice,TrendL) then
Buy next bar at NBarLow Stop ;
If Close > NBarHigh and Average(AvgPrice,FastS) < Average(AvgPrice,TrendS) then
If Close > NBarHigh and Average(AvgPrice,FastS) < Average(AvgPrice,TrendS) then
Sell next bar at NBarHigh Stop ;
end;
{ 進場後幾根K棒後 ,以高低點均線位置出場 }
if ExitType = 6 then Begin
if MP > 0 and BarsSinceEntry > NBarL and Close > NbarHigh then
end;
{ 進場後幾根K棒後 ,以高低點均線位置出場 }
if ExitType = 6 then Begin
if MP > 0 and BarsSinceEntry > NBarL and Close > NbarHigh then
ExitLong next bar at NbarHigh limit ;
if MP < 0 and BarsSinceEntry > NBarS and Close < Nbarlow then
if MP < 0 and BarsSinceEntry > NBarS and Close < Nbarlow then
ExitShort next bar at NbarLow limit ;
end;
{ 其它出場方式 }
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
end;
{ 其它出場方式 }
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
{以進場點後每次K棒新高點作為出場計算基礎點 , 當價格低於基礎點減掉過去10根K棒 ATR均值的某倍數後出場}
{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_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;
{以進場點後每次K棒新低點作為出場計算基礎點 , 當價格高於基礎點加上過去10根K棒 ATR均值的某倍數後出場}
{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;
沒有留言:
張貼留言