//@version=5 // Betatrader.ir indicator('Betatrader HeikinAshi Macd', overlay=false, shorttitle='Betatrader HeikinAshi Macd',timeframe="") Bullishcolor= input.color(#00332a, "Bullish Color",group="Heikin Ashi") Bearishcolor= input.color(#ff0000, "Bearish Color",group="Heikin Ashi") ha_open = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, open) ha_high = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, high) ha_low = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, low) ha_close = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, close) plotcandle(ha_open < ha_close ? ha_open : na, ha_high, ha_low, ha_close, title='Bullish Candles', color=Bullishcolor, wickcolor=Bullishcolor, bordercolor=Bullishcolor) plotcandle(ha_open >= ha_close ? ha_open : na, ha_high, ha_low, ha_close, title='Bearish Candles', color=Bearishcolor, wickcolor=Bearishcolor, bordercolor=Bearishcolor) // fastMA = input.int(title='Fast moving average', defval=12, minval=7,group="Macd") slowMA = input.int(title='Slow moving average', defval=26, minval=7,group="Macd") lastColor = color.yellow [currMacd, signal, _] = ta.macd(close[0], fastMA, slowMA, 9) [prevMacd, _, _] = ta.macd(close[1], fastMA, slowMA, 9) plotColorr = currMacd > 0 ? currMacd > prevMacd ? #12b004 : #12b005 : currMacd < prevMacd ? #ff0000 : #ff0005 show = input.bool(true,title='Show Macd Background',group="Macd") bgcolor(show?plotColorr:na, title='MACD Background', transp=80) // Betatrader.ir