
该策略采用波浪通道指标和资金流指标相结合的方式,识别趋势方向并进行趋势跟踪。策略以15分钟时间周期运行,通过波浪通道判断价格趋势方向,再利用资金流指标进行趋势确认,实现超短线的趋势追踪。
波浪通道指标(WaveTrend)可以有效识别价格的趋势方向。它由通道均线、通道均价和通道索引组成。通道均线是价格的指数移动平均线,反映价格趋势;通道均价是通道均线的移动平均,用来定位通道均线;通道索引则反映价格对通道均线的偏离程度,并给出超买超卖信号。
资金流指标(CMF)则可以判断资金的流入流出,确认趋势。该指标基于成交量调整后的积累/派发线,反映买卖双方力量对比。值在0附近表示资金流入流出平衡;低于0表示资金流出,高于0表示资金流入。
本策略以15分钟周期运行,通过波浪通道指标判断价格趋势方向后,再利用资金流指标进行确认,从而实现趋势的跟踪。具体来说,如果波浪通道指标通道索引低于-60同时资金流指标小于-0.2,则做多;如果波浪通道指标通道索引高于60同时资金流指标大于0.2,则做空。平仓条件则以资金流指标为主,多仓资金流指标大于0.18时平多仓,空仓资金流指标小于-0.18时平空仓。
风险解决方法:
该策略采用波浪通道指标判断趋势方向,和资金流指标进行确认,实现超短线的趋势跟踪操作。策略优势是指标组合合理,可有效跟踪趋势,且15分钟周期运行更适合短线操作。但也存在风险,比如指标信号不准、持仓时间过短等。未来可通过止损策略、参数优化、增加信号过滤等方式进一步优化,使策略的稳定性和收益率得到提升。
/*backtest
start: 2023-11-08 00:00:00
end: 2023-11-15 00:00:00
period: 1m
basePeriod: 1m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=3
strategy(title = "CMF - WaveTrend", shorttitle = "CMF - WaveTrend", overlay = true, pyramiding = 0, default_qty_type = strategy.percent_of_equity, default_qty_value = 100, currency = currency.EUR)
//Chaikin Money Flow
len = input(20, minval=1, title="Length")
mas = input(title="Aggregation", defval="SUM", options=["SUM", "EMA", "WMA"])
e = input(10.0, title="Volume Exponent (0-10 reduces & 10+ increases volume effect)")
p = input(false, title="Show in Percentage")
mvs = input(false, "Factor in Price (Money Volume)")
src=input(hlc3, title="Source for price factor")
trl = min(low,close[1]), trh = max(high,close[1]) // 'true range' fixes issues caused by gaps in price
wv = pow(volume,e/10.0)*(mvs ? src : 1)
ad = (trh==trl ? 0 : (2*close-(trh+trl))/tr(true))*wv
cmf = mas=="SUM" ? sum(ad, len)/sum(wv, len) : mas=="EMA" ? ema(ad, len)/ema(wv, len) : mas=="WMA" ? wma(ad, len)/wma(wv, len) : na
cmf_p = if p
50*cmf+50
else
cmf
b = p ? 50 : 0
//WaveTrend
n1 = input(10, "Channel Length")
n2 = input(21, "Average Length")
obLevel1 = input(60, "Over Bought Level 1")
obLevel2 = input(53, "Over Bought Level 2")
osLevel1 = input(-60, "Over Sold Level 1")
osLevel2 = input(-53, "Over Sold Level 2")
ap = hlc3
esa = ema(ap, n1)
d = ema(abs(ap - esa), n1)
ci = (ap - esa) / (0.015 * d)
tci = ema(ci, n2)
wt1 = tci
wt2 = sma(wt1,4)
//
longCondition = wt1 < -60 and cmf < - 0.20
if (longCondition)
strategy.entry("My Long Entry Id", strategy.long)
shortCondition = wt1 > 60 and cmf > 0.20
if (shortCondition)
strategy.entry("My Short Entry Id", strategy.short)
closeLongCondition = cmf_p > 0.18 ? true : false
closeShortCondition = cmf_p < -0.18 ? true : false
strategy.close("My Long Entry Id", when=(closeLongCondition == true))
strategy.close("My Short Entry Id", when=(closeShortCondition == true))