
双项式动量突破反转策略通过结合斯托克指标和公牛指标,实现双重信号过滤,在市场反转点进行反转交易,追捧超跌超升。
该策略由两部分组成:
123反转策略
使用乌尔夫·詹森在他的书《我如何在期货市场上将资金翻三番》中提出的反转策略。当收盘价连续2天高于前一日收盘价,而9日慢速K线斯托克指标低于50时做多;当收盘价连续2天低于前一日收盘价,而9日快速K线斯托克指标高于50时做空。
公牛指标
使用瓦迪姆·吉梅尔法布在他的书《公牛熊平衡指标》中提出的动量指标。它通过计算当前K线与前一K线的关系,判断多空力量,并给出做多做空信号。
该策略将上述两种单一信号策略结合,当两者信号一致时发出交易信号,以双重过滤减少假信号。
该策略结合反转策略和跟踪策略的优点,能够在市场出现反转信号时及时捕捉,同时通过双信号过滤减少假信号,避免追高杀跌。具体优势如下:
该策略也存在一定风险,主要来源如下:
对策如下:
该策略还可以从以下几个方面进行优化:
双项式动量突破反转策略通过斯托克指标和公牛指标的结合,实现双重信号过滤和反转交易。它能抓住市场反转机会,避免单一信号产生的噪音,是一种稳定而有效的量化策略。该策略可以通过参数优化、止损策略、信号校验等方式进行改进,适应更多不同品种和市场环境,具有很大的优化空间和应用前景。
/*backtest
start: 2024-01-01 00:00:00
end: 2024-01-31 23:59:59
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=4
////////////////////////////////////////////////////////////
// Copyright by HPotter v1.0 05/07/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
// Bull Power Indicator
// To get more information please see "Bull And Bear Balance Indicator"
// by Vadim Gimelfarb.
//
// 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
BullPower(SellLevel, BuyLevel) =>
pos = 0
value = iff (close < open ,
iff (close[1] < open , max(high - close[1], close - low), max(high - open, close - low)),
iff (close > open,
iff(close[1] > open, high - low, max(open - close[1], high - low)),
iff(high - close > close - low,
iff (close[1] < open, max(high - close[1], close - low), high - open),
iff (high - close < close - low,
iff(close[1] > open, high - low, max(open - close, high - low)),
iff (close[1] > open, max(high - open, close - low),
iff(close[1] < open, max(open - close, high - low), high - low))))))
pos := iff(value > SellLevel, -1,
iff(value <= BuyLevel, 1, nz(pos[1], 0)))
pos
strategy(title="Combo Backtest 123 Reversal & Bull Power", shorttitle="Combo", overlay = true)
Length = input(14, minval=1)
KSmoothing = input(1, minval=1)
DLength = input(3, minval=1)
Level = input(50, minval=1)
//-------------------------
SellLevel = input(15, step=1)
BuyLevel = input(3, step=1)
reverse = input(false, title="Trade reverse")
posReversal123 = Reversal123(Length, KSmoothing, DLength, Level)
posBullPower = BullPower(SellLevel, BuyLevel)
pos = iff(posReversal123 == 1 and posBullPower == 1 , 1,
iff(posReversal123 == -1 and posBullPower == -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 )