
RSIブレークストラテジーとは,相対的に強い指数 (RSI) の指標に基づく量化取引戦略である.この戦略は,RSIが買取区間と売出区間を超えた値を設定することで,RSIがこれらの値を破るときに取引信号を生成します.すなわち,RSIが30を下回るときは多出し,RSIが70を超えると空出します.
RSI突破策の核心思想は,RSI指標を使用して市場の超買超売現象を判断することです. RSIは,期間中の平均上昇と平均低下の比率を計算することによって,株式の最近の強弱状態を反映します. 一般的に,RSIが30未満は超売現象とみなされ,70以上の超買現象とみなされます.
この戦略は,まず,RSIの超売り線と超買線を設定し,30と70をデフォルトします. そして,RSIのラインの動作をリアルタイムで監視します. RSIが上から下へ70の値を破るとき,売り込みシグナルが生じます. この時点で,市場は超買い領域に入っていると判断し,予想される高値の逆転が起こりやすいので,売り込みの操作をします. 逆に,RSIが下から上から30の値を破るとき,買い込みシグナルが生じます.
このようにして,ストラテジーは,株価の波動の過程で価格の転換点を捕捉し,オーバーバイオーバーセールが発生したときに,タイミングでポジションを調整して,オッパイオッパイオッパイオッパイオッパイオッパイオッパイオッパイオッパイオッパイオッパイオッパイオッパイオッパイオッパイオッパイオッパイオッパイオッパイオッパイオッパイオッパイオッパイオッパイオッパイオッパイオッパイオッパイオッパイオッパイオッパイオッパイオッパイオッパイオッパイオッパイオッパイオッパイオッパイオッパイオッパイオッパイオッパイオッパイオッパイオッパイオッパイオッパイオッパイオッパイオッパイオッパイオッパイオッパイオッパイオッパイオッパイオッパイオッパイオッパイオッパイオッパイオッパイオッパイオッパイオッパイオッパイオッパイオッパイオッパイオ
RSIの突破策には以下の利点があります.
操作信号は単純明快である。RSI指標は計算しやすく,理解しやすく,その指標線を突破すると設定された値の上下限を観察するだけでよい。指標突破が起きたときに操作できる,複雑な取引ルールはない。
完全に量化され,反測効果が優れている.この戦略は,RSI指標から取引信号を抽出し,人工の介入や判断を必要とせず,容易に自動取引を実現することができる.同時に,RSIの超買い超売り信号効果が優れている.戦略反測もかなりの利益を示している.
柔軟性 取引者はRSIパラメータを柔軟に調整できます.例えば,過剰買いと過剰売りの値を調整して,異なる株式と市場の特徴に合わせて調整できます.
RSIの破綻策には,以下のリスクがあります.
ウィップソーが形成されやすい.指標が上下振動するときは,頻繁にブレイク取引シグナルを触発する.このとき,戦略は,安定した利益を得るために不利な無効取引を過剰に発生させる.パラメータを適切に調整して,部分的な振動シグナルをフィルターすることができます.
市場動向を判断できない。RSIは超買い超売り状態からしか取引シグナルを生成し,大きな動向を判断する能力は弱い。戦略は,震動の状況で簡単に閉じ込められる。トレンド指標と連携してフィルタリングし,逆転取引を避ける。
引き下がるリスクが高い. RSIは,価格が上昇し続け,RSI指標が下方になるという多角的な逸脱行動を示すことがよくあります. この時,戦略が空調で大傾向から逸脱すると,大きな損失に直面します.
RSIの突破策は,以下の次元から最適化できます.
複数の指標を総合的に考慮し,単一のRSI指標の限界を避ける.例えば,移動平均指標を組み合わせて市場の傾向を判断するか,強い指標,交付量指標を使用して,取引信号を組み合わせてフィルタリングする.
戦略の安定性を高めるためにRSIパラメータを最適化します. 超買超売の値の調整,取引信号の持続時間設定などが含まれます. テストによって最適なパラメータを取得し,多くの無効信号をフィルターします.
リスク管理のためにストップ・ストップ条件を設定する.例えば,パーセンテージまたはポイントストップを設定する.単一の損失が全体利益にあまりにも大きな影響を与えないようにする.そして,トレンドと重要な技術位置を組み合わせて,パート・プロフィットを行う.
RSIブレークストラテジーは,超買い超売り現象を利用して逆転取引を行う量化戦略である.戦略信号は単純で明確で,完全に量化され,カスタマイズ可能である.しかし,一定のウィップソーリスクと撤回リスクもある.指標のポートフォリオの最適化とリスク管理などの方法によって,RSIブレークストラテジーは,安定した信頼性の高い量化システムに最適化することができる.
/*backtest
start: 2023-11-21 00:00:00
end: 2023-12-21 00:00:00
period: 2h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
// @version=4
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Bunghole 2021
strategy(title="My New Strategy", initial_capital = 100000, default_qty_type = strategy.percent_of_equity, default_qty_value = 100, pyramiding = 0, currency = 'USD', overlay=true)
//// Stoploss and Take Profit Parameters
// Enable Long Strategy
enable_long_strategy = input(true, title="Enable Long Strategy", group="SL/TP For Long Strategy",inline="1")
long_stoploss_value = input(defval=50, title='Stoploss %', type=input.float, minval=0.1, group="SL/TP For Long Strategy",inline="2")
long_stoploss_percentage = (close * (long_stoploss_value / 100)) / syminfo.mintick
long_takeprofit_value = input(defval=50, title='Take Profit %', type=input.float, minval=0.1, group="SL/TP For Long Strategy",inline="2")
long_takeprofit_percentage = (close * (long_takeprofit_value / 100)) / syminfo.mintick
// Enable Short Strategy
enable_short_strategy = input(true, title="Enable Short Strategy", group="SL/TP For Short Strategy",inline="3")
short_stoploss_value = input(defval=50, title='Stoploss %', type=input.float, minval=0.1, group= "SL/TP For Short Strategy",inline="4")
short_stoploss_percentage = (close * (short_stoploss_value / 100)) / syminfo.mintick
short_takeprofit_value = input(defval=50, title='Take Profit %', type=input.float, minval=0.1, group="SL/TP For Short Strategy",inline="4")
short_takeprofit_percentage = (close * (short_takeprofit_value / 100)) / syminfo.mintick
// Plot Stoploss & Take Profit Levels
long_stoploss_price = strategy.position_avg_price * (1 - long_stoploss_value/100)
long_takeprofit_price = strategy.position_avg_price * (1 + long_takeprofit_value/100)
short_stoploss_price = strategy.position_avg_price * (1 + short_stoploss_value/100)
short_takeprofit_price = strategy.position_avg_price * (1 - short_takeprofit_value/100)
plot(enable_long_strategy and not enable_short_strategy ? long_stoploss_price: na, color=#ff0000, style=plot.style_linebr, linewidth=2, title="Long SL Level")
plot(enable_long_strategy and not enable_short_strategy ? long_takeprofit_price: na, color=#008000, style=plot.style_linebr, linewidth=2, title="Long TP Level")
plot(enable_short_strategy and not enable_long_strategy ? short_stoploss_price: na, color=#ff0000, style=plot.style_linebr, linewidth=2, title="Short SL Level")
plot(enable_short_strategy and not enable_long_strategy ? short_takeprofit_price: na, color=#008000, style=plot.style_linebr, linewidth=2, title="Short TP Level")
// Date Range
start_date = input(title="Start Date", type=input.integer, defval=1, minval=1, maxval=31, group="Date Range")
start_month = input(title="Start Month", type=input.integer, defval=1, minval=1, maxval=12, group="Date Range")
start_year = input(title="Start Year", type=input.integer, defval=1804, minval=1800, maxval=3000, group="Date Range")
end_date = input(title="End Date", type=input.integer, defval=1, minval=1, maxval=3, group="Date Range")
end_month = input(title="End Month", type=input.integer, defval=1, minval=1, maxval=12, group="Date Range")
end_year = input(title="End Year", type=input.integer, defval=2077, minval=1800, maxval=3000, group="Date Range")
in_date_range = (time >= timestamp(syminfo.timezone, start_year, start_month, start_date, 0, 0)) and (time < timestamp(syminfo.timezone, end_year, end_month, end_date, 0, 0))
//// Inputs **This is where you enter your indicators for your strategy. For example, I added the RSI indicator.**
//RSI
rsi = rsi(close, 14)
rsi_over_sold = rsi < 30
rsi_over_bought = rsi > 70
//// Strategy **This is where you create your strategy. For example, We have or buy and sell signals.**
// Creating Long and Short Strategy
buy_signal = rsi_over_sold
sell_signal = rsi_over_bought
// Long Strategy
if buy_signal and in_date_range and enable_long_strategy == true
strategy.entry("Long", true, when=buy_signal, alert_message="Open Long Position")
strategy.exit("Long SL/TP", from_entry="Long", loss=long_stoploss_percentage, profit=long_takeprofit_percentage, alert_message="Your Long SL/TP Limit As Been Triggered.")
strategy.close("Long", when=sell_signal, alert_message="Close Long Position")
// Short Strategy
if sell_signal and in_date_range and enable_short_strategy == true
strategy.entry("Short", false, when = sell_signal, alert_message="Open Short Position")
strategy.exit("Short SL/TP", from_entry="Short", loss=short_stoploss_percentage, profit=short_takeprofit_percentage, alert_message="Your Short SL/TP Limit As Been Triggered.")
strategy.close("Short", when=buy_signal, alert_message="Close Short Position")