多重会聚摆动猎人策略是一种专为低时间框架交易设计的高级量化策略,它采用了全面的基于点数的评分系统,将优化的技术指标、价格行为分析和反转模式识别相结合,以生成精确的交易信号。该策略的核心创新在于引入了独特的双重评分机制,一方面通过入场评分系统识别摆动底部,另一方面通过出场评分系统确定最佳退出时机。与传统依赖简单指标交叉的策略不同,该系统通过加权评分机制量化市场条件,提供客观、数据驱动的入场和出场决策。
该策略利用经过广泛回测优化的指标参数,包括特别配置的MACD(3,10,3)和RSI(21),这些参数比标准配置更能适应快速市场变化。策略要求入场和出场均需至少13分的高分数门槛,确保只有高可信度的信号才会触发交易。在回测中,该策略展现出超过200%的利润表现,证明了其在捕捉市场波动模式方面的有效性。
多重会聚摆动猎人策略的核心是其综合评分系统,它通过对多种技术条件进行量化评估来确定交易时机。入场评分系统由以下四个主要组成部分构成:
RSI信号(最高5分):
MACD信号(最高8分):
价格行为(最高4分):
模式识别(最高8分):
出场评分系统使用相似的权重系统,但采用相反的标准来识别摆动顶部。该策略要求入场和出场得分均至少达到13分,这确保了只有高确信度的信号才会被执行,减少了假信号的可能性。
策略的另一个关键组成部分是其优化的指标参数: - MACD配置(3,10,3):比标准的(12,26,9)配置更快,能更早地检测到信号,同时保持可靠性 - RSI配置(21周期):比标准的14周期RSI减少了假信号,同时仍能有效捕捉超卖条件
这些参数经过专门优化,适合捕捉快速价格变动和高频波动性。
客观量化的决策过程:通过基于点数的评分系统,该策略消除了主观判断,提供了清晰的交易标准。这种方法使交易决策基于数据而非情绪,大大提高了交易纪律性。
多重确认机制:策略要求多个技术指标和价格模式同时确认,显著提高了信号的可靠性。只有当至少13个点的标准被满足时才会进行交易,这降低了假信号的风险。
优化的时间敏感性:通过使用优化的MACD(3,10,3)和RSI(21)参数,策略能够更早地捕捉到价格动量的变化,同时过滤掉市场噪音,提供了更好的时间敏感性。
灵活的风险管理:策略内置了基于风险的止损和获利目标计算,默认采用5:1的风险回报比,这为交易提供了清晰的风险管理框架。动态止损基于近期摆动低点,具有可配置的缓冲区,增强了风险控制的灵活性。
高度可视化的交易系统:策略提供了分数显示系统,包括绿色标签(入场分数≥10分)和红色标签(出场分数≥10分),以及明显的交易入场/出场标记,使交易者能够清晰地看到系统的运作。
适应性强:虽然策略参数经过优化,但它们可以根据不同市场环境和交易品种进行调整,使策略具有广泛的适用性。
高仓位分配风险:策略默认采用100%的资金分配方式,这种集中投资增加了单笔交易的风险敞口。在市场剧烈波动或出现意外事件时,这可能导致显著的账户波动。
市场条件依赖性:该策略在明显趋势和波动市场中表现最佳,但在高度震荡、横盘市场中效果可能降低。需要在不同市场环境中谨慎使用,并考虑调整参数或暂停交易。
优化过拟合风险:策略参数经过优化,可能存在对历史数据过拟合的风险。未来市场条件的变化可能导致策略表现不如回测结果。应定期重新验证和调整参数以保持策略有效性。
无多样化保护:作为单一仓位策略,缺乏多样化保护,增加了特定市场风险。在实际应用中,可考虑将该策略作为更广泛投资组合的一部分,或引入多品种交易以增加多样化。
技术故障风险:复杂的评分系统和多重条件可能在某些市场环境中失效,特别是在极端市场条件下。建议实施额外的风险管理措施,如设置最大亏损限制或使用波动性过滤器。
引入自适应参数:当前策略使用固定的MACD和RSI参数,可以考虑引入基于市场波动性或趋势强度的自适应参数。例如,在高波动性环境中自动调整MACD参数,或根据当前市场状态调整RSI超卖/超买水平,以提高策略在不同市场环境中的适应性。
整合量价关系分析:当前策略主要基于价格行为和动量指标,可以通过整合成交量分析来增强信号质量。特别是在反转模式确认中,成交量确认可以提供额外的可靠性。考虑添加成交量相关的评分标准,如成交量增加、成交量背离等。
增加市场环境过滤器:实现市场环境识别机制,在不适合策略的市场条件下自动减少交易频率或调整参数。例如,在高度横盘市场中提高分数门槛,或在低波动性环境中减小止损范围。
优化资金管理系统:当前策略使用100%仓位分配,可以实现更复杂的资金管理系统,基于信号强度、市场波动性或历史表现动态调整仓位大小。例如,分数越高分配越多资金,或在连续亏损后减少仓位大小。
多时间框架分析整合:通过加入更高时间框架的趋势确认来增强入场信号的质量。例如,只在较高时间框架趋势方向一致时才执行交易,或为顺应主趋势的交易分配更多分数。
机器学习优化:考虑使用机器学习方法优化评分权重和阈值。通过分析历史数据,可以确定哪些信号组合在特定市场环境中最有效,并相应地调整评分系统。
多重会聚摆动猎人策略代表了一种全面、系统化的低时间框架交易方法,它通过综合多种技术分析指标和价格行为特征,创建了一个数据驱动的交易决策系统。该策略的核心优势在于其客观的多标准评分方法,有效消除了情绪化决策,同时保持了足够的灵活性以适应不同的交易品种和市场环境。
策略通过优化的MACD(3,10,3)和RSI(21)参数,结合严格的入场和出场条件,能够有效捕捉市场摆动,特别是在波动性较高的市场中。内置的风险管理功能和可视化工具进一步增强了策略的实用性和用户友好性。
然而,策略也存在一定的局限性和风险,包括高仓位分配、市场条件依赖性和优化过拟合的可能性。通过实施建议的优化方向,如引入自适应参数、整合量价关系分析、增加市场环境过滤器等,可以进一步提升策略的稳健性和适应性。
对于有经验的交易者,多重会聚摆动猎人策略提供了一个强大的框架,可以用于低时间框架的趋势捕捉和摆动交易。通过理解其核心原理并根据特定需求进行调整,交易者可以利用这一策略在快速变化的市场中寻找高概率的交易机会。值得注意的是,任何交易策略都需要严格的风险管理和持续的监控评估,以确保长期的交易成功。
/*backtest
start: 2024-06-30 00:00:00
end: 2025-06-28 08:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"ETH_USDT","balance":50000000}]
*/
// ____ _ _______ _ _ _____
// / __ \ | | |__ __| | (_) | __ \
// | | | |_ _ __ _ _ __ | |_ | |_ __ __ _ __| |_ _ __ __ _ | |__) |
// | | | | | | |/ _` | '_ \| __| | | '__/ _` |/ _` | | '_ \ / _` | | ___/ '__/ _ \
// | |__| | |_| | (_| | | | | |_ | | | | (_| | (_| | | | | | (_| | | | | | | (_) |
// \___\_\\__,_|\__,_|_| |_|\__| |_|_| \__,_|\__,_|_|_| |_|\__, | |_| |_| \___/
// __/ |
// |___/
// Quant Trading Pro
//@version=6
strategy("Multi-Confluence Swing Hunter V1", overlay=true,
default_qty_type=strategy.percent_of_equity, default_qty_value=100,
commission_type=strategy.commission.percent, commission_value=0.1,
slippage=3, initial_capital=1000, margin_long=0, margin_short=0)
// === DESCRIPTION ===
// High-conviction swing bottom entry strategy using optimized MACD(3,10,3) and RSI(21)
// Entry: Point-based scoring system for swing bottoms (divergences, momentum, price action)
// Exit: Inverse scoring system for swing tops (no stop-loss, exit only on swing top signals)
// Position: Single position with 100% allocation, scores displayed only when ≥10 points
// Based on analysis showing 23.7% improvement over standard parameters
// === INPUT PARAMETERS ===
// Optimized Indicator Settings
macdFast = input.int(3, "MACD Fast Length", minval=1, maxval=50, group="Optimized Indicators")
macdSlow = input.int(10, "MACD Slow Length", minval=1, maxval=100, group="Optimized Indicators")
macdSignal = input.int(3, "MACD Signal Length", minval=1, maxval=50, group="Optimized Indicators")
rsiLength = input.int(21, "RSI Length", minval=2, maxval=100, group="Optimized Indicators")
// Entry Settings - Swing Bottom Scoring
minEntryScore = input.int(13, "Minimum Entry Score", minval=5, maxval=20, group="Entry Settings")
showEntryScores = input.bool(true, "Show Entry Scores (Above 10)", group="Entry Settings")
// Exit Settings - Swing Top Scoring (Inverse of Entry Criteria)
minExitScore = input.int(13, "Minimum Exit Score", minval=5, maxval=20, group="Exit Settings")
showExitScores = input.bool(true, "Show Exit Scores (Above 10)", group="Exit Settings")
// Price Action Settings
minLowerWickPercent = input.float(50.0, "Min Lower Wick %", minval=10.0, maxval=90.0, step=5.0, group="Price Action")
quickRecoveryPercent = input.float(0.3, "Quick Recovery %", minval=0.1, maxval=2.0, step=0.1, group="Price Action")
quickRecoveryBars = input.int(3, "Quick Recovery Bars", minval=1, maxval=10, group="Price Action")
// RSI Levels
rsiOversold = input.float(30.0, "RSI Oversold Level", minval=10.0, maxval=50.0, step=1.0, group="RSI Settings")
rsiExtremeOversold = input.float(25.0, "RSI Extreme Oversold", minval=10.0, maxval=40.0, step=1.0, group="RSI Settings")
rsiOverbought = input.float(70.0, "RSI Overbought Level", minval=50.0, maxval=90.0, step=1.0, group="RSI Settings")
rsiExtremeOverbought = input.float(75.0, "RSI Extreme Overbought", minval=60.0, maxval=90.0, step=1.0, group="RSI Settings")
// Reversal Signals Settings
reversalLookback = input.int(12, "Reversal Candle Lookback", minval=5, maxval=50, group="Reversal Signals")
reversalConfirm = input.int(3, "Reversal Confirm Within", minval=1, maxval=10, group="Reversal Signals")
useVolumeConfirmation = input.bool(false, "Use Volume Confirmation", group="Reversal Signals")
// Trade Management
allowShortTrades = input.bool(false, "Allow Short Trades?", group="Short Trades")
// Risk/Reward TP/SL Settings
useRiskReward = input.bool(true, "Use Risk/Reward TP/SL", group="Risk Management")
riskRewardRatio = input.float(5, "Risk/Reward Ratio", minval=1.0, maxval=5.0, step=0.1, group="Risk Management")
stopLossLookback = input.int(10, "Stop Loss Lookback Bars", minval=3, maxval=50, group="Risk Management")
stopLossBuffer = input.float(0.15, "Stop Loss Buffer %", minval=0.05, maxval=1.0, step=0.05, group="Risk Management")
// Advanced Settings
maxLookbackBars = input.int(8, "Divergence Lookback Bars", minval=3, maxval=20, group="Advanced")
// === 1️⃣ CALCULATIONS ===
// Optimized MACD Calculation
[macdLine, signalLine, macdHist] = ta.macd(close, macdFast, macdSlow, macdSignal)
// Optimized RSI Calculation
rsi = ta.rsi(close, rsiLength)
// Price Action Calculations
bodySize = math.abs(close - open)
lowerWick = math.min(open, close) - low
upperWick = high - math.max(open, close)
totalRange = high - low
lowerWickPercent = totalRange > 0 ? (lowerWick / totalRange) * 100 : 0
upperWickPercent = totalRange > 0 ? (upperWick / totalRange) * 100 : 0
bodyPercent = totalRange > 0 ? (bodySize / totalRange) * 100 : 0
// Reversal Signals Calculation
var int bullCandleScore = 0
var int bearCandleScore = 0
var bool bullReversalCandidate = false
var bool bearReversalCandidate = false
var float bullReversalLow = 0.0
var float bullReversalHigh = 0.0
var float bearReversalLow = 0.0
var float bearReversalHigh = 0.0
var bool bullSignalConfirmed = false
var bool bearSignalConfirmed = false
var int bullCandleCounter = 0
var int bearCandleCounter = 0
volumeIsHigh = volume > ta.sma(volume, 20)
// Reset scores
bullCandleScore := 0
bearCandleScore := 0
// Calculate reversal scores
if bar_index >= reversalLookback
for i = 0 to (reversalLookback - 1)
if close < low[i]
bullCandleScore += 1
if close > high[i]
bearCandleScore += 1
// Bear signal setup
if bearCandleScore == (reversalLookback - 1)
bearReversalCandidate := true
bearReversalLow := low
bearReversalHigh := high
bearSignalConfirmed := false
bearCandleCounter := 0
if bearReversalCandidate
bearCandleCounter += 1
if close > bearReversalHigh
bearReversalCandidate := false
bearCondition = bearReversalCandidate and close < bearReversalLow and not bearSignalConfirmed and bearCandleCounter <= (reversalConfirm + 1)
bearSignal = false
if bearCondition
bearSignalConfirmed := true
if not useVolumeConfirmation or volumeIsHigh
bearSignal := true
// Bull signal setup
if bullCandleScore == (reversalLookback - 1)
bullReversalCandidate := true
bullReversalLow := low
bullReversalHigh := high
bullSignalConfirmed := false
bullCandleCounter := 0
if bullReversalCandidate
bullCandleCounter += 1
if close < bullReversalLow
bullReversalCandidate := false
bullCondition = bullReversalCandidate and close > bullReversalHigh and not bullSignalConfirmed and bullCandleCounter <= (reversalConfirm + 1)
bullSignal = false
if bullCondition
bullSignalConfirmed := true
if not useVolumeConfirmation or volumeIsHigh
bullSignal := true
// === 2️⃣ ENTRY & EXIT LOGIC ===
// Helper Functions for Divergence Detection
findLowerLow(lookback) =>
var float lowestPrice = na
var int lowestIndex = na
if bar_index >= lookback
lowestPrice := low
lowestIndex := bar_index
for i = 1 to lookback
if low[i] < lowestPrice
lowestPrice := low[i]
lowestIndex := bar_index - i
[lowestPrice, lowestIndex]
findHigherHigh(lookback) =>
var float highestPrice = na
var int highestIndex = na
if bar_index >= lookback
highestPrice := high
highestIndex := bar_index
for i = 1 to lookback
if high[i] > highestPrice
highestPrice := high[i]
highestIndex := bar_index - i
[highestPrice, highestIndex]
// SWING BOTTOM SCORING SYSTEM
// 1. RSI Signals
rsiOversoldSignal = rsi < rsiOversold
rsiExtremeOversoldSignal = rsi < rsiExtremeOversold
rsiTurningUp = rsi > rsi[1]
// RSI Bullish Divergence
[prevLowPrice, prevLowIndex] = findLowerLow(maxLookbackBars)
rsiBullishDivergence = false
if not na(prevLowPrice) and not na(prevLowIndex) and bar_index > prevLowIndex
prevRSI = rsi[bar_index - prevLowIndex]
if low < prevLowPrice and rsi > prevRSI and not na(prevRSI)
rsiBullishDivergence := true
// 2. MACD Signals
macdNegative = macdLine < 0
macdTurningUp = macdLine > macdLine[1]
macdHistImproving = macdHist > macdHist[1]
// MACD Bullish Divergence
macdBullishDivergence = false
if not na(prevLowPrice) and not na(prevLowIndex) and bar_index > prevLowIndex
prevMACD = macdLine[bar_index - prevLowIndex]
if low < prevLowPrice and macdLine > prevMACD and not na(prevMACD)
macdBullishDivergence := true
// 3. Price Action Signals
longLowerWick = lowerWickPercent > minLowerWickPercent
smallBody = bodyPercent < 30.0
bullishClose = close > open
// 4. Quick Recovery Check
quickRecovery = false
if bar_index >= quickRecoveryBars
recoveryTarget = close * (1 + quickRecoveryPercent / 100)
for i = 1 to quickRecoveryBars
if high[i] > recoveryTarget
quickRecovery := true
break
// ENTRY SCORE CALCULATION
entryScore = 0
entryScore := entryScore + (rsiOversoldSignal ? 2 : 0)
entryScore := entryScore + (rsiExtremeOversoldSignal ? 2 : 0)
entryScore := entryScore + (rsiBullishDivergence ? 4 : 0)
entryScore := entryScore + (rsiTurningUp ? 1 : 0)
entryScore := entryScore + (macdNegative ? 1 : 0)
entryScore := entryScore + (macdTurningUp ? 2 : 0)
entryScore := entryScore + (macdHistImproving ? 2 : 0)
entryScore := entryScore + (macdBullishDivergence ? 3 : 0)
entryScore := entryScore + (longLowerWick ? 2 : 0)
entryScore := entryScore + (smallBody ? 1 : 0)
entryScore := entryScore + (bullishClose ? 1 : 0)
entryScore := entryScore + (quickRecovery ? 2 : 0)
entryScore := entryScore + (bullSignal ? 4 : 0) // Green reversal signal +4
// SWING TOP SCORING SYSTEM (for exits)
// 1. RSI Exit Signals
rsiOverboughtSignal = rsi > rsiOverbought
rsiExtremeOverboughtSignal = rsi > rsiExtremeOverbought
rsiTurningDown = rsi < rsi[1]
// RSI Bearish Divergence
[prevHighPrice, prevHighIndex] = findHigherHigh(maxLookbackBars)
rsiBearishDivergence = false
if not na(prevHighPrice) and not na(prevHighIndex) and bar_index > prevHighIndex
prevRSIHigh = rsi[bar_index - prevHighIndex]
if high > prevHighPrice and rsi < prevRSIHigh and not na(prevRSIHigh)
rsiBearishDivergence := true
// 2. MACD Exit Signals
macdPositive = macdLine > 0
macdTurningDown = macdLine < macdLine[1]
macdHistDeclining = macdHist < macdHist[1]
// MACD Bearish Divergence
macdBearishDivergence = false
if not na(prevHighPrice) and not na(prevHighIndex) and bar_index > prevHighIndex
prevMACDHigh = macdLine[bar_index - prevHighIndex]
if high > prevHighPrice and macdLine < prevMACDHigh and not na(prevMACDHigh)
macdBearishDivergence := true
// 3. Price Action Exit Signals
longUpperWick = upperWickPercent > minLowerWickPercent
bearishClose = close < open
// EXIT SCORE CALCULATION
exitScore = 0
exitScore := exitScore + (rsiOverboughtSignal ? 2 : 0)
exitScore := exitScore + (rsiExtremeOverboughtSignal ? 2 : 0)
exitScore := exitScore + (rsiBearishDivergence ? 4 : 0)
exitScore := exitScore + (rsiTurningDown ? 1 : 0)
exitScore := exitScore + (macdPositive ? 1 : 0)
exitScore := exitScore + (macdTurningDown ? 2 : 0)
exitScore := exitScore + (macdHistDeclining ? 2 : 0)
exitScore := exitScore + (macdBearishDivergence ? 3 : 0)
exitScore := exitScore + (longUpperWick ? 2 : 0)
exitScore := exitScore + (bearishClose ? 1 : 0)
exitScore := exitScore + (bearSignal ? 1 : 0) // Red reversal signal +1
// SIGNAL CONDITIONS
longCondition = entryScore >= minEntryScore and barstate.isconfirmed
exitCondition = exitScore >= minExitScore and barstate.isconfirmed
// === TP/SL LEVELS (Clean Logic) ===
var float stopLossLevel = na
var float takeProfitLevel = na
var bool tpslSet = false
// Clear levels when no position
if strategy.position_size == 0
stopLossLevel := na
takeProfitLevel := na
tpslSet := false
// Calculate TP/SL levels ONCE when position is opened
if strategy.position_size > 0 and strategy.position_size[1] == 0 and useRiskReward and not tpslSet
// Find recent low for stop loss
recentLow = low
for i = 1 to stopLossLookback
if low[i] < recentLow
recentLow := low[i]
// Set levels using actual entry price
entryPrice = strategy.opentrades.entry_price(0)
stopLossLevel := recentLow * (1 - stopLossBuffer / 100) // Configurable buffer below recent low
riskAmount = entryPrice - stopLossLevel
takeProfitLevel := entryPrice + (riskAmount * riskRewardRatio)
tpslSet := true
// === 3️⃣ TRADE EXECUTIONS ===
// Long Entry - Single Position Only
if longCondition and strategy.position_size == 0
strategy.entry("Long", strategy.long, comment="Entry Score: " + str.tostring(entryScore))
// Set TP/SL ONLY ONCE per trade (when levels are calculated and not yet set)
if strategy.position_size > 0 and useRiskReward and tpslSet and not na(stopLossLevel) and not na(takeProfitLevel)
strategy.exit("TP/SL", "Long", stop=stopLossLevel, limit=takeProfitLevel)
// Long Exit - Close Position on Swing Top Signal (Only when NOT using TP/SL)
if exitCondition and strategy.position_size > 0 and not useRiskReward
strategy.close("Long", comment="Exit Score: " + str.tostring(exitScore))
// === 4️⃣ VISUALIZATIONS ===
// Entry Score Display (Only When Score ≥ 10) - Shows on ALL qualifying bars
if showEntryScores and entryScore >= 10 and barstate.isconfirmed
label.new(bar_index, low,
text=str.tostring(entryScore),
yloc=yloc.belowbar,
color=na,
style=label.style_label_up,
textcolor=color.green,
size=size.small)
// Exit Score Display (Only When Score ≥ 10) - Shows on ALL qualifying bars
if showExitScores and exitScore >= 10 and barstate.isconfirmed
label.new(bar_index, high,
text=str.tostring(exitScore),
yloc=yloc.abovebar,
color=na,
style=label.style_label_down,
textcolor=color.red,
size=size.small)
// Large Trade Entry Triangle (Only when actually entering a position) - Using plotshape to avoid label limits
plotshape(longCondition and strategy.position_size == 0, title="Trade Entry", location=location.belowbar, color=color.green, style=shape.triangleup, size=size.normal, text="BUY")
// Large Trade Exit Triangle (Only when actually exiting a position) - Using plotshape to avoid label limits
plotshape(exitCondition and strategy.position_size > 0, title="Trade Exit", location=location.abovebar, color=color.red, style=shape.triangledown, size=size.normal, text="SELL")
// Reversal Signal Triangles
plotshape(bullSignal, title="Bull Reversal", location=location.belowbar,
color=color.lime, style=shape.triangleup, size=size.tiny)
plotshape(bearSignal, title="Bear Reversal", location=location.abovebar,
color=color.red, style=shape.triangledown, size=size.tiny)
// === TP/SL LEVEL PLOTS ===
plot(strategy.position_size > 0 and useRiskReward ? stopLossLevel : na, title="Stop Loss", color=color.red, linewidth=2, style=plot.style_linebr)
plot(strategy.position_size > 0 and useRiskReward ? takeProfitLevel : na, title="Take Profit", color=color.green, linewidth=2, style=plot.style_linebr)
// MACD and RSI Plots (in separate panes)
macdPlot = plot(macdLine, title="MACD Line", color=color.blue, display=display.none)
signalPlot = plot(signalLine, title="Signal Line", color=color.red, display=display.none)
histPlot = plot(macdHist, title="MACD Histogram", color=color.gray, style=plot.style_histogram, display=display.none)
rsiPlot = plot(rsi, title="RSI", color=color.purple, display=display.none)
rsiOverboughtLine = hline(rsiOverbought, title="RSI Overbought", color=color.red, linestyle=hline.style_dashed, display=display.none)
rsiOversoldLine = hline(rsiOversold, title="RSI Oversold", color=color.green, linestyle=hline.style_dashed, display=display.none)