fix: Correct band fill in Sunny_Bands.pine using plot references
This commit is contained in:
parent
072fba4006
commit
95d1692349
@ -21,10 +21,13 @@ lower_band = dma - (atr * atr_multiplier)
|
||||
bullish = ta.crossover(close, lower_band)
|
||||
bearish = ta.crossunder(close, upper_band)
|
||||
|
||||
// Plotting with similar colors to Python version
|
||||
plot(dma, "DMA", color=color.new(#009688, 0), linewidth=2)
|
||||
plot(upper_band, "Upper Band", color=color.new(#FF5252, 0), linewidth=2)
|
||||
plot(lower_band, "Lower Band", color=color.new(#4CAF50, 0), linewidth=2)
|
||||
// Store plot references for fill
|
||||
dma_plot = plot(dma, "DMA", color=color.new(#009688, 0), linewidth=2)
|
||||
upper_plot = plot(upper_band, "Upper Band", color=color.new(#FF5252, 0), linewidth=2)
|
||||
lower_plot = plot(lower_band, "Lower Band", color=color.new(#4CAF50, 0), linewidth=2)
|
||||
|
||||
// Correct fill using plot references
|
||||
fill(upper_plot, lower_plot, color.new(#673AB7, 90), "Band Area")
|
||||
|
||||
// Signal markers
|
||||
plotshape(bullish, "Bullish Signal", style=shape.triangleup,
|
||||
@ -32,9 +35,6 @@ plotshape(bullish, "Bullish Signal", style=shape.triangleup,
|
||||
plotshape(bearish, "Bearish Signal", style=shape.triangledown,
|
||||
location=location.abovebar, color=color.red, size=size.small)
|
||||
|
||||
// Background between bands like Python version
|
||||
fill(upper_band, lower_band, color.new(#673AB7, 90), title="Band Area")
|
||||
|
||||
// Alerts equivalent to get_signals() method
|
||||
alertcondition(bullish, "Bullish Signal Detected",
|
||||
"Sunny Bands: Bullish crossover of lower band")
|
||||
|
||||
Loading…
Reference in New Issue
Block a user