Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
//@Version=5
indicator("Smoothed VWAP Range", overlay=true)
// 输入参数
length = input.int(200, title="Length")
bandMultiplier = input.float(2.0, title="Band Multiplier")
showBands = input.bool(true, title="Show Bands")
showClose = input.bool(true, title="Show Close Line")
showHLArea = input.bool(true, title="Show High-Low Area")
// 计算成交量和VWAP
vol = volume
volSma = ta.sma(vol, length)
srcVolSmaClose = ta.sma(close * vol, length)
srcVolSmaHigh = ta.sma(high * vol, length)
srcVolSmaLow = ta.sma(low * vol, length)
vwapHighClose = srcVolSmaClose / volSma
vwapHighHigh = srcVolSmaHigh / volSma
vwapHighLow = srcVolSmaLow / volSma
// 控制显示高低区域 (云图)
hline = showHLArea ? vwapHighHigh : na
lline = showHLArea ? vwapHighLow : na
plot(hline, color=color.new(color.blue, 0), title="VWAP High", linewidth=1)
plot(lline, color=color.new(color.blue, 0), title="VWAP Low", linewidth=1)
fill(hline, lline, color=color.new(color.blue, 90), title="HL Area")
// 控制显示收盘线
plot(showClose ? vwapHighClose : na, color=color.white, title="VWAP Close Line", linewidth=2)
// 计算并显示VWAP标准差带
if (showBands)
srcSrcVolSmaClose = ta.sma(vol * math.pow(close, 2), length)
srcSrcVolSmaHigh = ta.sma(vol * math.pow(high, 2), length)
srcSrcVolSmaLow = ta.sma(vol * math.pow(low, 2), length)