I am trying to implement one of user "layzybear" indicator into a strategy. The indicator is Elder Impuls System "EIS_lb", which I have coded to v4. The goal is to set (green backgound = OK to Buy) and (red backgound = OK to Sell) and (blue backgound = NOK to trade). But I just cant understand how I can de-construct the multi line-function to set these rules. Usually I just set the plot-conditions as buy and sell rules, but that wont work here.
I would be very thankful for any help or thoughts.
useCustomResolution=input(true, type=input.bool)
customResolution=input("D", type=input.resolution)
source = security(syminfo.ticker, useCustomResolution ? customResolution : timeframe.period, close, barmerge.gaps_off, barmerge.lookahead_on)
lengthEMA = input(13)
fastLength = input(12, minval=1),
slowLength=input(26,minval=1)
signalLength=input(9,minval=1)
calc_hist(source, fastLength, slowLength) =>
fastMA = ema(source, fastLength)
slowMA = ema(source, slowLength)
macd = fastMA - slowMA
signal = sma(macd, signalLength)
macd - signal
get_color(emaSeries, macdHist) =>
g_f = (emaSeries > emaSeries[1]) and (macdHist > macdHist[1])
r_f = (emaSeries < emaSeries[1]) and (macdHist < macdHist[1])
g_f ? color.green : r_f ? color.red : color.blue
b_color = get_color(ema(source, lengthEMA), calc_hist(source, fastLength, slowLength))
bgcolor(b_color, transp=50)