RSI逆転戦略は,RSI指標と平滑移動平均を計算して,株が過買いまたは過売れているかどうかを決定し,それによって買い・売る信号を生成する.この戦略は,RSI指標の逆転特性を活用して,株価が逆転すると利益を得る.
この戦略は,まず14期間のRSIを計算し,0-100に正規化します.次に,RSIの5期間の重度の移動平均を計算し,触角関数を使用して-1から1にマッピングします.マッピングされたRSIが -0.8を超えると,購入信号が生成されます. 1を下回ると,販売信号が生成されます.マッピングと
戦略は,実行月と日付の範囲を設定し,指定された月と日付の間にのみ実行されます.
RSI逆転戦略は,RSI指標に基づいて単純な逆転取引規則を構築することによって,価格逆転機会を効果的に捉える.この戦略は実行が簡単ですが,パラメータ最適化,リスク管理メカニズムなどによって強化され,安定した収益性の高い定量的な取引戦略になります.
/*backtest start: 2023-01-12 00:00:00 end: 2024-01-18 00:00:00 period: 1d basePeriod: 1h exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}] */ //@version=3 strategy(title="RSI Reverse", shorttitle="RSI Reverse") RSI_main = input(14, title="RSI Main Period") RSI_smooth = input(5, title="RSI Smooth Period") //Functions RVS(input) => (exp(2*input)-1) / (exp(2*input)+1) //RSI Calculation raw_RSI=0.1*(rsi(close,RSI_main)-50) wma_RSI=wma(raw_RSI,RSI_smooth) RVS_RSI = RVS(wma_RSI) threshold1 = RVS_RSI < 0.8? 1 : 0 threshold2 = -0.8 plot(RVS_RSI,color=red) plot(threshold1,color=blue) plot(threshold2,color=blue) buycon = crossover(RVS_RSI,threshold2) sellcon = crossunder(RVS_RSI , threshold1) monthfrom =input(6) monthuntil =input(12) dayfrom=input(1) dayuntil=input(31) if ( buycon ) strategy.entry("BUY", strategy.long, stop=close, oca_name="TREND", comment="BUY") else strategy.cancel(id="BUY") if ( sellcon) strategy.close("BUY")