该策略是一个基于双均线(快速EMA和慢速EMA)的动态区域趋势跟踪系统。通过对价格与双均线之间的位置关系划分出不同的交易区域,结合动态颜色指示系统,为交易者提供清晰的买卖信号。策略采用经典的均线交叉理论,并通过区域划分的创新方式,提高了传统双均线系统的可操作性。
策略的核心是通过快速EMA(默认12周期)和慢速EMA(默认26周期)的交叉关系,结合价格位置,将市场状态划分为六个不同的区域。当快线在慢线之上时,市场被认为处于多头趋势;反之则被视为空头趋势。价格相对于这两条均线的位置进一步细分出具体的交易区域:绿色区域(买入)、蓝色区域(潜在买入)、红色区域(卖出)以及黄色区域(潜在卖出)。买入信号在价格进入绿色区域且出现首个绿色蜡烛时触发,而卖出信号则在价格进入红色区域且出现首个红色蜡烛时触发。
这是一个结合了传统双均线系统和现代区域划分理念的趋势跟踪策略。通过直观的视觉反馈和清晰的交易规则,为交易者提供了一个可靠的交易框架。虽然存在均线系统固有的滞后性问题,但通过合理的参数优化和风险管理,该策略能够在趋势市场中取得稳定的表现。建议交易者在实际应用中结合市场特征进行参数优化,并始终保持适当的风险控制。
/*backtest
start: 2019-12-23 08:00:00
end: 2024-11-27 08:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("NUTJP CDC ActionZone 2024", overlay=true, precision=6, commission_value=0.1, slippage=3)
//****************************************************************************//
// CDC Action Zone is based on a simple EMA crossover
// between [default] EMA12 and EMA26
//****************************************************************************//
// Define User Input Variables
xsrc = input.source(title='Source Data', defval=close)
xprd1 = input.int(title='Fast EMA period', defval=12)
xprd2 = input.int(title='Slow EMA period', defval=26)
xsmooth = input.int(title='Smoothing period (1 = no smoothing)', defval=1)
fillSW = input.bool(title='Paint Bar Colors', defval=true)
fastSW = input.bool(title='Show fast moving average line', defval=true)
slowSW = input.bool(title='Show slow moving average line', defval=true)
xfixtf = input.bool(title='** Use Fixed time frame Mode (advanced) **', defval=false)
xtf = input.timeframe(title='** Fix chart to which time frame? **', defval='D')
startDate = input(timestamp("2018-01-01 00:00"), title="Start Date")
endDate = input(timestamp("2069-12-31 23:59"), title="End Date")
//****************************************************************************//
// Calculate Indicators
f_secureSecurity(_symbol, _res, _src) => request.security(_symbol, _res, _src[1], lookahead=barmerge.lookahead_on)
xPrice = ta.ema(xsrc, xsmooth)
FastMA = xfixtf ? ta.ema(f_secureSecurity(syminfo.tickerid, xtf, ta.ema(xsrc, xprd1)), xsmooth) : ta.ema(xPrice, xprd1)
SlowMA = xfixtf ? ta.ema(f_secureSecurity(syminfo.tickerid, xtf, ta.ema(xsrc, xprd2)), xsmooth) : ta.ema(xPrice, xprd2)
Bull = FastMA > SlowMA
Bear = FastMA < SlowMA
// Define Color Zones
Green = Bull and xPrice > FastMA
Red = Bear and xPrice < FastMA
// Buy and Sell Conditions
buycond = Green and not Green[1]
sellcond = Red and not Red[1]
inDateRange = true
if inDateRange
if buycond
strategy.entry("Long", strategy.long, qty=1)
if sellcond
strategy.close("Long")
//****************************************************************************//
// Display color on chart
bColor = Green ? color.green :
Red ? color.red :
color.black
barcolor(color=fillSW ? bColor : na)
// Display MA lines
FastL = plot(fastSW ? FastMA : na, "Fast EMA", color=color.new(color.red, 0), style=xfixtf ? plot.style_stepline : plot.style_line)
SlowL = plot(slowSW ? SlowMA : na, "Slow EMA", color=color.new(color.blue, 0), style=xfixtf ? plot.style_stepline : plot.style_line)
fill(FastL, SlowL, Bull ? color.new(color.green, 90) : (Bear ? color.new(color.red, 90) : na))