Buy 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="Buy alert [Crypto_BCT]", overlay=true, max_labels_count = 500)

rsi = ta.rsi(close,14)
RSI_Bottom = input(36, "RSI low")
rsibuy = rsi<RSI_Bottom

mfi = ta.mfi(close,14)
MFI_Bottom = input(30, "MFI low")
mfibuy = mfi<MFI_Bottom

cci = ta.cci(hlc3, 20)
CCI_Bottom = input(-200, "CCI Low")
ccibuy = cci<CCI_Bottom

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

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

lowbar = input(36, "Lowest bar from")
lowclosebar = ta.lowestbars(close, lowbar)
color labelbuy = color(color.green)

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

buy = lowclosebar == 0 and rsibuy and mfibuy and ccibuy and open<ema and resultema == emalow and (high-low>atr or low-high>atr)

plot(ema, "EMA")

if buy
    label.new(bar_index, low, yloc = yloc.belowbar, color=labelbuy, style=label.style_triangleup, size=size.tiny)
    
bgcolor(buy ? color.new(color.green,70) : na)
alertcondition(buy, title="Low Price Detected", message="Low Price Detected")