Angels Calls 2.0- By Cloves
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © ClovesRodrigues

//@version=4
study("Angels Calls 3.0- By Cloves", shorttitle="Angels Calls 3.0 - By Cloves",  scale=scale.right, overlay=true)
//precision=0

data = close < open

[middle, upper, lower] = bb(close, 21, 2)
plot(middle, color=#1d79f2)
plot(upper, color=color.red, linewidth=2)
plot(lower, color=color.green, linewidth=2)

r = rsi(close, 21)
c = cci(close, 20)
e5 = ema(close, 5)
e10 = ema(low,10)
e20 = ema(close, 20)
e50 = ema(close, 40)
e200 = ema(close, 200)


eUp = crossover(e5, e10)
eLONG = crossover(e5, e50)
eGOOD = crossover(e20, e50)
eTOP = crossover(e50, e200)
eSell = crossunder(e5, e50)
eSHORTLow = crossunder(e5, e20)
eSHORT = crossunder(e20, e50)
eSellStrong = crossunder(e20, e200)


barcolor((ema(close, 2)) > (ema(close, 4)) ? color.green : color.red)

// Detect crosses.
xUp = crossunder( r, 65)
xUltra = crossunder( r, 75)
xDn = crossover(r, 35)

cUp = crossunder(c, 120)
c200 = crossunder(c, 200)
cUltra = crossunder(c, 300)
cDn = crossover(c, -100)
cBUY = crossover(c, -200)

color1 = color.from_gradient(close, e50, e5, color.new(color.red, 15), color.new(color.green, 15))
color2 = color.from_gradient(close, e200, e5, color.new(color.red, 15), color.new(color.blue, 15))

plot(ema(close, 20), color=color1, linewidth=4, style=plot.style_line)
plot(ema(close, 200), color=color2, linewidth=4, style=plot.style_line)


var Table = table.new(position = position.top_right, columns = 5, rows = 5, bgcolor = color.new(color.green, 50), border_width = 2)


table.cell(table_id = Table, column = 0, row = 2, text = "PRICE : ", bgcolor = color.green)
table.cell(table_id = Table, column = 1, row = 2, text = tostring(close), bgcolor = color.yellow)
if r>60
    table.cell(table_id = Table, column = 0, row = 2, text = "  PRICE : ", bgcolor = color.green)
    table.cell(table_id = Table, column = 1, row = 2, text = tostring(close), bgcolor = color.yellow)
else if r>70
    table.cell(table_id = Table, column = 0, row = 2, text = "Suport : ", bgcolor = color.green)
    table.cell(table_id = Table, column = 1, row = 2, text = tostring(close*0.9215), bgcolor = color.yellow)
else if r<40
    table.cell(table_id = Table, column = 0, row = 2, text = "PRICE : ", bgcolor = color.green)
    table.cell(table_id = Table, column = 1, row = 2, text = tostring(close), bgcolor = color.yellow)
else
    table.cell(table_id = Table, column = 0, row = 2, text = "  PRICE : ", bgcolor = color.green)
    table.cell(table_id = Table, column = 1, row = 2, text = tostring(close), bgcolor = color.yellow)

if xDn
    table.cell(table_id = Table, column = 0, row = 2, text = "RESISTENCE : ", bgcolor = color.green)
    table.cell(table_id = Table, column = 1, row = 2, text = tostring(close/0.9618), bgcolor = color.yellow)



if xDn and close>open
    x = label.new(bar_index, na)
    label.set_text(x, "RSI / Buy Alert")
    label.set_color(x, color.green)
    label.set_yloc(x, yloc.belowbar)
    label.set_style(x, label.style_label_up)
    //label.set_size(x, size.large ) 
else if cBUY and low<=lower and close>low
    t = label.new(bar_index, na)
    //label.set_text(t, "CCI -200")
    label.set_color(t, color.green)
    label.set_yloc(t, yloc.belowbar)
    label.set_style(t, label.style_triangleup) 
    label.set_size(t, size.small )
else if cDn and low<=lower
    j = label.new(bar_index, na)
    //label.set_text(j, tostring(low))
    label.set_color(j, color.green)
    label.set_yloc(j, yloc.belowbar)
    label.set_style(j, label.style_triangleup)
    label.set_size(j, size.small )    


if xUp
    l = label.new(bar_index, na)
    label.set_text(l, "Sell Alert")
    label.set_color(l, color.red)
    label.set_yloc(l, yloc.abovebar)
    label.set_style(l, label.style_label_lower_left)
    label.set_size(l, size.small)
else if cUp //and high>upper
    l = label.new(bar_index, na)
    //label.set_text(l, tostring(high))
    label.set_color(l, color.red)
    label.set_yloc(l, yloc.abovebar)
    label.set_style(l, label.style_triangledown)
    label.set_size(l, size.small )
else if c200 //and high>upper
    l = label.new(bar_index, na)
    //label.set_text(l, "Sell Alert")
    label.set_color(l, color.red)
    label.set_yloc(l, yloc.abovebar)
    label.set_style(l, label.style_triangledown)
    label.set_size(l, size.small)



   
if xUltra //and high>upper
    l = label.new(bar_index, na)
    label.set_text(l, "RSI > 75")
    label.set_color(l, color.red)
    label.set_yloc(l, yloc.abovebar)
    label.set_style(l, label.style_label_down)
    label.set_size(l, size.normal )
    table.cell(table_id = Table, column = 0, row = 0, text = "SELL ALERT" )
    table.cell_set_bgcolor(table_id = Table, column = 0, row = 0, bgcolor = color.red)
    

if eSellStrong and close<open
    l = label.new(bar_index, na)
    label.set_text(l, "SHORT")
    label.set_color(l, color.red)
    label.set_yloc(l, yloc.abovebar)
    label.set_style(l, label.style_label_down)
    table.cell(table_id = Table, column = 1, row = 0, text = "SHORT Alert M200")
    table.cell_set_bgcolor(table_id = Table, column = 1, row = 0, bgcolor = color.red)
else if eSHORT and open>lower and close<middle
    l = label.new(bar_index, na)
    label.set_text(l, "Wait to buy")
    label.set_color(l, color.white)
    label.set_yloc(l, yloc.abovebar)
    label.set_style(l, label.style_label_down	)
    //label.set_size(l, size.tiny )
    //label.set_size(l, size.small) 
    table.cell(table_id = Table, column = 0, row = 0, text = "SHORT POSITION = " )
    table.cell_set_bgcolor(table_id = Table, column = 0, row = 0, bgcolor = color.red)
else if eSHORTLow and close<open and close<e50 and close<middle
    l = label.new(bar_index, na)
    label.set_text(l, "Low SHORT")
    label.set_color(l, color.red)
    label.set_yloc(l, yloc.abovebar)
    label.set_style(l, label.style_label_down)
    label.set_size(l, size.small) 
    table.cell(table_id = Table, column = 0, row = 0, text = "WAIT POSITION...")
    table.cell_set_bgcolor(table_id = Table, column = 0, row = 0, bgcolor = color.white)
else if eUp
    l = label.new(bar_index, na)
    label.set_text(l, "W A I T")
    label.set_color(l, color.white)
    label.set_yloc(l, yloc.abovebar)
    label.set_style(l, label.style_label_lower_left)
    label.set_size(l, size.tiny )
    //table.cell(table_id = Table, column = 1, row = 2, text = "WAIT..." )
    //table.cell_set_bgcolor(table_id = Table, column = 1, row = 2, bgcolor = color.white)  


if eGOOD and close>e50 and close>open and close>middle
    x = label.new(bar_index, na)
    label.set_text(x, "LONG")
    label.set_color(x, color.green)
    label.set_yloc(x, yloc.belowbar)
    label.set_style(x, label.style_label_up)
    label.set_size(x, size.small) 
    table.cell(table_id = Table, column = 0, row = 0, text = "LONG POSITION ")
    table.cell_set_bgcolor(table_id = Table, column = 0, row = 0, bgcolor = color.green)

    

if eGOOD and (e50 >e200) and open>middle and close>open
    l = label.new(bar_index, na)
    label.set_text(l, "Wait\nto sell")
    label.set_color(l, color.green)
    label.set_yloc(l, yloc.abovebar)
    label.set_style(l, label.style_label_down) 
    label.set_size(l, size.small )
    table.cell(table_id = Table, column = 1, row = 0, text = "WAIT to sell..." )
    table.cell_set_bgcolor(table_id = Table, column = 1, row = 0, bgcolor = color.green)
else if cUltra //and close>open
    l = label.new(bar_index, na)
    label.set_text(l, "CCI>200")
    label.set_color(l, color.red)
    label.set_yloc(l, yloc.abovebar)
    label.set_style(l, label.style_label_down)
    label.set_size(l, size.small)
    table.cell(table_id = Table, column = 1, row = 0, text = "SELL Alert !" )
    table.cell_set_bgcolor(table_id = Table, column = 1, row = 0, bgcolor = color.red)
else if xUltra //and close>upper
    l = label.new(bar_index, na)
    label.set_text(l, "SELL ALERT")
    label.set_color(l, color.red)
    label.set_yloc(l, yloc.abovebar)
    label.set_style(l, label.style_label_down)
    label.set_size(l, size.normal )
    table.cell(table_id = Table, column = 1, row = 0, text = "SELL ALERT" )
    table.cell_set_bgcolor(table_id = Table, column = 1, row = 0, bgcolor = color.red)

if eSell
    //l = label.new(bar_index, na)
    //label.set_text(l, "Wait")
    //label.set_color(l, color.white)
    //label.set_yloc(l, yloc.abovebar)
    //label.set_style(l, label.style_label_down) 
    table.cell(table_id = Table, column = 1, row = 0, text = "WAIT" )
    table.cell_set_bgcolor(table_id = Table, column = 1, row = 0, bgcolor = color.white)
    //label.set_size(l, size.small)

