本策略主要结合两种不同类型的策略信号,实现策略信号的叠加,以达到提升信号质量的效果。第一种信略为跨越反转策略,第二种信号为三十振荡器策略。
该策略源自《我如何在期货市场上获得三倍收益》这本书中第183页的内容。属于反转类型的策略。具体逻辑是:当收盘价连续两天高于前一日收盘价,且9日慢速K线低于50时,做多;当收盘价连续两天低于前一日收盘价,且9日快速K线高于50时,做空。
该策略利用3日平均线和10日平均线的差值,构建指标。详细来说,是3日指数移动平均线减去10日指数移动平均线,得到的差值为快线,再对该快线进行16日简单移动平均,得到慢线。当快线从下向上突破慢线时,做多;当快线从上向下跌破慢线时,做空。
这种多策略叠加的综合信号具有以下优点:
由于需要两个策略同时给出同向信号,可以避免单一策略中的假信号的影响,从而提高信号的可靠性。
结合反转策略和趋势策略两个理念,可以在一定程度上减少策略盲点,获取更全面的市场视角。
根据实际需要,可以调整参与综合的策略组合,结合不同类型的策略,创造更多元化的综合策略。
本策略的基本假设是,多个策略能够相互验证信号。但理论上也存在所有策略同时发出错误信号的可能。
当两个策略信号不一致时,无法判断哪个策略更可靠,存在一定的决策风险。
如果参数设置不当,可能导致某些策略无法发挥正常作用,从而无法实现策略组合的预期效果。
对策:
增加策略数量,进行多数表决
设置止损点,控制单个信号的损失
优化参数,确保策略正常运作
该策略还可从以下几个方向进行优化:
可以继续添加更多不同类型的策略,形成组合策略,以进一步提升信号质量。
根据行情特点,可以设置一些前期条件,例如大盘过滤,来避免不适宜的行情下开仓。
可以根据不同策略以往的表现,动态调整它们的权重参与组合,让表现更好的策略发挥更大作用。
可以通过更系统的方法,对各策略内部的参数进行细致的测试和优化,以获得最佳参数。
本策略属于多策略叠加型的综合策略。它整合了跨趋势反转策略和三十振荡策略两个子策略,通过使它们的交易信号同向时才产生交易指令,可以有效滤除单一策略中的假信号,提高信号质量。与单一策略相比,这种策略组合类型具有信号可靠性更高、容错性更强等优势。但也需要注意一致性假设可能带来的风险,需要采取适当的措施进行控制。总的来说,这种多策略组合框架具有很大的拓展潜力,可以通过添加更多子策略、优化参数和设置过滤条件等手段进行深化。
/*backtest
start: 2024-01-11 00:00:00
end: 2024-01-18 00:00:00
period: 5m
basePeriod: 1m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=4
////////////////////////////////////////////////////////////
// Copyright by HPotter v1.0 04/12/2019
// 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
// TradeStation does not allow the user to make a Multi Data Chart with
// a Tick Bar Chart and any other type a chart. This indicator allows the
// user to plot a daily 3-10 Oscillator on a Tick Bar Chart or any intraday interval.
// Walter Bressert's 3-10 Oscillator is a detrending oscillator derived
// from subtracting a 10 day moving average from a 3 day moving average.
// The second plot is an 16 day simple moving average of the 3-10 Oscillator.
// The 16 period moving average is the slow line and the 3/10 oscillator is
// the fast line.
// For more information on the 3-10 Oscillator see Walter Bressert's book
// "The Power of Oscillator/Cycle Combinations"
//
// 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
D_Three(Length1, Length2, Length3) =>
pos = 0.0
xPrice = security(syminfo.tickerid,"D", hl2)
xfastMA = ema(xPrice, Length1)
xslowMA = ema(xPrice, Length2)
xMACD = xfastMA - xslowMA
xSignal = sma(xMACD, Length3)
pos := iff(xSignal > xMACD, -1,
iff(xSignal < xMACD, 1, nz(pos[1], 0)))
pos
strategy(title="Combo Backtest 123 Reversal & D_Three Ten Osc", shorttitle="Combo", overlay = true)
Length = input(14, minval=1)
KSmoothing = input(1, minval=1)
DLength = input(3, minval=1)
Level = input(50, minval=1)
//-------------------------
Length1 = input(3, minval=1)
Length2 = input(10, minval=1)
Length3 = input(16, minval=1)
reverse = input(false, title="Trade reverse")
posReversal123 = Reversal123(Length, KSmoothing, DLength, Level)
posD_Three = D_Three(Length1, Length2, Length3)
pos = iff(posReversal123 == 1 and posD_Three == 1 , 1,
iff(posReversal123 == -1 and posD_Three == -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 )