Aarika Heikin Ashi
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © hlsolanki

//@version=5
indicator('Aarika Heikin Ashi', shorttitle='AHA', overlay=false)

// inputs
src = input.source(close, 'EMA Source', tooltip='Source of EMA (default: close price)', group='EMA')
length_fast = input.int(8, 'fast length', tooltip='Fast EMA length, adjust it according to different timeframe', group='EMA')
length_slow = input.int(21, 'slow length', tooltip='Slow EMA length, adjust it according to different timeframe', group='EMA')

// get Heikin-Ashi OHLC
[ha_open, ha_high, ha_low, ha_close] = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, [open, high, low, close])

// 2 EMAs for trend recognition
ema_fast = ta.ema(src, length_fast)
ema_slow = ta.ema(src, length_slow)

// define colors
c = ha_close > ha_open ? color.new (color.lime, 0) : color.new (color.red, 0)

// plot Heikin-Ashi candlesticks
plotcandle(ha_open, ha_high, ha_low, ha_close, color=c)

// plot 2 ema lines
plot(ema_fast, color=color.new(color.blue, 0), linewidth=2)
plot(ema_slow, color=color.new(color.black, 0), linewidth=2)

