本策略是将双重震荡反转策略和信噪比优化策略组合在一起,形成一个更强大更稳定的交易策略。策略致力于在趋势反转点发出更准确的交易信号。
双重震荡反转策略通过计算最近14天的快速和慢速K值,判断价格是否出现了连续两个交易日的反转。若反转发生时,快速K低于50表示买入信号,快速K高于50表示卖出信号。
信噪比优化策略则是计算最近21天的信噪比指标,并用29天简单移动平均进行平滑。当信噪比上穿其移动平均线时为卖出信号,下穿为买入信号。
最后,仅在双重震荡反转策略和信噪比优化策略同时发出相同的买入或卖出信号时,本策略才进行相应的买入或卖出操作。
组合多个策略,可以发出更准确的交易信号,避免单一策略的假信号。
双重震荡反转策略可以抓住趋势反转点,信噪比优化策略可以过滤假信号,两者相结合可以在反转点准确交易。
计算参数经过优化,如14天快慢stoch参数,21天信噪比周期等,可以 stab体现最近趋势而不被过多噪音影响。
运用双重确认信号,可以大幅降低交易风险,减少不必要的损失。
反转信号可能滞后,无法在绝对低点买入,高点卖出。可通过调整参数缩短滞后。
双重信号确认可能错过部分交易机会,可适当放宽确认条件,但风险也会提高。
信噪比参数需要优化,如果周期设置不当,可能错过重要信号或发出错误信号。
需要同时监控多个指标,增加了策略复杂度,代码优化和计算资源都需要考量。
测试更多指标的组合,寻找更好的组合信号。如MACD,RSI等。
优化双重震荡反转策略的参数,使反转信号更准确及时。
优化信噪比的参数周期,寻找最佳平衡点。
添加止损策略,以控制单笔交易可能的损失。
考虑以机器学习等方法自动优化参数,使策略更具适应性。
本策略通过组合双重震荡反转策略和信噪比优化策略,在趋势反转点给出稳定的交易信号。参数经过优化,可以大幅降低假信号的概率,且采用双重确认原则,可以减少交易风险。策略可继续优化指标参数,加入止损措施等来获得更好的效果。总体来说,该策略稳定性好,具有实际交易价值。
/*backtest start: 2023-10-01 00:00:00 end: 2023-10-31 00:00:00 period: 1h basePeriod: 15m exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}] */ //@version=4 //////////////////////////////////////////////////////////// // Copyright by HPotter v1.0 196/01/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 signal-to-noise (S/N) ratio. // And Simple Moving Average. // // 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 SignalToNoise(length) => StN = 0.0 for i = 1 to length-1 StN := StN + (1/close[i])/length StN := -10*log(StN) StN(length,Smooth) => pos = 0.0 StN = SignalToNoise(length) SMAStN = sma(StN, Smooth) pos := iff(SMAStN[0] > StN[0] , -1, iff(SMAStN[0] < StN[0], 1, 0)) pos strategy(title="Combo Backtest 123 Reversal & Signal To Noise", shorttitle="Combo", overlay = true) Length = input(14, minval=1) KSmoothing = input(1, minval=1) DLength = input(3, minval=1) Level = input(50, minval=1) //------------------------- lengthStN = input(title="Days", type=input.integer, defval=21, minval=2) SmoothStN = input(title="Smooth", type=input.integer, defval=29, minval=2) reverse = input(false, title="Trade reverse") posReversal123 = Reversal123(Length, KSmoothing, DLength, Level) posStN = StN(lengthStN,SmoothStN) pos = iff(posReversal123 == 1 and posStN == 1 , 1, iff(posReversal123 == -1 and posStN == -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 )