该策略综合运用价格反转策略和相对强弱指数(RSI)指标,实现趋势判断与超买超卖判定的有机结合。其中,价格反转部分判断价格是否出现反转信号,RSI部分用于判断市场是否超买超卖。两部分信号结合,可以有效过滤假信号,提高信号质量。
价格反转部分运用123形态判断价格反转。具体来说,当收盘价连续2日低于前一日收盘价,且9日随机指标低通道线高于50时,产生买入信号;当收盘价连续2日高于前一日收盘价,且9日随机指标高通道线低于50时,产生卖出信号。
RSI部分根据相对强弱指数是否高于70或低于30来判断市场是否超买超卖。RSI高于70为超买信号,RSI低于30为超卖信号。
最后,价格反转信号和RSI信号进行逻辑“与”运算。即两者同为买入信号或卖出信号时,才产生实际的交易信号入市。从而有效过滤掉单一指标的假信号,提高信号质量。
该策略同时运用价格形态指标和超买超卖指标,两者信号需同向才入市。这样可以最大程度过滤单一指标可能产生的假信号,确保每次入市信号的可靠性。
价格反转部分以123形态判断反转情况。这是一种典型的反转交易方式。同时,RSI指标又可判断趋势,起到辅助确认的作用。反转为主,趋势为辅的结合,既可捕捉反转机会,也可避免与趋势对冲。
该策略只运用两个常用指标,参数数量适中。使策略整体结构简洁清晰,实盘操作难度不高,容易掌握。这对实盘交易者而言是非常重要的。
价格反转交易本身存在失败的概率,无法完全避免。当价格形成123信号,但是之后再次反转回去的情况。这时就会造成交易失败。
策略本身判断标准较为宽松,容易产生较多交易信号。如果不加以控制,会导致操作频率过高,增加交易费用和心理压力。
RSI指标的超买超卖区间默认为30-70。这只是经验参数,如果实际行情不符合,就容易错过正确信号或者发出错误信号。
适当调整持仓规模,控制单笔损失。
增加过滤条件,降低交易频率。例如加入移动均线判断。
测试不同市场后动态调整RSI参数区间,设定合理数值。
在现有基础上,加入移动均线判断规则,一定程度可过滤掉小范围的噪音。
通过回测历史数据,测试确定RSI超买超卖值的最佳参数组合。
除了现有的止损方式,可加入目标利润与止损关系的退出机制,以锁定盈利。
该策略运用价格反转判断和RSI指标判断双重确认,实现反转为主趋势为辅的交易思路。同时参数设定简单,易于掌握实盘。通过优化可加入更多过滤条件,降低交易频率的同时保持信号捕捉质量。该策略整体运行效果良好,具有实战运用的价值。
/*backtest
start: 2023-12-14 00:00:00
end: 2023-12-21 00:00:00
period: 1m
basePeriod: 1m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=4
////////////////////////////////////////////////////////////
// Copyright by HPotter v1.0 16/08/2021
// This is combo strategies for get a cumulative signal.
//
// First strategy
// This System was created from the Book "How I Tripled My Money In The
// Futures Market" by Ulf Jensen, Page 183. This is reverse type of strategies.
// The strategy buys at market, if close price is higher than the previous close
// during 2 days and the meaning of 9-days Stochastic Slow Oscillator is lower than 50.
// The strategy sells at market, if close price is lower than the previous close price
// during 2 days and the meaning of 9-days Stochastic Fast Oscillator is higher than 50.
//
// Second strategy
// The RSI is a very popular indicator that follows price activity.
// It calculates an average of the positive net changes, and an average
// of the negative net changes in the most recent bars, and it determines
// the ratio between these averages. The result is expressed as a number
// between 0 and 100. Commonly it is said that if the RSI has a low value,
// for example 30 or under, the symbol is oversold. And if the RSI has a
// high value, 70 for example, the symbol is overbought.
//
// WARNING:
// - For purpose educate only
// - This script to change bars colors.
////////////////////////////////////////////////////////////
Reversal123(Length, KSmoothing, DLength, Level) =>
vFast = sma(stoch(close, high, low, Length), KSmoothing)
vSlow = sma(vFast, DLength)
pos = 0.0
pos := iff(close[2] < close[1] and close > close[1] and vFast < vSlow and vFast > Level, 1,
iff(close[2] > close[1] and close < close[1] and vFast > vSlow and vFast < Level, -1, nz(pos[1], 0)))
pos
mRSI(Length,Oversold,Overbought) =>
pos = 0.0
xRSI = rsi(close, Length)
pos:=iff(xRSI > Overbought, 1,
iff(xRSI < Oversold, -1, nz(pos[1], 0)))
pos
strategy(title="Combo Backtest 123 Reversal & RSI", shorttitle="Combo", overlay = true)
line1 = input(true, "---- 123 Reversal ----")
Length = input(14, minval=1)
KSmoothing = input(1, minval=1)
DLength = input(3, minval=1)
Level = input(50, minval=1)
//-------------------------
line2 = input(true, "---- RSI ----")
LengthRSI = input(12, minval=1)
Oversold = input(30, minval=1)
Overbought = input(70, minval=1)
reverse = input(false, title="Trade reverse")
posReversal123 = Reversal123(Length, KSmoothing, DLength, Level)
posmRSI = mRSI(LengthRSI,Oversold,Overbought)
pos = iff(posReversal123 == 1 and posmRSI == 1 , 1,
iff(posReversal123 == -1 and posmRSI == -1, -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)
if (possig == 0)
strategy.close_all()
barcolor(possig == -1 ? #b50404: possig == 1 ? #079605 : #0536b3 )