((Bearish)) Candle Above EMAS
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © MINTYFRESH97

//@version=5
indicator(title="((Bearish)) Candle Above EMAS", overlay=true)

// Calculate moving averages
// Calculate moving averages
var g_ema    = "EMA Filter"
emaLength21    = input.int(title="21EMA", defval=21, tooltip="Length of the EMA filter", group=g_ema)
emaLength50    = input.int(title="50EMA", defval=50, tooltip="Length of the EMA filter", group=g_ema)
emaLength100    = input.int(title="100EMA", defval=100 , tooltip="Length of the EMA filter", group=g_ema)
emaLength200    = input.int(title="200EMA", defval=200, tooltip="Length of the EMA filter", group=g_ema)

// Create table
var table myTable = table.new(position.top_right, 5, 6, border_width=4)

if barstate.ishistory
    txt1 = "ONLY USE WHEN THE MARKET IS TRENDING \n" 
    

    table.cell(myTable, 0, 0, text=txt1, bgcolor=color.white, text_size=size.large  , text_color=color.red)
    

 

fastMA = ta.ema(close, emaLength21)
fastMA50= ta.ema(close, emaLength50)
fastMA100= ta.ema(close, emaLength100)

// Get EMA filter
ema = ta.ema(close, emaLength200)
emaFilterShort = close <  ema




//shortsignal 

shortsignal = ta.crossover(fastMA,close)
shortsignal1 = ta.crossover(fastMA50,close)
shortsignal2 = ta.crossover(fastMA100,close)



bearishcandlesfilter1 =shortsignal1 and emaFilterShort and timeframe.isdaily
bearishcandlesfilter2 =shortsignal2 and emaFilterShort and timeframe.isdaily


plotshape(bearishcandlesfilter1, style=shape.diamond, color=color.red, size=size.tiny, text="Above50ema", title="Bearish Price above 50ema" ,location=location.abovebar)
barcolor(bearishcandlesfilter1 ? color.red :na)
alertcondition(bearishcandlesfilter1,  "Bearish Price below 50eam{{ticker}}")

plotshape(bearishcandlesfilter2, style=shape.diamond, color=color.red, size=size.tiny, text="Above100ema", title="Bearish Price above 100ema" ,location=location.abovebar)
barcolor(bearishcandlesfilter2 ? color.red :na)
alertcondition(bearishcandlesfilter2, "Bearish Price above 100ema{{ticker}}")


