
この戦略は,同時に3つの異なる周期のRSI指標を観察して,市場が超買い超売りの極限領域に達したかどうかを判断し,買いと売りのシグナルを発信する.市場動向を判断する主な方法は,異なる周期の指標の組み合わせを観察することによって実現する.
この戦略は,2周期,7周期および14周期のRSI指標を同時に利用する. 3つのRSI指標が同時にオーバーバイまたはオーバーセールシグナルを示すとき,取引シグナルを発信する.
具体的には,2周期RSIが10,7周期RSIが20,14周期RSIが30未満であるとき,市場が超売り状態にあると考えられ,買入シグナルを発出する.
コード内のaccuracyパラメータによりRSIの超買超売判断を微調整する値下げをデフォルトで3と仮定し,数値が小さいほど,超買超売判断はより厳格である。strategy.longとstrategy.shortは,対応する方向の取引が行われているかどうかを制御するために使用される。
買入または売却のシグナルを発信した後に,価格が逆転して当日の開場価格を突破した場合,現在のポジションを平らにして,トレンド追跡ストップを適用します.
多周期RSIの組み合わせにより,市場の過剰買いと過剰売り状態をより正確に判断し,偽の信号をフィルターすることができます.
異なるパラメータを微調整して超買超売判断条件を採用し,市場に応じて戦略の感度調整することができる.
営業価格のストップ・トラッキングを実施し,タイムリーにストップ・損失を発生させ,利益をロックする.
RSI指標は,市場トレンドの転換を判断する際に,誤差を起こすことが容易である.
RSIの設定は,波動的な状況に合わせて調整する必要があります.
トリプルRSIが同時に発覚するケースは少なく,良い取引機会を逃す可能性があります.
過剰購入と過剰販売の判断のパラメータを適切に調整し,異なる市場のデータ効果をテストすることをお勧めします.
他の指標,ブリンライン,KDJなどの追加も検討できます.
RSIのパラメータは,状況の種類によって自動的に最適化されます.
ATR停止など,他の止損出出路条件をテストすることができる.
取引のタイミングをフィルターする条件を追加して,不適切なタイミングを回避できます.
この戦略は,多周期RSI指標を組み合わせて超買い超売り領域を判断し,トレンド追跡ストップを実施する.優点は判断精度を向上させ,タイムリーでストップする;欠点は漏れやすいし,RSI指標は誤判しやすい.パラメータ最適化テストを行い,他の指標に付加して確認することが推奨され,よりよい効果が得られる.
/*backtest
start: 2023-10-25 00:00:00
end: 2023-10-28 10:00:00
period: 1m
basePeriod: 1m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=3
strategy(title = "Noro's Triple RSI Top/Bottom", shorttitle = "3RSI Top/Bottom", overlay = true, default_qty_type = strategy.percent_of_equity, default_qty_value = 100, pyramiding = 0)
//Settings
needlong = input(true, defval = true, title = "Long")
needshort = input(true, defval = true, title = "Short")
accuracy = input(3, defval = 3, minval = 1, maxval = 10, title = "accuracy")
fromyear = input(1900, defval = 1900, 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-2
fastup = rma(max(change(close), 0), 2)
fastdown = rma(-min(change(close), 0), 2)
fastrsi = fastdown == 0 ? 100 : fastup == 0 ? 0 : 100 - (100 / (1 + fastup / fastdown))
//RSI-7
middleup = rma(max(change(close), 0), 7)
middledown = rma(-min(change(close), 0), 7)
middlersi = middledown == 0 ? 100 : middleup == 0 ? 0 : 100 - (100 / (1 + middleup / middledown))
//RSI-14
slowup = rma(max(change(close), 0), 14)
slowdown = rma(-min(change(close), 0), 14)
slowrsi = slowdown == 0 ? 100 : slowup == 0 ? 0 : 100 - (100 / (1 + slowup / slowdown))
//Signals
acc = 10 - accuracy
up = fastrsi < (5 + acc) and middlersi < (10 + acc * 2) and slowrsi < (15 + acc * 3)
dn = fastrsi > (95 - acc) and middlersi > (90 - acc * 2) and slowrsi > (85 - acc * 3)
exit = (strategy.position_size > 0 and close > open) or (strategy.position_size > 0 and close > open)
//Trading
if up
if strategy.position_size < 0
strategy.close_all()
strategy.entry("Bottom", strategy.long, needlong == false ? 0 : na, when=(time > timestamp(fromyear, frommonth, fromday, 00, 00) and time < timestamp(toyear, tomonth, today, 23, 59)))
if dn
if strategy.position_size > 0
strategy.close_all()
strategy.entry("Top", strategy.short, needshort == false ? 0 : na, when=(time > timestamp(fromyear, frommonth, fromday, 00, 00) and time < timestamp(toyear, tomonth, today, 23, 59)))
if time > timestamp(toyear, tomonth, today, 23, 59) or exit
strategy.close_all()