マルチレベルRSI回帰取引戦略と動的ボラティリティ調整

RSI、PIVOT
作成日: 2024-06-21 14:16:31 最終変更日: 2024-06-21 14:16:31
コピー: 0 クリック数: 567
1
フォロー
1617
フォロワー

マルチレベルRSI回帰取引戦略と動的ボラティリティ調整

概要

この戦略は,RSI指標と価格変動に基づく多層の平均値回帰取引システムである.これは,RSIの極値と異常な大きな価格変動を入場シグナルとして利用し,ピラミッド式加仓とダイナミックストップを使用してリスクを管理し,収益を最適化します.この戦略の核心思想は,市場が極端な変動が発生したときに入場し,価格が正常レベルに戻ったときに利益を得ることです.

戦略原則

  1. 応募条件:

    • 20周期RSI ((RSI20) を主要指標として使用
    • 複数のRSIの値 ((3565, 3070, 2575, 2080) と相応の波動率の値を設定する
    • RSIが特定の値に達し,現在のK線実体サイズが対応する波動率の値を超えると,入場シグナルをトリガーします.
    • 追加条件: 価格が近年の高点/低点のサポート値を一定パーセント破る必要がある
  2. ギャンブル・メカニズム:

    • 最大5回の入場が許される ((初期入場+4回の加設)
    • RSIと波動率の条件を厳格に満たす必要があります
  3. 出場メカニズム:

    • 5つの異なるレベルの停止点を設定します.
    • ストップポイントは,入場時のサポート/レジスタンス位の動的計算に基づいています.
    • 持株数増加に伴い,ストップ目標が低下する.
  4. リスク管理:

    • パーセンテージ・リスク・モデルを使用して,取引毎のリスクは,総口座価値の20%に固定されます.
    • 設定最大同時保有額は 5 であり,総リスクの開口を制限します.

戦略的優位性

  1. 多層入り:複数のRSIと波動率の値を設定することで,戦略は異なるレベルの市場極端を捉え,取引機会を向上させる.

  2. ダイナミックストップ: サポート/レジスタンスポイントをベースに計算されたストップ,市場構造に合わせて自律的に調整することができ,利益を保護するとともに,早すぎる退場を防ぐ.

  3. ピラミッド式加仓:トレンドが継続する時に保有額を増やすことで,収益の可能性を大幅に高めることができる.

  4. リスク管理: 固定されたリスク比率と最大保有額を設定し,取引毎と全体的なリスクを効果的に管理する.

  5. 柔軟性:多くの調整可能なパラメータにより,戦略は異なる市場環境と取引品種に適応できます.

  6. 平均回帰+トレンド追跡: 平均回帰とトレンド追跡の優位性を組み合わせて,短期的な反転を捉えながらも大きなトレンドを逃さない.

戦略リスク

  1. 過剰取引:高波動の市場で取引シグナルが頻繁に発生し,手数料が高くなる可能性があります.

  2. 偽の突破: 市場が短期的な極端な波動の後,誤った信号を発生させるため,急速な回調を起こす可能性があります.

  3. 連続損失:市場が一方的な動きを続けると,重複したポジショニングで大損が起こりうる.

  4. パラメータの感受性:戦略のパフォーマンスは,パラメータの設定に非常に敏感であり,過適合のリスクがあります.

  5. スライドポイントの影響: 激しい波動期には,戦略のパフォーマンスを影響する深刻なスライドポイントに直面する可能性があります.

  6. 市場環境依存性:戦略は,低波動性または強いトレンド市場などの特定の市場環境で不良なパフォーマンスを発揮することがあります.

戦略最適化の方向性

  1. 動的パラメータ調整:自調メカニズムを導入し,市場状況に応じてRSIと波動率の値を動的に調整する.

  2. 多時間周期分析:より長期の市場動向の判断と組み合わせて,入場品質を向上させる.

  3. ストップ・オプティミゼーション: 追跡ストップまたはATRベースのダイナミック・ストップを追加し,リスクをさらに制御する.

  4. 市場状況フィルター:トレンドの強さ,波動率の周期などのフィルター条件を追加し,不適切な市場環境で取引を避ける.

  5. 資金管理の最適化:異なるレベルのシグナルに応じて取引規模を調整するなど,より詳細なポジション管理を実現する.

  6. 機械学習統合:機械学習アルゴリズムを使用してパラメータ選択と信号生成プロセスを最適化する.

  7. 関連性分析:他の資産との関連性分析を組み込み,戦略の安定性と多様性を高めます.

要約する

この多層RSI回帰取引戦略は,技術分析,ダイナミックリスク管理,ピラミッド式加減技術を巧みに組み合わせた精巧な設計された量化取引システムである.市場の極端な変動を捕捉し,価格が回帰するときに利益を得ることで,戦略は強い利益の潜在性を示している.しかしながら,過剰取引や市場環境依存などの課題にも直面している.

ストラテジーソースコード
/*backtest
start: 2024-05-01 00:00:00
end: 2024-05-31 23:59:59
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=5
strategy('Retorno_Pivots_5min_Novo_v3.3')

// Input variables
bars_left1 = input(1, title = "Entry - Pivot Left Bars")
bars_right1 = input(1, title = "Entry - Pivot Right Bars")
rsi20_longentry0 = input(35, title = "Entry 1 - RSI20 Long")
rsi20_shortentry0 = input(65, title = "Entry 1 - RSI20 Short")
bar_size_entry0 = input.float(1, title="Entry 1 - Bar Size")
rsi20_longentry1 = input(30, title = "Entry 2 - RSI20 Long")
rsi20_shortentry1 = input(70, title = "Entry 2 - RSI20 Short")
bar_size_entry1 = input.float(0.8, title="Entry 2 - Bar Size")
rsi20_longentry2 = input(25, title = "Entry 3 - RSI20 Long")
rsi20_shortentry2 = input(75, title = "Entry 3 - RSI20 Short")
bar_size_entry2 = input.float(0.7, title="Entry 3 - Bar Size")
rsi20_longentry3 = input(20, title = "Entry 4 - RSI20 Long")
rsi20_shortentry3 = input(80, title = "Entry 4 - RSI20 Short")
bar_size_entry3 = input.float(0.5, title="Entry 4 - Bar Size")
limit_perc1 = input.float(0.60, title="Profit Range 1")
limit_perc2 = input.float(0.40, title="Profit Range 2")
limit_perc3 = input.float(0.20, title="Profit Range 3")
limit_perc4 = input.float(0.00, title="Profit Range 4")
limit_perc5 = input.float(0.00, title="Profit Range 5")
minimum_pivot_distance = input.float(0, title="Minimum Pivot Distance %")
barsize_1h_input = input(288, title="Highest Bar Lookback")
rsi20 = ta.rsi(close, 20)
rsi200 = ta.rsi(close, 200)
Pivot_High_Last1 = ta.valuewhen(ta.pivothigh(high, bars_left1, bars_right1), ta.pivothigh(high, bars_left1, bars_right1), 0)
Pivot_Low_Last1 = ta.valuewhen(ta.pivotlow(low, bars_left1, bars_right1), ta.pivotlow(low, bars_left1, bars_right1), 0)

barsize = math.abs(close - open)
barsize_1h = ta.highest(barsize, barsize_1h_input)

Bar0Long = rsi20 < rsi20_longentry0 and barsize >= (barsize_1h * bar_size_entry0)
Bar1Long = rsi20 < rsi20_longentry1 and barsize >= (barsize_1h * bar_size_entry1)
Bar2Long = rsi20 < rsi20_longentry2 and barsize >= (barsize_1h * bar_size_entry2)
Bar3Long = rsi20 < rsi20_longentry3 and barsize >= (barsize_1h * bar_size_entry3)

// Long Entries
Long_Entry1 = strategy.opentrades == 0 and rsi20 < rsi20[1] and ((rsi20 < rsi20_longentry0 and barsize >= (barsize_1h * bar_size_entry0)) or (rsi20 < rsi20_longentry1 and barsize >= (barsize_1h * bar_size_entry1)) or (rsi20 < rsi20_longentry2 and barsize >= (barsize_1h * bar_size_entry2)) or (rsi20 < rsi20_longentry3 and barsize >= (barsize_1h * bar_size_entry3))) and close < (Pivot_Low_Last1 * (1 - (minimum_pivot_distance / 100)))
Long_Entry2 = strategy.opentrades == 1 and strategy.position_size > 0 and rsi20 < rsi20[1] and (Bar0Long or Bar1Long or Bar2Long or Bar3Long)
Long_Entry3 = strategy.opentrades == 2 and strategy.position_size > 0 and rsi20 < rsi20[1] and (Bar0Long or Bar1Long or Bar2Long or Bar3Long)
Long_Entry4 = strategy.opentrades == 3 and strategy.position_size > 0 and rsi20 < rsi20[1] and (Bar0Long or Bar1Long or Bar2Long or Bar3Long)
Long_Entry5 = strategy.opentrades == 4 and strategy.position_size > 0 and rsi20 < rsi20[1] and (Bar0Long or Bar1Long or Bar2Long or Bar3Long)
if Long_Entry1 or Long_Entry2 or Long_Entry3 or Long_Entry4 or Long_Entry5
    strategy.entry("Long", strategy.long, comment = "ENTER-LONG_BINANCE-FUTURES_BTCBUSD_Bot-BTC-1min_1M_970d2ee265390c27")
// Longs Exits
Long_Exit1 = strategy.opentrades == 1 and close > (strategy.position_avg_price + ((ta.valuewhen(strategy.opentrades == 0, Pivot_Low_Last1, 0) - (strategy.position_avg_price)) * limit_perc1))
Long_Exit2 = strategy.opentrades == 2 and close > (strategy.position_avg_price + ((ta.valuewhen(strategy.opentrades == 0, Pivot_Low_Last1, 0) - (strategy.position_avg_price)) * limit_perc2))
Long_Exit3 = strategy.opentrades == 3 and close > (strategy.position_avg_price + ((ta.valuewhen(strategy.opentrades == 0, Pivot_Low_Last1, 0) - (strategy.position_avg_price)) * limit_perc3))
Long_Exit4 = strategy.opentrades == 4 and close > (strategy.position_avg_price + ((ta.valuewhen(strategy.opentrades == 0, Pivot_Low_Last1, 0) - (strategy.position_avg_price)) * limit_perc4))
Long_Exit5 = strategy.opentrades == 5 and close > (strategy.position_avg_price + ((ta.valuewhen(strategy.opentrades == 0, Pivot_Low_Last1, 0) - (strategy.position_avg_price)) * limit_perc5))
if Long_Exit1 or Long_Exit2 or Long_Exit3 or Long_Exit4 or Long_Exit5
    strategy.close("Long", comment = "EXIT-LONG_BINANCE-FUTURES_BTCBUSD_Bot-BTC-1min_1M_970d2ee265390c27")

Bar0Short = rsi20 > rsi20_shortentry0 and barsize >= (barsize_1h * bar_size_entry0)
Bar1Short = rsi20 > rsi20_shortentry1 and barsize >= (barsize_1h * bar_size_entry1)
Bar2Short = rsi20 > rsi20_shortentry2 and barsize >= (barsize_1h * bar_size_entry2)
Bar3Short = rsi20 > rsi20_shortentry3 and barsize >= (barsize_1h * bar_size_entry3)

// Short Entries
Short_Entry1 = strategy.opentrades == 0 and rsi20 > rsi20[1] and ((rsi20 > rsi20_shortentry0 and barsize >= (barsize_1h * bar_size_entry0)) or (rsi20 > rsi20_shortentry1 and barsize >= (barsize_1h * bar_size_entry1)) or (rsi20 > rsi20_shortentry2 and barsize >= (barsize_1h * bar_size_entry2)) or (rsi20 > rsi20_shortentry2 and barsize >= (barsize_1h * bar_size_entry2))) and close > (Pivot_High_Last1 * (1 + (minimum_pivot_distance / 100)))
Short_Entry2 = strategy.opentrades == 1 and strategy.position_size < 0 and rsi20 > rsi20[1] and (Bar0Short or Bar1Short or Bar2Short or Bar3Short)
Short_Entry3 = strategy.opentrades == 2 and strategy.position_size < 0 and rsi20 > rsi20[1] and (Bar0Short or Bar1Short or Bar2Short or Bar3Short)
Short_Entry4 = strategy.opentrades == 3 and strategy.position_size < 0 and rsi20 > rsi20[1] and (Bar0Short or Bar1Short or Bar2Short or Bar3Short)
Short_Entry5 = strategy.opentrades == 4 and strategy.position_size < 0 and rsi20 > rsi20[1] and (Bar0Short or Bar1Short or Bar2Short or Bar3Short)
if Short_Entry1 or Short_Entry2 or Short_Entry3 or Short_Entry4 or Short_Entry5
    strategy.entry("Short", strategy.short, comment = "ENTER-SHORT_BINANCE-FUTURES_BTCBUSD_Bot-BTC-1min_1M_970d2ee265390c27")
// Short Exits
Short_Exit1 = strategy.opentrades == 1 and close < (strategy.position_avg_price - ((strategy.position_avg_price - ta.valuewhen(strategy.opentrades == 0, Pivot_High_Last1, 0)) * limit_perc1))
Short_Exit2 = strategy.opentrades == 2 and close < (strategy.position_avg_price - ((strategy.position_avg_price - ta.valuewhen(strategy.opentrades == 0, Pivot_High_Last1, 0)) * limit_perc2))
Short_Exit3 = strategy.opentrades == 3 and close < (strategy.position_avg_price - ((strategy.position_avg_price - ta.valuewhen(strategy.opentrades == 0, Pivot_High_Last1, 0)) * limit_perc3))
Short_Exit4 = strategy.opentrades == 4 and close < (strategy.position_avg_price - ((strategy.position_avg_price - ta.valuewhen(strategy.opentrades == 0, Pivot_High_Last1, 0)) * limit_perc4))
Short_Exit5 = strategy.opentrades == 5 and close < (strategy.position_avg_price - ((strategy.position_avg_price - ta.valuewhen(strategy.opentrades == 0, Pivot_High_Last1, 0)) * limit_perc5))
if Short_Exit1 or Short_Exit2 or Short_Exit3 or Short_Exit4 or Short_Exit5
    strategy.close("Short", comment = "EXIT-SHORT_BINANCE-FUTURES_BTCBUSD_Bot-BTC-1min_1M_970d2ee265390c27")

// Plots
plot(rsi20, color=color.new(#fbff00, 0), linewidth=2)
plot(((strategy.position_avg_price + ((ta.valuewhen(strategy.opentrades == 0, Pivot_Low_Last1, 0) - (strategy.position_avg_price)) * limit_perc1))), color=color.new(#00ff2a, 0), linewidth=2)
plot(((strategy.position_avg_price + ((ta.valuewhen(strategy.opentrades == 0, Pivot_Low_Last1, 0) - (strategy.position_avg_price)) * limit_perc2))), color=color.new(#00ff2a, 50), linewidth=2)
plot(((strategy.position_avg_price + ((ta.valuewhen(strategy.opentrades == 0, Pivot_Low_Last1, 0) - (strategy.position_avg_price)) * limit_perc3))), color=color.new(#00ff2a, 80), linewidth=2)
plot(((strategy.position_avg_price + ((ta.valuewhen(strategy.opentrades == 0, Pivot_Low_Last1, 0) - (strategy.position_avg_price)) * limit_perc4))), color=color.new(#00ff2a, 100), linewidth=2)
plot((strategy.position_avg_price - ((strategy.position_avg_price - ta.valuewhen(strategy.opentrades == 0, Pivot_High_Last1, 0)) * limit_perc1)), color=color.new(#ff0000, 0), linewidth=2)
plot((strategy.position_avg_price - ((strategy.position_avg_price - ta.valuewhen(strategy.opentrades == 0, Pivot_High_Last1, 0)) * limit_perc2)), color=color.new(#ff0000, 50), linewidth=2)
plot((strategy.position_avg_price - ((strategy.position_avg_price - ta.valuewhen(strategy.opentrades == 0, Pivot_High_Last1, 0)) * limit_perc3)), color=color.new(#ff0000, 80), linewidth=2)
plot((strategy.position_avg_price - ((strategy.position_avg_price - ta.valuewhen(strategy.opentrades == 0, Pivot_High_Last1, 0)) * limit_perc4)), color=color.new(#ff0000, 100), linewidth=2)
plot(strategy.position_avg_price, color=color.new(#ffc400, 0), linewidth=2)
plot(strategy.opentrades * (strategy.position_size / math.abs(strategy.position_size)), color=color.new(#ff00bb, 0), linewidth=2)
plot(((barsize / barsize_1h) * 100), color=color.new(#0000ff, 0), linewidth=2)