
双重均线震荡交易策略通过组合使用2/20指数移动平均线和自适应价格带震荡指标,形成交易信号,实现在震荡行情中获利。该策略主要适用于股指、外汇、商品和数字货币等具有明显震荡特性的市场。
双重均线震荡交易策略由两部分组成:
2/20指数移动平均线。该指标在价格上涨突破20日线且下跌未跌破2日线时产生买入信号;价格下跌突破2日线且上涨未超过20日线时产生卖出信号。
自适应价格带震荡指标。该指标基于价格的波动范围构建价格带,通过价格突破上下价格带判断市场转折点,产生买入和卖出信号。
双重均线震荡交易策略是在2/20指数移动平均线和自适应价格带震荡指标同时发出信号时,才产生实际的交易信号,实现策略交易。这可以有效过滤掉部分无效信号,提高信号的质量。
双重均线震荡交易策略结合利用均线指标和波动性指标的优势,具有以下特点:
可靠的交易信号。双重指标验证提高信号质量,有效过滤无效信号。
适应震荡行情。组合使用均线和价格带指标,可准确判定震荡行情中的转折点。
操作频率适中。较双指数移动平均线策略,可以减少无效交易的发生。
容易实施自动交易。信号规则清晰,参数设定简单,易于编程实现自动交易。
双重均线震荡交易策略也存在以下风险:
信号延迟可能较大。双重指标组合过滤信号,可能错过价格快速反转的机会。
震荡行情减弱时效果变差。策略主要依赖震荡行情,震荡性减弱时,交易信号和获利空间会随之减少。
参数优化影响显著。指标参数设置会对交易结果产生较大影响,需要进行系统优化确定最优参数。
针对以上风险,可以采用动态调整参数的方法应对市场环境变化,同时设置止损策略控制亏损风险。
双重均线震荡交易策略可以从以下几个方面进行优化:
2.加入成交量指标过滤信号。结合交易量异常信号过滤均线价格信号,可进一步提高信号质量。
设置动态止损机制。当市场震荡性减弱时,适当收紧止损点,减小单笔亏损。
结合深度学习模型。使用LSTM等深度学习模型对交易信号进行验证,使策略更加智能化。
双重均线震荡交易策略通过组合2/20指数移动平均线和自适应价格带震荡指标,产生高质量的震荡交易信号,能够适应股指、外汇、大宗商品等波动性较大的市场,在震荡区间内进行频繁交易套利。该策略具有信号质量高、容易自动化实现等优势。同时也需要注意控制延迟识别转折点和动态调整参数的风险,在此基础上仍有很大的优化空间。
/*backtest
start: 2023-11-03 00:00:00
end: 2023-12-03 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
////////////////////////////////////////////////////////////
// Copyright by HPotter v1.0 02/03/2022
// This is combo strategies for get a cumulative signal.
//
// First strategy
// This indicator plots 2/20 exponential moving average. For the Mov
// Avg X 2/20 Indicator, the EMA bar will be painted when the Alert criteria is met.
//
// Second strategy
// The adaptive price zone (APZ) is a volatility-based technical indicator that helps investors
// identify possible market turning points, which can be especially useful in a sideways-moving
// market. It was created by technical analyst Lee Leibfarth in the article “Identify the
// Turning Point: Trading With An Adaptive Price Zone,” which appeared in the September 2006 issue
// of the journal Technical Analysis of Stocks and Commodities.
// This indicator attempts to signal significant price movements by using a set of bands based on
// short-term, double-smoothed exponential moving averages that lag only slightly behind price changes.
// It can help short-term investors and day traders profit in volatile markets by signaling price
// reversal points, which can indicate potentially lucrative times to buy or sell. The APZ can be
// implemented as part of an automated trading system and can be applied to the charts of all tradeable assets.
//
// WARNING:
// - For purpose educate only
// - This script to change bars colors.
////////////////////////////////////////////////////////////
EMA20(Length) =>
pos = 0.0
xPrice = close
xXA = ta.ema(xPrice, Length)
nHH = math.max(high, high[1])
nLL = math.min(low, low[1])
nXS = nLL > xXA or nHH < xXA ? nLL : nHH
iff_1 = nXS < close[1] ? 1 : nz(pos[1], 0)
pos := nXS > close[1] ? -1 : iff_1
pos
APZ(nPeriods,nBandPct) =>
pos = 0.0
xHL = high - low
nP = math.ceil(math.sqrt(nPeriods))
xVal1 = ta.ema(ta.ema(close,nP), nP)
xVal2 = ta.ema(ta.ema(xHL,nP), nP)
UpBand = nBandPct * xVal2 + xVal1
DnBand = xVal1 - nBandPct * xVal2
pos := low < DnBand ? 1 : high > UpBand ? -1 : pos[1]
pos
strategy(title='Combo 2/20 EMA & Adaptive Price Zone', shorttitle='Combo', overlay=true)
var I1 = '●═════ 2/20 EMA ═════●'
Length = input.int(14, minval=1, group=I1)
var I2 = '●═════ Adaptive Price Zone ═════●'
nPeriods = input(20)
nBandPct = input(2)
var misc = '●═════ MISC ═════●'
reverse = input.bool(false, title='Trade reverse', group=misc)
var timePeriodHeader = '●═════ Time Start ═════●'
d = input.int(1, title='From Day', minval=1, maxval=31, group=timePeriodHeader)
m = input.int(1, title='From Month', minval=1, maxval=12, group=timePeriodHeader)
y = input.int(2005, title='From Year', minval=0, group=timePeriodHeader)
StartTrade = time > timestamp(y, m, d, 00, 00) ? true : false
posEMA20 = EMA20(Length)
prePosAPZ = APZ(nPeriods,nBandPct)
iff_1 = posEMA20 == -1 and prePosAPZ == -1 and StartTrade ? -1 : 0
pos = posEMA20 == 1 and prePosAPZ == 1 and StartTrade ? 1 : iff_1
iff_2 = reverse and pos == -1 ? 1 : pos
possig = reverse and pos == 1 ? -1 : iff_2
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)