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

@indicator('Farbwechsel-Band-Indikator', overlay_main_pane=True)
@param.int('long_length', default=50)
@param.int('short_length', default=20)
@plot.line('long_sma')
@plot.line('short_sma')
@plot.fill('long_sma', 'short_sma', id='#fill_2')
def Main(self, long_length, short_length):
    long_sma = Sma.new(self.close, long_length)
    short_sma = Sma.new(self.close, short_length)

    band_color = color.GREEN(0.3) if short_sma[0] > long_sma[0] else color.RED(0.3)

    return long_sma[0], short_sma[0], plot.Fill(color=band_color)
