EasyTrader ArtNo 269
相對強弱指數RSI 技術指標是由技術分析大師為韋爾斯‧懷德(Wells Wilder) 所發明的,最早被用於期貨交易中,現在,RSI已經成為被投資者應用最廣泛的技術指標之一,它是一種用來評估「買賣盤雙方力道強弱」情況的技術指標,當買方力量稍遜,價格就會向下發展;相反,當賣方力量不足,價格就會向上發展。RSI把相對強度的數值定義在 0~100之間,如此更能方便參考使用。而多天期的RSI (即n值較大) 其訊號將更具參考性。
原始的相對強弱指數亦可直接由下式得出:
原始的相對強弱指數亦可直接由下式得出:
RSI數值越大代表買方力道越強,但當RSI大到某一程度時通常開始代表買超現象,需注意反轉。同理,當RSI低到某一程度時,通常代表市場出現非理性的賣超現象,表示底部區已近 。
在近期 "STOCKS & COMMODITIES" 雜誌中有一篇文章 “The Slow Relative Strength Index” 作者Vitali Apirine 針對相對強弱指數RSI 提出了一個修正的想法 - 將一段期間價格的淨變化與同期間內每根K棒收盤價的絕對變化的相對比例以指數平均數的方式來作平滑運算,在TradeStation網站上也發佈了可以應用的函數
{系統參數與變數}
input:EntryType(1),ExitType(1);
inputs:NBarL(10),NBarS(26),TradeProfit(0.045),TradeStopLoss(0.015),ATRs_L(12.7),ATRs_S(4.6);
vars: IsBalanceDay(False),MP(0),PF(0),PL(0);
inputs:LenA(14),SMLenA(6),LenB(14),SMLenB(6),UpperBand(80),LowerBand(20),HighBar(3),LowBar(3) ;
Vars:SlowRSIA(0),SlowRSIB(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 ;
{多空分別計算不同長度的期間 SRSI }
SlowRSIA = SRSI(Close,LenA,SMLenA) ;
SlowRSIB = SRSI(Close,LenB,SMLenB) ;
{ SlowRSI 上穿超賣界限,以近期新高進場作多 }
if MP <> 1 and SlowRSIA Cross over LowerBand then buy next bar Highest(High,HighBar) stop;
{ SlowRSI 下穿超買界限,以近期新低進場作空 }
if MP <> -1 and SlowRSIB Cross under UpperBand then Sell next bar Lowest(Low,LowBar) 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 IsBalanceDay or date = 1150224 then setExitonClose ;
if MP <> -1 and SlowRSIB Cross under UpperBand then Sell next bar Lowest(Low,LowBar) 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 IsBalanceDay or date = 1150224 then setExitonClose ;
讚喔!
回覆刪除謝謝Egale老師.
讚喔!
回覆刪除謝謝Egale老師.
有空會再將雜誌的概念作策略開發分享
回覆刪除很期待喔!
刪除Thank you.
很期待喔!
刪除Thank you.