本策略是一个基于价格成交量趋势指标(PVT)与其指数移动平均线(EMA)交叉的趋势跟踪交易系统。策略通过监测PVT指标与其EMA的交叉情况来识别市场趋势的变化,从而捕捉潜在的交易机会。这种方法结合了价格变动和成交量的变化,能够更准确地反映市场的真实走势。
策略的核心是利用PVT指标,该指标通过将价格变动与成交量相结合来跟踪市场趋势。具体来说,当日价格变动百分比与当日成交量的乘积累加得到PVT值。然后计算PVT的20周期EMA作为参考线。当PVT向上穿越其EMA时,产生做多信号;当PVT向下穿越其EMA时,产生做空信号。这种交叉信号被用来确定市场趋势的转折点。
PVT-EMA趋势交叉策略是一个将价格、成交量和趋势分析相结合的完整交易系统。虽然存在一定的滞后性和假信号风险,但通过适当的优化和风险管理,该策略可以成为一个可靠的交易工具。建议交易者在实盘使用前进行充分的回测,并根据具体市场特征调整参数设置。
/*backtest
start: 2019-12-23 08:00:00
end: 2024-11-25 08:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © PakunFX
//@version=5
strategy(title="PVT Crossover Strategy", shorttitle="PVT Strategy", overlay=false, calc_on_every_tick=true)
// PVTの計算
var cumVol = 0.
cumVol += nz(volume)
if barstate.islast and cumVol == 0
runtime.error("No volume is provided by the data vendor.")
src = close
pvt = ta.cum(ta.change(src) / src[1] * volume)
// EMAの計算(PVTをソースに使用)
emaLength = input.int(20, minval=1, title="EMA Length")
emaPVT = ta.ema(pvt, emaLength)
// プロットをオフにする
plot(emaPVT, title="EMA of PVT", color=#f37f20, display=display.none)
// クロスオーバー戦略
longCondition = ta.crossover(pvt, emaPVT)
shortCondition = ta.crossunder(pvt, emaPVT)
// シグナル表示もオフにする
plotshape(series=longCondition, title="Buy Signal", location=location.belowbar, color=color.green, style=shape.labelup, text="BUY", display=display.none)
plotshape(series=shortCondition, title="Sell Signal", location=location.abovebar, color=color.red, style=shape.labeldown, text="SELL", display=display.none)
// 戦略エントリー
if (longCondition)
strategy.entry("Buy", strategy.long)
if (shortCondition)
strategy.entry("Sell", strategy.short)