この戦略は,ジョン・エラーズが開発したRSI指標の改良版である。その最大の利点は,後退を減らすと同時にRSI曲線を平坦化することです。
価格の6つの平均値 xValue を計算する.
xValueの計算により,上昇合計CU23と減少合計CD23。
標準化されたRES値nRes,すなわちCU23/(CU23 + CD23) を計算する.
nResと上下値を比較して多空信号を生成する.
選択可能な逆転取引
信号によって多空取引を行う.
この戦略は,RSI指標の計算方法の改善により,曲線を効果的に平らげ,誤報信号を一定程度減らす.最適化パラメータの設定と他のフィルタリング条件の追加により,戦略のパフォーマンスをさらに向上させることができる.しかし,傾斜型システムとして,遅れの問題を完全に回避することはできません.全体的に,この戦略は,シンプルで信頼性の高い突破システムであり,さらなる研究と最適化の価値があります.
/*backtest
start: 2023-09-13 00:00:00
end: 2023-09-19 00:00:00
period: 30m
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=2
////////////////////////////////////////////////////////////
// Copyright by HPotter v1.0 20/11/2017
// This is new version of RSI oscillator indicator, developed by John Ehlers.
// The main advantage of his way of enhancing the RSI indicator is smoothing
// with minimum of lag penalty.
//
// You can change long to short in the Input Settings
// WARNING:
// - For purpose educate only
// - This script to change bars colors.
////////////////////////////////////////////////////////////
strategy(title="Smoothed RSI Backtest ver.2")
Length = input(10, minval=1)
TopBand = input(0.8, step=0.01)
LowBand = input(0.2, step=0.01)
reverse = input(false, title="Trade reverse")
hline(TopBand, color=red, linestyle=line)
hline(LowBand, color=green, linestyle=line)
xValue = (close + 2 * close[1] + 2 * close[2] + close[3] ) / 6
CU23 = sum(iff(xValue > xValue[1], xValue - xValue[1], 0), Length)
CD23 = sum(iff(xValue < xValue[1], xValue[1] - xValue, 0), Length)
nRes = iff(CU23 + CD23 != 0, CU23/(CU23 + CD23), 0)
pos = iff(nRes > TopBand, 1,
iff(nRes < LowBand, -1, nz(pos[1], 0)))
possig = iff(reverse and pos == 1, -1,
iff(reverse and pos == -1, 1, pos))
if (possig == 1)
strategy.entry("Long", strategy.long)
if (possig == -1)
strategy.entry("Short", strategy.short)
barcolor(possig == -1 ? red: possig == 1 ? green : blue )
plot(nRes, color=blue, title="Smoothed RSI")