アルゴリズム RSI レンジブレイク戦略

作者: リン・ハーンチャオチャン,日付: 2023年10月17日 17:14:09
タグ:

img

概要

この戦略は,RSIインジケーターのブレイクアウトを異なる範囲で監視し,低値で購入し,高値で販売する.RSIが低値でロングになり,RSIが高値でショートになり,過剰購入または過剰販売の状況が現れるとポジションを逆転させる.

戦略の論理

  1. RSI 期間を 14 に設定する

  2. RSIの買い信号範囲を設定する:

    • 範囲1:RSI <= 27
    • RSI <= 18
  3. RSIのセールシグナル範囲を設定する:

    • RSI >= 68
    • RSI >= 80
  4. RSIが買い区間に入ると,ロング:

    • RSIが範囲 1 (27以下) に入ると,ロング 1 ロット
    • RSIが範囲2 (18以下) に入ると,追加ロング 1 ロット
  5. RSIが売り範囲に入ると ショート

    • RSIが範囲1 (68以上) に入ると,ショート 1 ロット
    • RSIが範囲2 (80以上) に入ると,追加ショート 1 ロット
  6. 2500ピップに利益と 5000ピップにストップロスを設定します

  7. RSIが信号範囲を外すとき,ポジションを閉じ

利点分析

  1. ダブルレンジ設定は,過買いと過売の状況をよりよく識別し,逆転の機会を逃すのを避けるのに役立ちます

  2. ピップで固定得益とストップ損失を導入することで,傾向を追求を過剰に防ぐことができます.

  3. RSI は,他の指標に優れている過買い値と過売値を特定する成熟した振動指標です.

  4. この戦略は,適切なパラメータ調整によって,トレンドの逆転点を効果的に捉え,過剰なリターンを生み出すことができます.

リスク分析

  1. 持続的なショートポジションから連続して損失をもたらすRSIの差異が起こる可能性があります.

  2. 固定得益とストップ損失は,市場の変動に合致しない可能性があり,利益を得ることができないか,早めに停止する可能性があります.

  3. 不適切な範囲設定は,取引を欠かしたり,収益を上げない取引を頻繁に行う可能性があります.

  4. この戦略は,バックテストに基づくパラメータ最適化に大きく依存している.注意深く歩いて前向きな分析が必要である.

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

  1. RSIの試験効果は,異なる期間の長さ

  2. 異なる製品の特徴に合うように,購入と販売範囲の値を最適化

  3. 収益性や合理性を向上させるため,利益とストップ損失を採取する研究動態

  4. 安定性を高めるため,他の指標を組み合わせることを検討する.

  5. 機械学習技術を探求し,安定性のためのパラメータ範囲を自動最適化する

結論

この戦略は,RSIの過剰購入と過剰売却の原則に基づいています.ダブルトレードレンジを採用することで,RSI指標を効果的に活用し,適正な安定性で市場の極端を把握しています.しかし,いくつかのパラメータ依存度があり,製品全体で最適化が必要です.適切に調整された場合,この戦略は良い過剰収益をもたらします.要約すると,成熟した指標を使用したシンプルで効果的な取引戦略であり,改善のために研究し,定量的な取引のための洞察を提供する価値があります.


/*backtest
start: 2023-09-16 00:00:00
end: 2023-10-16 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Rawadabdo

// Ramy's Algorithm

//@version=5
strategy("BTC/USD - RSI", overlay=false, initial_capital = 5000)

// User input
length = input(title = "Length", defval=14, tooltip="RSI period")

first_buy_level = input(title = "Buy Level 1", defval=27, tooltip="Level where 1st buy triggers")
second_buy_level = input(title = "Buy Level 2", defval=18, tooltip="Level where 2nd buy triggers")

first_sell_level = input(title = "Sell Level 1", defval=68, tooltip="Level where 1st sell triggers")
second_sell_level = input(title = "Sell Level 2", defval=80, tooltip="Level where 2nd sell triggers")

takeProfit= input(title="target Pips", defval=2500, tooltip="Fixed pip stop loss distance")
stopLoss = input(title="Stop Pips", defval=5000, tooltip="Fixed pip stop loss distance")

lot = input(title = "Lot Size", defval = 1, tooltip="Trading Lot size")

// Get RSI
vrsi = ta.rsi(close, length)

// Entry Conditions
long1 = (vrsi <= first_buy_level and vrsi>second_buy_level)
long2 = (vrsi <= second_buy_level)

short1= (vrsi >= first_sell_level and vrsi<second_sell_level)
short2= (vrsi >= second_sell_level)


// Entry Orders
// Buy Orders
if (long1 and strategy.position_size == 0)
    strategy.entry("Long", strategy.long, qty=lot, comment="Buy")
    if (long2 and  strategy.position_size == 0)
        strategy.entry("Long", strategy.long, qty=lot, comment="Buy")

// Short Orders
if (short1 and strategy.position_size == 0)
    strategy.entry("Short", strategy.short,qty=lot, comment="Sell")
    if (short2 and strategy.position_size == 0)
        strategy.entry("Short", strategy.short,qty=lot, comment="Sell")
    
// Exit our trade if our stop loss or take profit is hit
strategy.exit(id="Long Exit", from_entry="Long",qty = lot, profit=takeProfit, loss=stopLoss)
strategy.exit(id="Short Exit", from_entry="Short", qty = lot, profit=takeProfit, loss=stopLoss)

// plot data to the chart
hline(first_sell_level, "Overbought Zone", color=color.red, linestyle=hline.style_dashed, linewidth = 2)
hline(second_sell_level, "Overbought Zone", color=color.green, linestyle=hline.style_dashed, linewidth = 2)
hline(first_buy_level, "Oversold Zone", color=color.red, linestyle=hline.style_dashed, linewidth = 2)
hline(second_buy_level, "Oversold Zone", color=color.green, linestyle=hline.style_dashed, linewidth = 2)
plot (vrsi, title = "RSI", color = color.blue, linewidth=2)





もっと