
この戦略は,RSI指標を異なる時間周期で組み合わせて,現在の市場が過買または過売状態にあることを判断し,価格と移動平均線との関係を組み合わせて,買入と売却のシグナルを発信する. 目標は,下落時に購入し,上昇時に売却し,清算時に利益を達成することです.
5分,15分,1時間のRSI値を計算し,5分,15分,1時間のRSIが同時に25を下回ると,超売り現象として判断し,買入シグナルを生じます.
価格が21日移動平均線を突破すると,取引シグナルとしても用いられ,価格が移動平均線を下回ると,買取シグナルが生じ,価格が移動平均線より上回ると,売出シグナルが生じます.
ポジションの状況に応じて,最初の取引数と加仓ルールを設定します.最初の開場は2手,その後は1手,その後は2手になるまで.
損失が3%に達すると止まる.利益が1%に達すると止まる.
複数の時間枠RSI指標の組み合わせを使用して,超買いと超売りを判断し,信号の信頼性を高めます.
移動均線と組み合わせると,取引機会を拡大する外為取引シグナルが生成されます.
ポジションコントロールと利益・損失比率のストップ・ストップ・ルールを設定し,リスクを制御する.
定量加仓による利益の拡大.
RSI指標には,RSIが超買超売の臨界点に達した後に,価格が反転せずにしばらく継続する可能性があるという回転リスクがあります.この時点で,RSI信号を盲目的に追跡する取引は,損失を引き起こす可能性があります.
移動平均線が生成される取引信号は誤導される可能性があります.価格が激しく波動すると,移動平均線は価格変化をタイムリーに追跡することができません.
ポジションの規模と利益/損失の比率を誤って設定すると,リスク管理が不適切になる可能性があります.
合理的な加仓条件を設定する必要があります.加仓が過度に開放されれば,損失が拡大する可能性があります.
RSIパラメータを調整し,異なるRSI周期パラメータの組み合わせをテストし,より信頼性の高い超買超売りシグナルを見つけます.
異なるパラメータの移動平均線を補助的な取引信号としてテストする.他の技術指標もテストすることができる.
ポジションコントロールとストップ・ストップのルールを最適化し,より科学的リスク管理機構を設定する.
加仓条件を最適化して,加仓が損失を拡大しないようにする.また,指数加仓の代替方法も検討できる.
この戦略は,RSIの複数の時間枠の組み合わせを使用して,トレンドの潜在性を判断し,高い勝率を得ます.同時に,移動平均線で取引シグナルを生成し,取引機会を拡大します. ポジション制御,ストップ・ロス・ストップ,定量加仓などのルールを使用して,リスク制御を行います. 全体として,この戦略は,トレンド,反転指標を統合し,トレンドを追跡し,低吸収の取引ロジックを考慮し,整合状態で良い効果を得ることができます.
/*backtest
start: 2023-09-29 00:00:00
end: 2023-10-29 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=3
strategy("5M_RSI_Strategy", overlay=true, pyramiding = 1)
len =14
Initial_Trade_Size = 2
up = rma(max(change(close), 0), len)
down = rma(-min(change(close), 0), len)
rsi = down == 0 ? 100 : up == 0 ? 0 : 100 - (100 / (1 + up / down))
RSI_1h = request.security(syminfo.tickerid, "60", rsi)
RSI_3h = request.security(syminfo.tickerid, "180", rsi)
RSI_15m = request.security(syminfo.tickerid, "15", rsi)
RSI_5m = request.security(syminfo.tickerid, "5", rsi)
RSI_1m = request.security(syminfo.tickerid, "1", rsi)
ema21_5 = ema(request.security(syminfo.tickerid, "5", close), 21)
ema21_15 = ema(request.security(syminfo.tickerid, "15", close), 21)
//(RSI_3h<=25) and (RSI_1h<=25) and (RSI_15m<=25) and
Positive = ((RSI_5m<=25) and (RSI_15m<=25) and (RSI_1h<=25))?true:false
//alertcondition(Positive, title='POS', message='POS')
//plotshape(Positive, style=shape.triangleup,location=location.belowbar, color=green,size =size.tiny)
Negative = (( RSI_5m>=75) and ( RSI_15m>=75) and ( RSI_1h>=75))?true:false
//alertcondition(Negative, title='NEG', message='NEG')
//plotshape(Negative, style=shape.triangledown,location=location.abovebar, color=red,size=size.tiny) Positive and Negative and
lastordersize = abs(strategy.position_size)>=Initial_Trade_Size?abs(strategy.position_size):Initial_Trade_Size
//lastordersize =1
// and ((ema21_15-low)/ema21_15) > 0.077
//Adding to position rules
if (abs(strategy.position_size) >= Initial_Trade_Size and (abs(close - strategy.position_avg_price)/abs(strategy.position_avg_price)>0.03))
if(strategy.position_avg_price > close and strategy.position_size > 0)
strategy.entry("Add", strategy.long , qty = lastordersize , when = true)
if(strategy.position_avg_price < close and strategy.position_size < 0)
strategy.entry("Add", strategy.short, qty = lastordersize , when = true)
if (strategy.position_size == 0)
if (Positive or ((ema21_5-low)/ema21_5) > 0.07)
strategy.entry("1St Entry", strategy.long , qty = lastordersize , when = true)
// and ((high-ema21_15)/ema21_15) > 0.077
if (Negative or ((high-ema21_5)/ema21_5) > 0.07)
strategy.entry("1St Entry", strategy.short, qty = lastordersize , when = true)
//lastordersize := lastordersize * 2
//or (strategy.openprofit / abs(strategy.position_size * close))>=0.01
if(cross(ema21_5, high) or cross(ema21_5, low))
strategy.close_all()