Background Color hma 
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © eshagav

//@version=4



//Inputs hmastudy("Background Color hma ", overlay=true)
study("Background Color hma ", overlay=true)
src = input(close, title="source")
len = input(minval=1, defval=21, title="length")
hma = hma(src, len)

//Inputs BGColor
longC = input(type= input.color, defval=color.green)
shortC = input(type= input.color, defval=color.red)
trans = input(type=input.integer, defval=80, minval=1, maxval=99)

//Calculation
long = close > hma
short = close < hma

plot(hma)
bgcolor(color=long ? longC : shortC, transp=trans)