该策略是一个基于多维度云图(Ichimoku Cloud)指标的趋势跟踪交易系统。策略通过云图的核心组件交叉来识别市场趋势,并在价格突破关键技术位时产生交易信号。该策略采用非重绘方式,所有信号均在K线收盘时确认,有效降低了虚假信号的风险。策略适用于多个时间周期,尤其适合波动性较强的市场环境。
策略的核心逻辑基于以下三个关键条件: 1. 价格突破基准线(Base Line)上方,表明短期趋势转强 2. 价格突破前导线A(Lead Line A)上方,确认中期趋势方向 3. 价格位于转换线(Conversion Line)上方,验证趋势持续性 当这三个条件同时满足时,系统会在K线收盘时发出做多信号。相反的条件组合则触发平仓信号。策略还采用了云图填充来增强趋势的可视化效果,云图呈绿色表示多头市场,红色表示空头市场。
该策略通过对云图指标的创新应用,建立了一个可靠的趋势跟踪交易系统。策略的非重绘设计和多重确认机制显著提高了信号质量。虽然在震荡市场表现欠佳,但通过建议的优化方向可以进一步提升策略的稳定性和适用性。策略特别适合追踪中长期趋势,对于寻求趋势跟踪机会的交易者来说是一个很好的选择。
/*backtest
start: 2025-01-09 00:00:00
end: 2025-01-16 00:00:00
period: 10m
basePeriod: 10m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT","balance":49999}]
*/
//@version=5
strategy("Ichimoku Cloud Buy Strategy (Non-Repainting)", overlay=true)
// === Ichimoku Cloud Settings ===
lengthConversionLine = input(9, title="Conversion Line Length")
lengthBaseLine = input(26, title="Baseline Length")
lengthLeadLine = input(52, title="Lead Line Length")
// === Calculate Ichimoku Cloud Components ===
conversionLine = ta.sma((high + low) / 2, lengthConversionLine)
baseLine = ta.sma((high + low) / 2, lengthBaseLine)
leadLineA = (conversionLine + baseLine) / 2
leadLineB = ta.sma((high + low) / 2, lengthLeadLine)
// === Forward Projected Lead Lines (Fixes Ichimoku Calculation) ===
leadLineA_Future = leadLineA[lengthBaseLine] // Shift forward
leadLineB_Future = leadLineB[lengthBaseLine]
// === Define Buy and Sell Conditions (Confirmed at Bar Close) ===
buyCondition = ta.crossover(close, baseLine) and ta.crossover(close, leadLineA) and close > conversionLine and bar_index > bar_index[1]
sellCondition = ta.crossunder(close, baseLine) and ta.crossunder(close, leadLineA) and close < conversionLine and bar_index > bar_index[1]
// === Plot Buy and Sell Signals (Confirmed at Bar Close) ===
plotshape(buyCondition, style=shape.triangleup, location=location.belowbar, color=color.green, size=size.small, title="Buy Signal")
plotshape(sellCondition, style=shape.triangledown, location=location.abovebar, color=color.red, size=size.small, title="Sell Signal")
// === Implement Strategy Logic (Trades at Bar Close) ===
if (buyCondition)
strategy.entry("Buy", strategy.long)
if (sellCondition)
strategy.close("Buy")
// === Plot Ichimoku Cloud Components with Future Projection ===
pConversionLine = plot(conversionLine, color=color.blue, title="Conversion Line")
pBaseLine = plot(baseLine, color=color.red, title="Base Line")
pLeadLineA = plot(leadLineA_Future, color=color.green, title="Lead Line A", offset=lengthBaseLine)
pLeadLineB = plot(leadLineB_Future, color=color.orange, title="Lead Line B", offset=lengthBaseLine)
// === Fill Ichimoku Cloud for Better Visualization ===
fill(pLeadLineA, pLeadLineB, color=leadLineA > leadLineB ? color.green : color.red, transp=80)
// === Alert Conditions (Only Triggered on Confirmed Signals) ===
alertcondition(buyCondition, title="Ichimoku Cloud Buy Signal", message="Ichimoku Cloud Buy Signal Triggered")
alertcondition(sellCondition, title="Ichimoku Cloud Sell Signal", message="Ichimoku Cloud Sell Signal Triggered")