
この策略はStochRSI指標に基づいて開発された. この策略は,StochRSI指標を主に超買超売り状況を判断するために使用し,RSI指標と組み合わせて,偽の信号をフィルターし,StochRSI指標が超売り領域を示しているときに空売りし,超売り領域を示しているときに多売りし,利益を実現する.
この戦略は,市場が超買い超売り領域を判断するためにStochRSI指標を主に使用する.StochRSI指標は,K線とD線で構成され,K線は,RSIの値が最近の一期間のRSI価格範囲内の位置を反映し,D線はK線の移動平均である.K線上をD線を横切るときは,超売り領域であり,このとき多めにすることができる.K線下をD線を横切るときは,超売り領域であり,このとき空にすることができる.
具体的には,戦略は,長さ14のRSI指標の値を最初に計算し,RSI指標にStochRSI指標を適用する.StochRSI指標のパラメータの設定長さは14,平滑周期K線は3で,D線も3である.K線上のユーザが設定した超売り領域 ((デフォルト1) を通過すると,多めに行います.K線の下のユーザが設定した超売り領域 ((デフォルト99) を通過すると,空になります.
さらに,策略は止損と停止パラメータを設定した. 止損パラメータは,デフォルトで10000; 停止は,パラメータに基づいて曲線トレーリングストップに設定され,デフォルトのトレーリングポイントは300で,偏移量は0である.
上記のリスクに対して,より長いパラメータ周期を設定したり,他の指標の組み合わせでフィルタリングシグナルを使用することを検討したり,多買多売パラメータを異なる市場に対応するように調整したり,異なるストップ・ロストパラメータをテストしたりすることができます.
この戦略は,StochRSI指標に基づいて,超買い超売り領域を判断する取引を行う.単一のRSI指標と比較して,StochRSIは,KDJの思想を組み合わせて,ターニングポイントをより正確に判断することができます.同時に,RSIフィルター偽信号を組み合わせて,ストップ・ストップ・コントロールのリスクを設定します.最適化スペースは広く,他の指標の組み合わせで使用できます.または最適化パラメータの設定です.
/*backtest
start: 2023-11-06 00:00:00
end: 2023-12-06 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version= 2
strategy("STOCHRSI JURE", overlay=false)
lengthrsi = input(10)
overSold = input( 1 )
overBought = input(99)
call_trail_stop = input(300)
call_trail_offset = input(0)
call_sl = input(10000)
price = ohlc4
vrsi = rsi(price, lengthrsi)
smoothK = input(3, minval=1)
smoothD = input(3, minval=1)
lengthRSI = input(14, minval=1)
lengthStoch = input(14, minval=1)
src = input(close, title="RSI Source")
rsi1 = rsi(src, lengthRSI)
k = sma(stoch(rsi1, rsi1, rsi1, lengthStoch), smoothK)
d = sma(k, smoothD)
plot( k, color=blue, linewidth=1, title="K")
plot( d, color=red, linewidth=1, title="D")
if (crossover(k, overSold) )
strategy.entry("BUY", strategy.long, stop=close, oca_name="TREND", comment="BUY")
strategy.exit("BUY EXIT", "BUY", trail_points=call_trail_stop, trail_offset=call_trail_offset, loss = call_sl)
if (crossunder(k, overBought) )
strategy.entry("SELL", strategy.short,stop=close, oca_name="TREND", comment="SELL")
strategy.exit("SELL EXIT", "SELL", trail_points=call_trail_stop, trail_offset=call_trail_offset, loss = call_sl)
//if ( ( crossover(k,d)) and ( (vrsi<overSold) or crossover(vrsi,overSold) ) and year >= yearfrom and year <= yearuntil and month>=monthfrom and month <=monthuntil and dayofmonth>=dayfrom and dayofmonth < dayuntil)
// strategy.entry("BUY", strategy.long, stop=close, oca_name="TREND", oca_type=strategy.oca.cancel, comment="BUY")
//else
// strategy.cancel(id="BUY")
//if ( ( crossunder(k,d) ) and ( (vrsi >overBought) or crossunder(vrsi,overBought) ) and year >= yearfrom and year <= yearuntil and month>=monthfrom and month <=monthuntil and dayofmonth>=dayfrom and dayofmonth < dayuntil )
// strategy.entry("SELL", strategy.short,stop=close, oca_name="TREND", oca_type=strategy.oca.cancel, comment="SELL")
//else
// strategy.cancel(id="SELL")