OPEN-SOURCE SCRIPT

介休



//version=5
strategy("Wyckoff BTC Strategy v3", overlay=true, margin_long=100, margin_short=100)

// —— 正确定义全局变量 ——
var bool springCondition = false // 初始化为布尔类型
var bool volumeCondition = false
var bool divergenceCondition = false

// —— 指标计算 ——
volumeMA20 = ta.sma(volume, 20)
dailyClose = request.security(syminfo.tickerid, "D", close)
dailyMA50 = ta.sma(dailyClose, 50)
currentRSI = ta.rsi(close, 14)
currentATR = ta.atr(14)

// —— 信号计算 ——
springLow = ta.lowest(low, 10)[1]
springCondition := low < springLow and close > springLow and volume > volumeMA20

volumeCondition :=
volume[3] > 1.5 * volumeMA20[3] and
volume < 0.7 * volumeMA20

priceHigh = ta.highest(high, 10)
rsiHigh = ta.highest(currentRSI, 10)
divergenceCondition := high >= priceHigh and currentRSI < rsiHigh



// —— 可视化 ——
plotshape(longCondition, style=shape.triangleup, color=color.green, location=location.belowbar)
plotshape(exitCondition, style=shape.triangledown, color=color.red, location=location.abovebar)

Penafian