# indie:lang_version = 5
from indie import indicator, param, source, plot, color
from indie.algorithms import Vwap

@indicator('VWAP with Standard Deviation Bands', overlay_main_pane=True)
@param.source('src', default=source.HLC3, title='Source')
@param.str('anchor', default='Session', options=['Session', 'Week', 'Month', 'Year'], title='Anchor')
@param.float('std_dev_1', default=1.0, min=0.1, max=5.0, step=0.1, title='Standard Deviation 1')
@param.float('std_dev_2', default=2.0, min=0.1, max=5.0, step=0.1, title='Standard Deviation 2')
@plot.line('vwap', title='VWAP', color=color.BLUE, line_width=2)
@plot.line('upper_1', title='Upper Band 1σ', color=color.GREEN)
@plot.line('lower_1', title='Lower Band 1σ', color=color.GREEN)
@plot.line('upper_2', title='Upper Band 2σ', color=color.RED)
@plot.line('lower_2', title='Lower Band 2σ', color=color.RED)
@plot.fill('upper_1', 'lower_1', color=color.GREEN(0.1), title='1σ Band')
@plot.fill('upper_2', 'lower_2', color=color.RED(0.05), title='2σ Band')
def Main(self, src, anchor, std_dev_1, std_dev_2):
    # Get VWAP with 1 standard deviation bands
    vwap_1, upper_1, lower_1 = Vwap.new(src, anchor, std_dev_1)
    
    # Get VWAP with 2 standard deviation bands (we only need the bands, VWAP line is the same)
    vwap_2, upper_2, lower_2 = Vwap.new(src, anchor, std_dev_2)
    
    return (
        vwap_1[0],      # VWAP line
        upper_1[0],     # Upper 1σ band
        lower_1[0],     # Lower 1σ band  
        upper_2[0],     # Upper 2σ band
        lower_2[0],     # Lower 2σ band
        plot.Fill(),    # Fill for 1σ band
        plot.Fill()     # Fill for 2σ band
    )
