
本策略名称为自适应价格区域反转交易策略。该策略运用自适应价格区域(Adaptive Price Zone,APZ)指标识别价格区域,在突破该区域时产生交易信号。APZ指标基于双指数移动平均线和波动率计算上、下价格区域边界。当价格突破区域边界时,表明价位可能反转,从而产生交易机会。
本策略主要适用于震荡行情,特别是盘整行情。它可用于日内短线交易或自动交易系统的一部分,适用于所有可交易资产。总体而言,该策略利用APZ指标提供的辅助判断,在价格区域边界附近进行反转交易。
本策略使用APZ指标判断价格区域,具体计算方法如下:
这样得到的上下轨构成自适应价格区域。当价格突破该区域时,产生交易信号。突破信号判断规则如下:
此外,本策略还提供反向交易开关参数reverse。打开反向交易后,做多做空信号与上述规则相反。
综上,本策略使用APZ指标判断自适应价格区域,在价格突破区域边界时产生反转交易信号,属于典型的趋势反转跟踪策略。
本策略主要有以下几个优势:
本策略也存在一些风险,主要集中在以下几个方面:
对策建议如下:
本策略可从以下几个方面进行优化:
本策略总体来说属于短线反转策略,通过APZ指标捕捉价格区域,在区间边界附近进行反转交易。策略优点是交易频率高,可捕捉较多短线机会,并可自适应调整价格区域。但也存在一定假突破风险,需运用其他工具配合进行优化控制。
/*backtest
start: 2023-12-05 00:00:00
end: 2023-12-11 08:00:00
period: 1m
basePeriod: 1m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=4
////////////////////////////////////////////////////////////
// Copyright by HPotter v1.0 15/01/2020
//
// 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.
////////////////////////////////////////////////////////////
strategy(title="Adaptive Price Zone Backtest", shorttitle="APZ", overlay = true)
nPeriods = input(20, minval=1)
nBandPct = input(2, minval=0)
reverse = input(false, title="Trade reverse")
xHL = high - low
nP = ceil(sqrt(nPeriods))
xVal1 = ema(ema(close,nP), nP)
xVal2 = ema(ema(xHL,nP), nP)
UpBand = nBandPct * xVal2 + xVal1
DnBand = xVal1 - nBandPct * xVal2
pos = 0
pos := iff(low < DnBand , 1,
iff(high > UpBand, -1, pos[1]))
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 )