三重共振捕捉策略

WT CRSI LSDD
创建日期: 2025-10-09 14:09:21 最后修改: 2025-10-09 14:09:21
复制: 0 点击次数: 212
avatar of ianzeng123 ianzeng123
2
关注
319
关注者

三重共振捕捉策略 三重共振捕捉策略

三个指标必须在2根K线内同时发出信号,否则免谈

这不是普通的多指标策略。WaveTrend + Connors RSI + 线性回归偏差的组合,关键在于窗口同步机制:所有买入信号必须在2根K线范围内出现,单独的信号直接忽略。这种设计直接过滤掉90%的假信号。

传统策略要么各指标独立判断容易产生噪音,要么要求同时触发错过大量机会。这个策略找到了平衡点:2根K线的容错窗口既保证了信号的相关性,又避免了过于严格的同步要求。

WaveTrend设置-48超卖线,比标准RSI更敏感

WT长度设为10周期,超卖线-48,超买线48。这个参数组合比传统RSI的30/70更激进,能更早捕捉到价格反转信号。WT的优势在于它结合了价格位置和波动率,在震荡行情中比单纯的RSI更可靠。

关键是WT的计算方式:(典型价格-EMA)/(0.015*偏差的EMA),这个公式天然具备波动率调整功能。当市场波动加剧时,分母变大,WT值相对稳定,避免了普通RSI在高波动期间的失真问题。

Connors RSI三重验证,20/80阈值设定有深意

CRSI不是普通RSI,它融合了价格RSI、连涨连跌RSI和价格变化百分位排名。20的超卖阈值比传统30更激进,但CRSI的三重验证机制降低了假信号概率。

6周期的RSI长度设置偏短,目的是提高信号敏感度。在15分钟级别上,6周期相当于1.5小时的价格记忆,既能捕捉短期超卖又不会过度滞后。这个参数在BTC这种24小时交易的品种上特别有效。

线性回归偏差LSDD,20周期捕捉趋势转折

LSDD = 当前价格 - 线性回归值,当LSDD上穿0轴时说明价格开始偏离下降趋势线。20周期的设置在15分钟图上覆盖5小时,能有效识别中短期趋势变化。

这个指标的精妙之处在于它不是简单的趋势跟随,而是趋势偏差度量。当价格持续下跌后开始偏离回归线向上,往往预示着反弹的开始。结合WT和CRSI的超卖信号,形成了”超卖+趋势转折”的双重确认。

只做多头,30%仓位,1倍金字塔

策略设计为纯多头,每次开仓30%资金,允许1次加仓。这种设置适合加密货币的长期上涨趋势,同时通过仓位控制管理风险。30%的单次仓位既能获得足够收益,又避免了单笔交易的过度风险。

退出条件同样严格:WT超买(>48) AND CRSI超买(>80) AND LSDD转负,三个条件必须同时满足。这种设计确保了趋势交易的完整性,避免过早离场。

15分钟BTC回测优化,但需要注意市场环境

策略在BTC 15分钟级别回测表现良好,但这不代表在所有市场环境下都有效。横盘震荡市场中,即使三重确认也可能产生较多假信号。策略最适合有明确趋势特征的市场环境。

风险提示:历史回测不代表未来收益,加密货币市场波动极大,存在本金损失风险。建议在实盘前进行充分的纸面交易验证,并严格控制总体仓位。

策略源码
/*backtest
start: 2024-10-09 00:00:00
end: 2025-10-07 08:00:00
period: 1h
basePeriod: 1h
exchanges: [{"eid":"Binance","currency":"BTC_USDT","balance":500000}]
*/

//@version=5
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © alescha13
// WT + CRSI + Linear Regression Long-only Strategy
// Description: 
// This long-only trading strategy combines WaveTrend (WT), 
// Connors RSI (CRSI), and a Linear Regression Slope (LSDD) trend filter.
// Signals are generated only when all three indicators align within a defined window.
// Exits occur when all indicators turn bearish.
// Backtested on BTC with 15-minute timeframe.

strategy("WT + CRSI + Linear Regression Long-only © alescha13", 
     overlay=true, 
     initial_capital=10000, 
     default_qty_type=strategy.percent_of_equity, 
     default_qty_value=30, 
     pyramiding=1, 
     calc_on_every_tick=false, 
     process_orders_on_close=true)

// =====================
// Inputs
// =====================
wtLength        = input.int(10, "WT Length")
wtOversold      = input.int(-48, "WT Oversold Level")
wtOverbought    = input.int(48, "WT Overbought Level")

crsiRSILength   = input.int(6,  "CRSI RSI Length")
crsiOversold    = input.int(20, "CRSI Oversold Level")
crsiOverbought  = input.int(80, "CRSI Overbought Level")

lsddLen         = input.int(20, "Linear Regression Length")

windowSize      = input.int(2, "Window size (bars) for all signals", minval=1)

// =====================
// Helper: CRSI Function
// =====================
updown(s) =>
    isEqual = s == s[1]
    isGrowing = s > s[1]
    ud = 0.0
    ud := isEqual ? 0 : isGrowing ? (nz(ud[1]) <= 0 ? 1 : nz(ud[1]) + 1) : (nz(ud[1]) >= 0 ? -1 : nz(ud[1]) - 1)
    ud

crsiFunc(src, lenrsi) =>
    lenupdown = 2
    lenroc = 100
    rsi = ta.rsi(src, lenrsi)
    updownrsi = ta.rsi(updown(src), lenupdown)
    percentrank = ta.percentrank(ta.roc(src, 1), lenroc)
    math.avg(rsi, updownrsi, percentrank)

// =====================
// WaveTrend (WT) Calculation
// =====================
ap  = (high + low + close) / 3.0
esa = ta.ema(ap, wtLength)
d   = ta.ema(math.abs(ap - esa), wtLength)
ci  = (ap - esa) / (0.015 * d)
wt  = ta.ema(ci, 3)

wtBull = ta.crossover(wt, wtOversold)
wtBear = wt > wtOverbought

// =====================
// CRSI Calculation
// =====================
crsiValue = crsiFunc(close, crsiRSILength)
crsiBull  = crsiValue < crsiOversold
crsiBear  = crsiValue > crsiOverbought

// =====================
// Linear Regression LSDD Calculation
// =====================
slope = ta.linreg(close, lsddLen, 0)
lsdd = close - slope
lsddBull = ta.crossover(lsdd, 0)
lsddBear = lsdd < 0

// =====================
// Window Logic (Synchronize Signals)
// =====================
var int wtBarIndex   = na
var int crsiBarIndex = na
var int lsddBarIndex = na

if wtBull
    wtBarIndex := bar_index
if crsiBull
    crsiBarIndex := bar_index
if lsddBull
    lsddBarIndex := bar_index

buySignal = false
if not na(wtBarIndex) and not na(crsiBarIndex) and not na(lsddBarIndex)
    maxBar = math.max(wtBarIndex, crsiBarIndex, lsddBarIndex)
    minBar = math.min(wtBarIndex, crsiBarIndex, lsddBarIndex)
    if (maxBar - minBar) <= windowSize
        buySignal := true
        wtBarIndex := na
        crsiBarIndex := na
        lsddBarIndex := na

finalLong = buySignal

// =====================
// Exit Logic
// =====================
sellSignal = wtBear and crsiBear and lsddBear

// =====================
// Entries / Exits
// =====================
if finalLong
    strategy.entry("Long", strategy.long, comment="Long Entry")

if sellSignal
    strategy.close("Long", comment="Long Exit")

// =====================
// Background Color for Signals
// =====================
bgcolor(finalLong ? color.new(color.green, 85) : na)
bgcolor(sellSignal ? color.new(color.red, 85) : na)

// =====================
// Plots
// =====================
plot(wt, color=color.new(color.blue, 0), title="WT")
plot(crsiValue, color=color.new(color.purple, 0), title="CRSI")
plot(lsdd, color=color.new(color.orange, 0), title="LSDD")

plotshape(finalLong, title="Buy Signal", location=location.belowbar, color=color.green, style=shape.triangleup, size=size.small)
plotshape(sellSignal, title="Sell Signal", location=location.abovebar, color=color.red, style=shape.triangledown, size=size.small)

// =====================
// Alerts
// =====================
alertcondition(finalLong, title="Long Alert", message="WT + CRSI + LSDD Long Signal")
alertcondition(sellSignal, title="Exit Alert", message="WT + CRSI + LSDD Exit Signal")
相关推荐