eisiParticipant
Average
Hello!
Maybe somebody can help me. I’d like to have an indicator which sets the backgroundcolor to green when there is a close above the upper bollinger band and stays green until there is a close below the lower bollinger band. And when there is a close under the lower BB the backgroundcolor turns red until there is a close above the upper BB and so on.
Thanks In advance
There you go:
ONCE Red = 0
ONCE Green = 0
ONCE Blue = 0
ONCE Fade = 0
ONCE BBVal = 20 //20 BB periods
ONCE BBdev = 2.0 //2.0 BB Deviation
BBavg = Average[BBval,0](close) //BB mean (middle line) 0=sma
BollUP = BBavg + ((std[BBval](close)) * BBdev)//Bollinger Upper Band
BollDN = BBavg - ((std[BBval](close)) * BBdev)//Bollinger Lower Band
IF close >= BollUP THEN
Red = 0
Green = 255
Blue = 0
Fade = 32
ELSIF close <= BollDN THEN
Red = 255
Green = 0
Blue = 0
Fade = 32
ENDIF
BackgroundColor(Red,Green,Blue,Fade)
RETURN
eisiParticipant
Average
Thank you so much Roberto!
Simple but efficient, thank Roberto 🙂