双动量策略使用快速和慢速两个动量指标来产生交易信号和退出信号。这是一个响应迅速的策略,适用于日线和4小时线上的趋势性品种。本策略实现方式来自QuantCT应用程序。
可以将操作模式设置为多空或仅多头。
还可以设置固定止损或忽略止损,使策略仅根据进场和出场信号运行。
该策略使用快速周期(默认5日)和慢速周期(默认10日)的动量指标。
当慢速动量和快速动量同时大于0时,产生做多信号。
当慢速动量或快速动量小于0时,产生平仓信号。
类似的,当慢速动量和快速动量同时小于0时,产生做空信号。当慢速动量或快速动量大于0时,产生平仓信号。
所以,该策略利用两组不同周期动量的交叉来捕捉趋势的变化,实现趋势追踪。
使用双动量指标,可以比较准确地捕捉市场趋势的变化,降低假信号。
快速周期动量对市场变化敏感,可以快速响应趋势;慢速周期过滤市场噪音,确保交易方向正确。
可灵活选择仅做多或双向交易,适应不同交易偏好。
可选择是否使用止损,控制风险。
该策略反应灵敏,特别适合日线或更高周期的趋势交易,可以获得超额收益。
双动量策略对趋势的判断依赖指标值大于或小于0,存在一定的滞后。
该策略更依赖趋势,在盘整市场中表现不佳,容易产生过多交易,导致交易费用增加。
如果不使用止损,则存在较大的单笔损失风险。
适合的品种和周期不当也会导致策略表现不佳。
为控制风险,建议适当调整动量周期参数,并设置合理固定止损比例。同时选择明确趋势的品种,在日线或更高周期运行该策略。
该策略可以从以下几个方面进行优化:
增加其他指标过滤,例如MACD或RSI,避免趋势转折点的错误交易。
增加自适应止损机制,根据市场波动程度来动态调整止损幅度。
优化动量参数,找到不同品种更合适的参数组合。可以通过步进优化、Walk Forward Analysis等方法来实现。
增加仓位管理机制,根据前期收益情况来调整新仓位大小。
区分多头和空头市场,采取不对称出入场策略。空头市场可以更激进,多头市场可以更谨慎。
双动量策略通过快速和慢速动量指标的交叉判断趋势方向,使用简单指标捕捉市场趋势变化,适合追踪日内或日间的明显趋势,可以获得较好的超额收益。同时,该策略也存在一定的滞后风险,需要结合止损和其他指标来控制风险,以及针对品种和参数进行优化,从而获得更稳定的表现。
/*backtest
start: 2023-08-28 00:00:00
end: 2023-09-27 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © QuantCT
//@version=4
strategy("Momentum Strategy Idea",
shorttitle="Momentum",
overlay=false,
pyramiding=0,
default_qty_type=strategy.percent_of_equity,
default_qty_value=100,
initial_capital=1000,
commission_type=strategy.commission.percent,
commission_value=0.075)
// ____ Inputs
fast_period = input(title="Fast Period", defval=5)
slow_period = input(title="Slow Period", defval=10)
long_only = input(title="Long Only", defval=false)
slp = input(title="Stop-loss (%)", minval=1.0, maxval=25.0, defval=5.0)
use_sl = input(title="Use Stop-Loss", defval=false)
// ____ Logic
mom_fast = mom(close, fast_period)
mom_slow = mom(close, slow_period)
enter_long = (mom_slow > 0 and mom_fast > 0)
exit_long = (mom_slow < 0 or mom_fast < 0)
enter_short = (mom_slow < 0 and mom_fast < 0)
exit_short = (mom_slow > 0 or mom_fast > 0)
strategy.entry("Long", strategy.long, when=enter_long)
strategy.close("Long", when=exit_long)
if (not long_only)
strategy.entry("Short", strategy.short, when=enter_short)
strategy.close("Short", when=exit_short)
// ____ SL
sl_long = strategy.position_avg_price * (1- (slp/100))
sl_short = strategy.position_avg_price * (1 + (slp/100))
if (use_sl)
strategy.exit(id="SL", from_entry="Long", stop=sl_long)
strategy.exit(id="SL", from_entry="Short", stop=sl_short)
// ____ Plots
colors =
enter_long ? #27D600 :
enter_short ? #E30202 :
color.orange
mom_fast_plot = plot(mom_fast, color=colors)
mom_slow_plot = plot(mom_slow, color=colors)
fill(mom_fast_plot, mom_slow_plot, color=colors, transp=50)