Choose Symbol, candle and Trend mode
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © erdas0

//@version=5
indicator('Choose Symbol, candle and Trend mode', overlay=false)
//Komut
ha = input(false, title='Heikin-Ashi mode?')
len = input(1)
users = input(true, title='Use Current Chart Resolution?')
tf = input.timeframe(title='Use Different Timeframe?', defval='')
res = users ? timeframe.period : tf
sym = input.symbol(defval = 'BINANCE:BTCUSDT',title = "Symbol")
symo1 = request.security(sym, res, open)
symh1 = request.security(sym, res, high)
syml1 = request.security(sym, res, low)
symc1 = request.security(sym, res, close)

symo = ta.ema(symo1,len)
symh = ta.ema(symh1,len)
syml = ta.ema(syml1,len)
symc = ta.ema(symc1,len)

o = ha ? (symo[1]+symc[1])/2 : symo
h = ha ? math.max(symh,symo,symc) : symh
l = ha ? math.min(syml,symo,symc) : syml
c = ha ? (symo+symc+symh+syml)/4 : symc

op = request.security(sym, res, o)
hp = request.security(sym, res, h)
lp = request.security(sym, res, l)
cp = request.security(sym, res, c)
col = 0.0
col := cp > op and cp > cp[1] ? 1 : cp < op and cp < cp[1] ? -1 : col[1]
clr = col == 1 ? color.teal : col == -1 ? color.red : color.yellow

// Plots
plotcandle(op, hp, lp, cp, color=clr, wickcolor=clr, bordercolor=clr, title='Candle') 

//Trend
fast=input.int(2,"Fast", group="Trend")
slow=input.int(10,"Slow")
overb=input.int(90,"Over Bought")
overs=input.int(10,"Over Sold")
size=input.string(size.small,options=[size.auto,size.tiny,size.small,size.normal,size.large,size.huge])
ema=ta.ema(ta.rsi(c,fast),slow)

cle= ema>ema[1] ? color.lime : ema<ema[1] ? color.red : color.blue

buy= ema>ema[1] 
buyt= overb-ema
txtb=str.tostring(buyt,"#.##")
txts=str.tostring(ema+overs,"#.##")

var label lbl = na
label.delete(lbl)
if ema>ema[1]
    lbl := label.new(bar_index,c*0.96, txtb, color=color.lime, style=label.style_label_up,size=size)
    label.set_text(lbl, "BUY" + "\n" + txtb+"%")
else
    lbl := label.new(bar_index,c*1.06, txts, color=color.red, style=label.style_label_down,size=size)
    label.set_text(lbl, "SELL" + "\n" + txts+"%")

pema=math.max(math.min(ema,1),0.9)*c
plot(pema,color=cle,display = display.none)