Sell alert [Crypto_BCT]
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Crypto_BitCoinTrader

//@version=5
indicator(title="Sell alert [Crypto_BCT]", overlay=true, max_labels_count = 500)

rsi = ta.rsi(close,14)
RSI_Top = input(64, "RSI High")
rsisell = rsi>RSI_Top

mfi = ta.mfi(close,14)
MFI_Top = input(70, "MFI High")
mfisell = mfi>MFI_Top

cci = ta.cci(hlc3, 20)
CCI_Top = input(200, "CCI High")
ccisell = cci>CCI_Top

atrinput = input(6, "ATR")
atr = ta.atr(atrinput)

emainput = input(150, "EMA")
ema = ta.ema(close, emainput)

highbar = input(36, "Highest bar from")
highclosebar = ta.highestbars(close, highbar)
color labelsell = color(color.red)

resultema = 0
int emahigh = input.int(30, minval=2, title="Highest EMA bar ago")
for i = 1 to emahigh
	if ema[i-1]>ema[i]
		resultema += 1

sell = highclosebar == 0 and rsisell and mfisell and ccisell and open>ema and resultema == emahigh and (high-low>atr or low-high>atr)

plot(ema, "EMA")

if sell
    label.new(bar_index, high, yloc = yloc.abovebar, color=labelsell, style=label.style_triangledown, size=size.tiny)
    
bgcolor(sell ? color.new(color.red,70) : na)
alertcondition(sell, title="High Price Detected", message="High Price Detected")