Crypto Society EMAs
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © hakanar

//@version=5
indicator("Crypto Society EMAs",shorttitle="Crypto Society EMAs", overlay=true, max_bars_back=5000, max_labels_count=500)

InputEma1 = input.int(9, "Ema 1", minval=1, maxval=5000)
InputEma2 = input.int(34, "Ema 2", minval=1, maxval=5000)
InputEma3 = input.int(50, "Ema 3", minval=1, maxval=5000)
InputEma4 = input.int(100, "Ema 4", minval=1, maxval=5000)
InputEma5 = input.int(200, "Ema 5", minval=1, maxval=5000)

Ema1 = ta.vwma(close, InputEma1)
Ema2 = ta.vwma(close, InputEma2)
Ema3 = ta.vwma(close, InputEma3)
Ema4 = ta.vwma(close, InputEma4)
Ema5 = ta.vwma(close, InputEma5)

plot(Ema1, title="Ema1", color=color.new(color.red, 30))
plot(Ema2, title="Ema2", color=color.new(color.blue, 30))
plot(Ema3, title="Ema3", color=color.new(color.green, 30))
plot(Ema4, title="Ema4", color=color.new(color.olive, 30))
plot(Ema5, title="Ema5", color=color.new(color.gray, 30))

ema1_min1 = request.security(syminfo.tickerid, "1", ta.vwma(close, InputEma1))
ema2_min1 = request.security(syminfo.tickerid, "1", ta.vwma(close, InputEma2))
ema3_min1 = request.security(syminfo.tickerid, "1", ta.vwma(close, InputEma3))
ema4_min1 = request.security(syminfo.tickerid, "1", ta.vwma(close, InputEma4))
ema5_min1 = request.security(syminfo.tickerid, "1", ta.vwma(close, InputEma5))

if ta.crossover(ema1_min1[1], ema3_min1[1])
    lbl = label.new(bar_index, na)
    label.set_text( lbl, "1m\n" + str.tostring(InputEma3))
    label.set_color(lbl, color.new(color.green, 30))
    label.set_yloc( lbl, yloc.belowbar)
    label.set_style(lbl, label.style_label_up)
    
if ta.crossover(ema1_min1[1], ema4_min1[1])
    lbl = label.new(bar_index, na)
    label.set_text( lbl, "1m\n" + str.tostring(InputEma4))
    label.set_color(lbl, color.new(color.green, 30))
    label.set_yloc( lbl, yloc.belowbar)
    label.set_style(lbl, label.style_label_up)
    
if ta.crossover(ema1_min1[1], ema5_min1[1])
    lbl = label.new(bar_index, na)
    label.set_text( lbl, "1m\n" + str.tostring(InputEma5))
    label.set_color(lbl, color.new(color.green, 30))
    label.set_yloc( lbl, yloc.belowbar)
    label.set_style(lbl, label.style_label_up)
    
if ta.crossunder(ema1_min1[1], ema3_min1[1])
    lbl = label.new(bar_index, na)
    label.set_text( lbl, "1m\n" + str.tostring(InputEma3))
    label.set_color(lbl, color.new(color.red, 30))
    label.set_yloc( lbl, yloc.abovebar)
    label.set_style(lbl, label.style_label_down)
    
if ta.crossunder(ema1_min1[1], ema4_min1[1])
    lbl = label.new(bar_index, na)
    label.set_text( lbl, "1m\n" + str.tostring(InputEma4))
    label.set_color(lbl, color.new(color.red, 30))
    label.set_yloc( lbl, yloc.abovebar)
    label.set_style(lbl, label.style_label_down)
    
if ta.crossunder(ema1_min1[1], ema5_min1[1])
    lbl = label.new(bar_index, na)
    label.set_text( lbl, "1m\n" + str.tostring(InputEma5))
    label.set_color(lbl, color.new(color.red, 30))
    label.set_yloc( lbl, yloc.abovebar)
    label.set_style(lbl, label.style_label_down)

ema1_min3 = request.security(syminfo.tickerid, "3", ta.vwma(close, InputEma1))
ema2_min3 = request.security(syminfo.tickerid, "3", ta.vwma(close, InputEma2))
ema3_min3 = request.security(syminfo.tickerid, "3", ta.vwma(close, InputEma3))
ema4_min3 = request.security(syminfo.tickerid, "3", ta.vwma(close, InputEma4))
ema5_min3 = request.security(syminfo.tickerid, "3", ta.vwma(close, InputEma5))

if ta.crossover(ema1_min3[1], ema3_min3[1])
    lbl = label.new(bar_index, na)
    label.set_text( lbl, "3m\n" + str.tostring(InputEma3))
    label.set_color(lbl, color.new(color.green, 30))
    label.set_yloc( lbl, yloc.belowbar)
    label.set_style(lbl, label.style_label_up)
    
if ta.crossover(ema1_min3[1], ema4_min3[1])
    lbl = label.new(bar_index, na)
    label.set_text( lbl, "3m\n" + str.tostring(InputEma4))
    label.set_color(lbl, color.new(color.green, 30))
    label.set_yloc( lbl, yloc.belowbar)
    label.set_style(lbl, label.style_label_up)
    
if ta.crossover(ema1_min3[1], ema5_min3[1])
    lbl = label.new(bar_index, na)
    label.set_text( lbl, "3m\n" + str.tostring(InputEma5))
    label.set_color(lbl, color.new(color.green, 30))
    label.set_yloc( lbl, yloc.belowbar)
    label.set_style(lbl, label.style_label_up)
    
if ta.crossunder(ema1_min3[1], ema3_min3[1])
    lbl = label.new(bar_index, na)
    label.set_text( lbl, "3m\n" + str.tostring(InputEma3))
    label.set_color(lbl, color.new(color.red, 30))
    label.set_yloc( lbl, yloc.abovebar)
    label.set_style(lbl, label.style_label_down)
    
if ta.crossunder(ema1_min3[1], ema4_min3[1])
    lbl = label.new(bar_index, na)
    label.set_text( lbl, "3m\n" + str.tostring(InputEma4))
    label.set_color(lbl, color.new(color.red, 30))
    label.set_yloc( lbl, yloc.abovebar)
    label.set_style(lbl, label.style_label_down)
    
if ta.crossunder(ema1_min3[1], ema5_min3[1])
    lbl = label.new(bar_index, na)
    label.set_text( lbl, "3m\n" + str.tostring(InputEma5))
    label.set_color(lbl, color.new(color.red, 30))
    label.set_yloc( lbl, yloc.abovebar)
    label.set_style(lbl, label.style_label_down)

ema1_min5 = request.security(syminfo.tickerid, "5", ta.vwma(close, InputEma1))
ema2_min5 = request.security(syminfo.tickerid, "5", ta.vwma(close, InputEma2))
ema3_min5 = request.security(syminfo.tickerid, "5", ta.vwma(close, InputEma3))
ema4_min5 = request.security(syminfo.tickerid, "5", ta.vwma(close, InputEma4))
ema5_min5 = request.security(syminfo.tickerid, "5", ta.vwma(close, InputEma5))

if ta.crossover(ema1_min5[1], ema3_min5[1])
    lbl = label.new(bar_index, na)
    label.set_text( lbl, "5m\n" + str.tostring(InputEma3))
    label.set_color(lbl, color.new(color.green, 30))
    label.set_yloc( lbl, yloc.belowbar)
    label.set_style(lbl, label.style_label_up)
    
if ta.crossover(ema1_min5[1], ema4_min5[1])
    lbl = label.new(bar_index, na)
    label.set_text( lbl, "5m\n" + str.tostring(InputEma4))
    label.set_color(lbl, color.new(color.green, 30))
    label.set_yloc( lbl, yloc.belowbar)
    label.set_style(lbl, label.style_label_up)
    
if ta.crossover(ema1_min5[1], ema5_min5[1])
    lbl = label.new(bar_index, na)
    label.set_text( lbl, "5m\n" + str.tostring(InputEma5))
    label.set_color(lbl, color.new(color.green, 30))
    label.set_yloc( lbl, yloc.belowbar)
    label.set_style(lbl, label.style_label_up)
    
if ta.crossunder(ema1_min5[1], ema3_min5[1])
    lbl = label.new(bar_index, na)
    label.set_text( lbl, "5m\n" + str.tostring(InputEma3))
    label.set_color(lbl, color.new(color.red, 30))
    label.set_yloc( lbl, yloc.abovebar)
    label.set_style(lbl, label.style_label_down)
    
if ta.crossunder(ema1_min5[1], ema4_min5[1])
    lbl = label.new(bar_index, na)
    label.set_text( lbl, "5m\n" + str.tostring(InputEma4))
    label.set_color(lbl, color.new(color.red, 30))
    label.set_yloc( lbl, yloc.abovebar)
    label.set_style(lbl, label.style_label_down)
    
if ta.crossunder(ema1_min5[1], ema5_min5[1])
    lbl = label.new(bar_index, na)
    label.set_text( lbl, "5m\n" + str.tostring(InputEma5))
    label.set_color(lbl, color.new(color.red, 30))
    label.set_yloc( lbl, yloc.abovebar)
    label.set_style(lbl, label.style_label_down)

ema1_min10 = request.security(syminfo.tickerid, "10", ta.vwma(close, InputEma1))
ema2_min10 = request.security(syminfo.tickerid, "10", ta.vwma(close, InputEma2))
ema3_min10 = request.security(syminfo.tickerid, "10", ta.vwma(close, InputEma3))
ema4_min10 = request.security(syminfo.tickerid, "10", ta.vwma(close, InputEma4))
ema5_min10 = request.security(syminfo.tickerid, "10", ta.vwma(close, InputEma5))


if ta.crossover(ema1_min10[1], ema3_min10[1])
    lbl = label.new(bar_index, na)
    label.set_text( lbl, "10m\n" + str.tostring(InputEma3))
    label.set_color(lbl, color.new(color.green, 30))
    label.set_yloc( lbl, yloc.belowbar)
    label.set_style(lbl, label.style_label_up)
    
if ta.crossover(ema1_min10[1], ema4_min10[1])
    lbl = label.new(bar_index, na)
    label.set_text( lbl, "10m\n" + str.tostring(InputEma4))
    label.set_color(lbl, color.new(color.green, 30))
    label.set_yloc( lbl, yloc.belowbar)
    label.set_style(lbl, label.style_label_up)
    
if ta.crossover(ema1_min10[1], ema5_min10[1])
    lbl = label.new(bar_index, na)
    label.set_text( lbl, "10m\n" + str.tostring(InputEma5))
    label.set_color(lbl, color.new(color.green, 30))
    label.set_yloc( lbl, yloc.belowbar)
    label.set_style(lbl, label.style_label_up)
    
if ta.crossunder(ema1_min10[1], ema3_min10[1])
    lbl = label.new(bar_index, na)
    label.set_text( lbl, "10m\n" + str.tostring(InputEma3))
    label.set_color(lbl, color.new(color.red, 30))
    label.set_yloc( lbl, yloc.abovebar)
    label.set_style(lbl, label.style_label_down)
    
if ta.crossunder(ema1_min10[1], ema4_min10[1])
    lbl = label.new(bar_index, na)
    label.set_text( lbl, "10m\n" + str.tostring(InputEma4))
    label.set_color(lbl, color.new(color.red, 30))
    label.set_yloc( lbl, yloc.abovebar)
    label.set_style(lbl, label.style_label_down)
    
if ta.crossunder(ema1_min10[1], ema5_min10[1])
    lbl = label.new(bar_index, na)
    label.set_text( lbl, "10m\n" + str.tostring(InputEma5))
    label.set_color(lbl, color.new(color.red, 30))
    label.set_yloc( lbl, yloc.abovebar)
    label.set_style(lbl, label.style_label_down)

ema1_min15 = request.security(syminfo.tickerid, "15", ta.vwma(close, InputEma1))
ema2_min15 = request.security(syminfo.tickerid, "15", ta.vwma(close, InputEma2))
ema3_min15 = request.security(syminfo.tickerid, "15", ta.vwma(close, InputEma3))
ema4_min15 = request.security(syminfo.tickerid, "15", ta.vwma(close, InputEma4))
ema5_min15 = request.security(syminfo.tickerid, "15", ta.vwma(close, InputEma5))

if ta.crossover(ema1_min15[1], ema3_min15[1])
    lbl = label.new(bar_index, na)
    label.set_text( lbl, "15m\n" + str.tostring(InputEma3))
    label.set_color(lbl, color.new(color.green, 30))
    label.set_yloc( lbl, yloc.belowbar)
    label.set_style(lbl, label.style_label_up)
    
if ta.crossover(ema1_min15[1], ema4_min15[1])
    lbl = label.new(bar_index, na)
    label.set_text( lbl, "15m\n" + str.tostring(InputEma4))
    label.set_color(lbl, color.new(color.green, 30))
    label.set_yloc( lbl, yloc.belowbar)
    label.set_style(lbl, label.style_label_up)
    
if ta.crossover(ema1_min15[1], ema5_min15[1])
    lbl = label.new(bar_index, na)
    label.set_text( lbl, "15m\n" + str.tostring(InputEma5))
    label.set_color(lbl, color.new(color.green, 30))
    label.set_yloc( lbl, yloc.belowbar)
    label.set_style(lbl, label.style_label_up)
    
if ta.crossunder(ema1_min15[1], ema3_min15[1])
    lbl = label.new(bar_index, na)
    label.set_text( lbl, "15m\n" + str.tostring(InputEma3))
    label.set_color(lbl, color.new(color.red, 30))
    label.set_yloc( lbl, yloc.abovebar)
    label.set_style(lbl, label.style_label_down)
    
if ta.crossunder(ema1_min15[1], ema4_min15[1])
    lbl = label.new(bar_index, na)
    label.set_text( lbl, "15m\n" + str.tostring(InputEma4))
    label.set_color(lbl, color.new(color.red, 30))
    label.set_yloc( lbl, yloc.abovebar)
    label.set_style(lbl, label.style_label_down)
    
if ta.crossunder(ema1_min15[1], ema5_min15[1])
    lbl = label.new(bar_index, na)
    label.set_text( lbl, "15m\n" + str.tostring(InputEma5))
    label.set_color(lbl, color.new(color.red, 30))
    label.set_yloc( lbl, yloc.abovebar)
    label.set_style(lbl, label.style_label_down)

ema1_min30 = request.security(syminfo.tickerid, "30", ta.vwma(close, InputEma1))
ema2_min30 = request.security(syminfo.tickerid, "30", ta.vwma(close, InputEma2))
ema3_min30 = request.security(syminfo.tickerid, "30", ta.vwma(close, InputEma3))
ema4_min30 = request.security(syminfo.tickerid, "30", ta.vwma(close, InputEma4))
ema5_min30 = request.security(syminfo.tickerid, "30", ta.vwma(close, InputEma5))

if ta.crossover(ema1_min30[1], ema3_min30[1])
    lbl = label.new(bar_index, na)
    label.set_text( lbl, "30m\n" + str.tostring(InputEma3))
    label.set_color(lbl, color.new(color.green, 30))
    label.set_yloc( lbl, yloc.belowbar)
    label.set_style(lbl, label.style_label_up)
    
if ta.crossover(ema1_min30[1], ema4_min30[1])
    lbl = label.new(bar_index, na)
    label.set_text( lbl, "30m\n" + str.tostring(InputEma4))
    label.set_color(lbl, color.new(color.green, 30))
    label.set_yloc( lbl, yloc.belowbar)
    label.set_style(lbl, label.style_label_up)
    
if ta.crossover(ema1_min30[1], ema5_min30[1])
    lbl = label.new(bar_index, na)
    label.set_text( lbl, "30m\n" + str.tostring(InputEma5))
    label.set_color(lbl, color.new(color.green, 30))
    label.set_yloc( lbl, yloc.belowbar)
    label.set_style(lbl, label.style_label_up)
    
if ta.crossunder(ema1_min30[1], ema3_min30[1])
    lbl = label.new(bar_index, na)
    label.set_text( lbl, "30m\n" + str.tostring(InputEma3))
    label.set_color(lbl, color.new(color.red, 30))
    label.set_yloc( lbl, yloc.abovebar)
    label.set_style(lbl, label.style_label_down)
    
if ta.crossunder(ema1_min30[1], ema4_min30[1])
    lbl = label.new(bar_index, na)
    label.set_text( lbl, "30m\n" + str.tostring(InputEma4))
    label.set_color(lbl, color.new(color.red, 30))
    label.set_yloc( lbl, yloc.abovebar)
    label.set_style(lbl, label.style_label_down)
    
if ta.crossunder(ema1_min30[1], ema5_min30[1])
    lbl = label.new(bar_index, na)
    label.set_text( lbl, "30m\n" + str.tostring(InputEma5))
    label.set_color(lbl, color.new(color.red, 30))
    label.set_yloc( lbl, yloc.abovebar)
    label.set_style(lbl, label.style_label_down)

ema1_min1H = request.security(syminfo.tickerid, "60", ta.vwma(close, InputEma1))
ema2_min1H = request.security(syminfo.tickerid, "60", ta.vwma(close, InputEma2))
ema3_min1H = request.security(syminfo.tickerid, "60", ta.vwma(close, InputEma3))
ema4_min1H = request.security(syminfo.tickerid, "60", ta.vwma(close, InputEma4))
ema5_min1H = request.security(syminfo.tickerid, "60", ta.vwma(close, InputEma5))

if ta.crossover(ema1_min1H[1], ema3_min1H[1])
    lbl = label.new(bar_index, na)
    label.set_text( lbl, "1H\n" + str.tostring(InputEma3))
    label.set_color(lbl, color.new(color.green, 30))
    label.set_yloc( lbl, yloc.belowbar)
    label.set_style(lbl, label.style_label_up)
    
if ta.crossover(ema1_min1H[1], ema4_min1H[1])
    lbl = label.new(bar_index, na)
    label.set_text( lbl, "1H\n" + str.tostring(InputEma4))
    label.set_color(lbl, color.new(color.green, 30))
    label.set_yloc( lbl, yloc.belowbar)
    label.set_style(lbl, label.style_label_up)
    
if ta.crossover(ema1_min1H[1], ema5_min1H[1])
    lbl = label.new(bar_index, na)
    label.set_text( lbl, "1H\n" + str.tostring(InputEma5))
    label.set_color(lbl, color.new(color.green, 30))
    label.set_yloc( lbl, yloc.belowbar)
    label.set_style(lbl, label.style_label_up)
    
if ta.crossunder(ema1_min1H[1], ema3_min1H[1])
    lbl = label.new(bar_index, na)
    label.set_text( lbl, "1H\n" + str.tostring(InputEma3))
    label.set_color(lbl, color.new(color.red, 30))
    label.set_yloc( lbl, yloc.abovebar)
    label.set_style(lbl, label.style_label_down)
    
if ta.crossunder(ema1_min1H[1], ema4_min1H[1])
    lbl = label.new(bar_index, na)
    label.set_text( lbl, "1H\n" + str.tostring(InputEma4))
    label.set_color(lbl, color.new(color.red, 30))
    label.set_yloc( lbl, yloc.abovebar)
    label.set_style(lbl, label.style_label_down)
    
if ta.crossunder(ema1_min1H[1], ema5_min1H[1])
    lbl = label.new(bar_index, na)
    label.set_text( lbl, "1H\n" + str.tostring(InputEma5))
    label.set_color(lbl, color.new(color.red, 30))
    label.set_yloc( lbl, yloc.abovebar)
    label.set_style(lbl, label.style_label_down)

ema1_min4H = request.security(syminfo.tickerid, "240", ta.vwma(close, InputEma1))
ema2_min4H = request.security(syminfo.tickerid, "240", ta.vwma(close, InputEma2))
ema3_min4H = request.security(syminfo.tickerid, "240", ta.vwma(close, InputEma3))
ema4_min4H = request.security(syminfo.tickerid, "240", ta.vwma(close, InputEma4))
ema5_min4H = request.security(syminfo.tickerid, "240", ta.vwma(close, InputEma5))

if ta.crossover(ema1_min4H[1], ema3_min4H[1])
    lbl = label.new(bar_index, na)
    label.set_text( lbl, "4H\n" + str.tostring(InputEma3))
    label.set_color(lbl, color.new(color.green, 30))
    label.set_yloc( lbl, yloc.belowbar)
    label.set_style(lbl, label.style_label_up)
    
if ta.crossover(ema1_min4H[1], ema4_min4H[1])
    lbl = label.new(bar_index, na)
    label.set_text( lbl, "4H\n" + str.tostring(InputEma4))
    label.set_color(lbl, color.new(color.green, 30))
    label.set_yloc( lbl, yloc.belowbar)
    label.set_style(lbl, label.style_label_up)
    
if ta.crossover(ema1_min4H[1], ema5_min4H[1])
    lbl = label.new(bar_index, na)
    label.set_text( lbl, "4H\n" + str.tostring(InputEma5))
    label.set_color(lbl, color.new(color.green, 30))
    label.set_yloc( lbl, yloc.belowbar)
    label.set_style(lbl, label.style_label_up)
    
if ta.crossunder(ema1_min4H[1], ema3_min4H[1])
    lbl = label.new(bar_index, na)
    label.set_text( lbl, "4H\n" + str.tostring(InputEma3))
    label.set_color(lbl, color.new(color.red, 30))
    label.set_yloc( lbl, yloc.abovebar)
    label.set_style(lbl, label.style_label_down)
    
if ta.crossunder(ema1_min4H[1], ema4_min4H[1])
    lbl = label.new(bar_index, na)
    label.set_text( lbl, "4H\n" + str.tostring(InputEma4))
    label.set_color(lbl, color.new(color.red, 30))
    label.set_yloc( lbl, yloc.abovebar)
    label.set_style(lbl, label.style_label_down)
    
if ta.crossunder(ema1_min4H[1], ema5_min4H[1])
    lbl = label.new(bar_index, na)
    label.set_text( lbl, "4H\n" + str.tostring(InputEma5))
    label.set_color(lbl, color.new(color.red, 30))
    label.set_yloc( lbl, yloc.abovebar)
    label.set_style(lbl, label.style_label_down)

ema1_min1D = request.security(syminfo.tickerid, "1D", ta.vwma(close, InputEma1))
ema2_min1D = request.security(syminfo.tickerid, "1D", ta.vwma(close, InputEma2))
ema3_min1D = request.security(syminfo.tickerid, "1D", ta.vwma(close, InputEma3))
ema4_min1D = request.security(syminfo.tickerid, "1D", ta.vwma(close, InputEma4))
ema5_min1D = request.security(syminfo.tickerid, "1D", ta.vwma(close, InputEma5))

if ta.crossover(ema1_min1D[1], ema3_min1D[1])
    lbl = label.new(bar_index, na)
    label.set_text( lbl, "1D\n" + str.tostring(InputEma3))
    label.set_color(lbl, color.new(color.green, 30))
    label.set_yloc( lbl, yloc.belowbar)
    label.set_style(lbl, label.style_label_up)
    
if ta.crossover(ema1_min1D[1], ema4_min1D[1])
    lbl = label.new(bar_index, na)
    label.set_text( lbl, "1D\n" + str.tostring(InputEma4))
    label.set_color(lbl, color.new(color.green, 30))
    label.set_yloc( lbl, yloc.belowbar)
    label.set_style(lbl, label.style_label_up)
    
if ta.crossover(ema1_min1D[1], ema5_min1D[1])
    lbl = label.new(bar_index, na)
    label.set_text( lbl, "1D\n" + str.tostring(InputEma5))
    label.set_color(lbl, color.new(color.green, 30))
    label.set_yloc( lbl, yloc.belowbar)
    label.set_style(lbl, label.style_label_up)
    
if ta.crossunder(ema1_min1D[1], ema3_min1D[1])
    lbl = label.new(bar_index, na)
    label.set_text( lbl, "1D\n" + str.tostring(InputEma3))
    label.set_color(lbl, color.new(color.red, 30))
    label.set_yloc( lbl, yloc.abovebar)
    label.set_style(lbl, label.style_label_down)
    
if ta.crossunder(ema1_min1D[1], ema4_min1D[1])
    lbl = label.new(bar_index, na)
    label.set_text( lbl, "1D\n" + str.tostring(InputEma4))
    label.set_color(lbl, color.new(color.red, 30))
    label.set_yloc( lbl, yloc.abovebar)
    label.set_style(lbl, label.style_label_down)
    
if ta.crossunder(ema1_min1D[1], ema5_min1D[1])
    lbl = label.new(bar_index, na)
    label.set_text( lbl, "1D\n" + str.tostring(InputEma5))
    label.set_color(lbl, color.new(color.red, 30))
    label.set_yloc( lbl, yloc.abovebar)
    label.set_style(lbl, label.style_label_down)