本策略是一个结合趋势跟踪和均值回归的量化交易系统。它通过200日移动平均线(MA200)确定大趋势方向,同时利用7日价格波动识别短期超跌机会,实现在上升趋势中把握最佳买入时机。这种方法既保证了交易方向的正确性,又能在价格调整时及时介入,充分发挥技术分析在交易中的指导作用。
策略的核心逻辑包含两个维度:一是通过MA200判断长期趋势,只有当价格位于MA200之上时才考虑开仓;二是观察最近7个交易日的价格表现,当出现7日新低且仍在MA200之上时建仓做多,当价格达到7日新高时平仓。这种设计既确保了顺势而为,又能在调整时低位建仓,是一个融合了趋势跟踪和均值回归思想的系统化策略。
Double Seven Strategy是一个将趋势跟踪与均值回归有机结合的量化交易系统。通过MA200和7日价格波动的配合使用,既保证了交易方向的正确性,又能把握较好的入场时机。虽然存在一定的局限性,但通过合理的优化和风险控制,该策略具有较好的实用价值和扩展空间。建议交易者在实际应用中结合市场特征和自身需求进行针对性优化,以提升策略的稳定性和收益性。
/*backtest
start: 2019-12-23 08:00:00
end: 2024-11-27 00: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/
// © EdgeTools
//@version=5
strategy("Larry Connors' Double Seven Strategy", overlay=true)
// 200-day moving average
ma200 = ta.sma(close, 200)
// Conditions for Double Seven Strategy
priceAboveMa200 = close > ma200
// Find the lowest close over the last 7 days
lowestClose7Days = ta.lowest(close, 7)
// Find the highest close over the last 7 days
highestClose7Days = ta.highest(close, 7)
// Entry and exit rules
longCondition = priceAboveMa200 and close <= lowestClose7Days
exitCondition = close >= highestClose7Days
// Enter long position
if (longCondition)
strategy.entry("Long", strategy.long)
// Exit long position
if (exitCondition)
strategy.close("Long")
// Plot moving averages
plot(ma200, "200-day MA", color=color.blue)