Market Indicator
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © peterbutterknife

//@version=4
study("MarketIndicator", overlay=false)


ma20 = sma(close,20)
ind = log(close/ma20)

plot(ind,color=color.white)

// Colour background
backgroundRed = if ind<0
    color.red
backgroundGreen = if ind>0
    color.lime

bgcolor(backgroundRed, transp=40,
     title="Conditionally coloured background")
bgcolor(backgroundGreen, transp=40)