2倍速RSI突破戦略

作者: リン・ハーンチャオチャン, 日付: 2023年11月7日 16:56:39
タグ:

img

概要

この戦略では,複数のRSIインジケーターを使用して,より正確なエントリーと出口信号を生成するために価格突破を実装します.

戦略の論理

この戦略は,RSIパラメータの2つのグループを設定します. 1つは7の期間と25の制限,もう1つは14の期間と25の制限です.価格がRSIの制限を破ると,ロングまたはショートオーダーが実行されます.

この戦略は,まず2つのRSI指標の値を計算し,価格がRSI上限または下限を突破するかどうかを判断する.上限を突破した場合,ロング信号が生成される.下限を突破した場合,ショート信号が生成される.

ポジションが既に設定されている場合,現在のRSIが通常の範囲内にあるかどうかを判断し続けます.RSIが正常になり,ボディが移動平均の半分を突破した場合,出口信号が生成されます.

この戦略はマルティンゲールシステムも使っています.各損失後にオーダーのサイズは倍になります.

利点分析

  • 2つのRSIインジケーターを使うと 突破信号を判断し 誤った信号を避けることができます

  • また,ボディブレークスルーをチェックすることで 統合中に間違った取引を避けることができます

  • マルティンゲルは損失後にすぐに損失を止めるのに役立ちます

  • カスタマイズ可能なRSIパラメータは 入場機会を最適化します

  • 大事な出来事の影響を避けるため,取引セッションは制限することができます.

リスク分析

  • 二重RSIは 誤った突破を完全に避けることはできません

  • マルティンゲルは損失の後 ポジションを増やし 爆発する危険を冒します

  • 取引コストは考慮されません.

  • 最適化可能なパラメータが多すぎるため 最適な組み合わせを見つけるために 多くのテストが必要です

損失を制限するためにストップロスを設定し,RSIパラメータを最適化し,コスト考慮を追加し,突破基準を緩和することができます.

オプティマイゼーションの方向性

  • 最大損失を制限するためにストップ損失を追加します.

  • 誤った信号を減らすために RSI パラメータを最適化します

  • 過剰取引を防ぐために取引コストの影響を検討します.

  • もっと多くの機会を得るための 身体の突破基準を緩めましょう

  • 閉じ込められないように フィルターを追加します

概要

この戦略は,価格突破率を決定するために二重RSIを使用し,ウィップソーを避けるためにボディ突破フィルターを追加する.また,損失を迅速に削減するためにマルティンゲールを使用する.この戦略は,パラメータを最適化し,より正確なシグナルのためのフィルターを追加することによって改善することができる.リスク管理は損失を制限するために重要です.全体的にこの戦略は,高効率の取引に適した比較的安定した突破システムを提供します.


/*backtest
start: 2023-10-30 00:00:00
end: 2023-11-06 00:00:00
period: 15m
basePeriod: 5m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//Noro
//2018

//@version=2
strategy(title = "Noro's Fast RSI Strategy v2.0", shorttitle = "Fast RSI str 2.0", overlay = true)

//Settings
needlong = input(true, defval = true, title = "Long")
needshort = input(true, defval = true, title = "Short")
usemar = input(false, defval = false, title = "Use Martingale")
capital = input(100, defval = 100, minval = 1, maxval = 10000, title = "Capital, %")
usersi1 = input(true, defval = true, title = "Use RSI #1")
rsiperiod1 = input(7, defval = 7, minval = 2, maxval = 50, title = "#1 RSI Period")
rsilimit1 = input(25, defval = 25, minval = 1, maxval = 100, title = "#1 RSI limit")
usersi2 = input(true, defval = true, title = "Use RSI #2")
rsiperiod2 = input(14, defval = 14, minval = 2, maxval = 50, title = "#2 RSI Period")
rsilimit2 = input(25, defval = 25, minval = 1, maxval = 100, title = "#2 RSI limit")
showarr = input(false, defval = false, title = "Show Arrows")
fromyear = input(2018, defval = 2018, minval = 1900, maxval = 2100, title = "From Year")
toyear = input(2100, defval = 2100, minval = 1900, maxval = 2100, title = "To Year")
frommonth = input(01, defval = 01, minval = 01, maxval = 12, title = "From Month")
tomonth = input(12, defval = 12, minval = 01, maxval = 12, title = "To Month")
fromday = input(01, defval = 01, minval = 01, maxval = 31, title = "From day")
today = input(31, defval = 31, minval = 01, maxval = 31, title = "To day")

//RSI #1
uprsi1 = rma(max(change(close), 0), rsiperiod1)
dnrsi1 = rma(-min(change(close), 0), rsiperiod1)
rsi1 = dnrsi1 == 0 ? 100 : uprsi1 == 0 ? 0 : 100 - (100 / (1 + uprsi1 / dnrsi1))
uplimit1 = 100 - rsilimit1
dnlimit1 = rsilimit1

//RSI #2
uprsi2 = rma(max(change(close), 0), rsiperiod2)
dnrsi2 = rma(-min(change(close), 0), rsiperiod2)
rsi2 = dnrsi2 == 0 ? 100 : uprsi2 == 0 ? 0 : 100 - (100 / (1 + uprsi2 / dnrsi2))
uplimit2 = 100 - rsilimit2
dnlimit2 = rsilimit2

//Body
body = abs(close - open)
abody = sma(body, 10)

//Signals
bar = close > open ? 1 : close < open ? -1 : 0
up1 = bar == -1 and (strategy.position_size == 0 or close < strategy.position_avg_price) and rsi1 < dnlimit1 and body > abody / 5 and usersi1
dn1 = bar == 1 and (strategy.position_size == 0 or close > strategy.position_avg_price) and rsi1 > uplimit1 and body > abody / 5 and usersi1
up2 = bar == -1 and (strategy.position_size == 0 or close < strategy.position_avg_price) and rsi2 < dnlimit2 and body > abody / 5 and usersi2
dn2 = bar == 1 and (strategy.position_size == 0 or close > strategy.position_avg_price) and rsi2 > uplimit2 and body > abody / 5 and usersi2
norma = rsi1 > dnlimit1 and rsi1 < uplimit1 and rsi2 > dnlimit2 and rsi2 < uplimit2
exit = (((strategy.position_size > 0 and bar == 1 and norma) or (strategy.position_size < 0 and bar == -1 and norma)) and body > abody / 2)

//Arrows
col = exit ? black : up1 or dn1 ? blue : up2 or dn2 ? red : na
needup = up1 or up2
needdn = dn1 or dn2
needexitup = exit and strategy.position_size < 0
needexitdn = exit and strategy.position_size > 0
plotarrow(showarr and needup ? 1 : na, colorup = blue, colordown = blue, transp = 0)
plotarrow(showarr and needdn ? -1 : na, colorup = blue, colordown = blue, transp = 0)
plotarrow(showarr and needexitup ? 1 : na, colorup = black, colordown = black, transp = 0)
plotarrow(showarr and needexitdn ? -1 : na, colorup = black, colordown = black, transp = 0)

//Trading
profit = exit ? ((strategy.position_size > 0 and close > strategy.position_avg_price) or (strategy.position_size < 0 and close < strategy.position_avg_price)) ? 1 : -1 : profit[1]
mult = usemar ? exit ? profit == -1 ? mult[1] * 2 : 1 : mult[1] : 1
lot = strategy.position_size == 0 ? strategy.equity / close * capital / 100 * mult : lot[1]

if up1 or up2
    if strategy.position_size < 0
        strategy.close_all()
        
    strategy.entry("Long", strategy.long, needlong == false ? 0 : lot)

if dn1 or dn2
    if strategy.position_size > 0
        strategy.close_all()
        
    strategy.entry("Short", strategy.short, needshort == false ? 0 : lot)
    
if  exit
    strategy.close_all()

もっと