exponential movil average with points 
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Adan1560
//@version=5
indicator('exponential movil average with points ', overlay=true)

// Definir inputs para las EMAs
ema1_length = input(title='EMA1 Periodos', defval=20)
ema2_length = input(title='EMA2 Periodos', defval=50)

// Definir medias móviles exponenciales
ema1 = ta.ema(close, ema1_length)
ema2 = ta.ema(close, ema2_length)

// Dibujar medias móviles
plot(ema1, color=color.new(color.orange, 0), title='EMA1')
plot(ema2, color=color.new(color.blue, 0), title='EMA2')

// Comprobar si la EMA1 es mayor que la EMA2
signal = ema1 > ema2

// Comprobar si la EMA1 ha disminuido en el último periodo
ema1_decreasing = ema1 < ema1[1]

// Dibujar señales
plotshape(signal and not ema1_decreasing, color=color.new(color.green, 0), location=location.belowbar, style=shape.triangleup, title='Señal de Compra')
plotshape(not signal and ema1_decreasing, color=color.new(color.red, 0), location=location.abovebar, style=shape.triangledown, title='Señal de Venta')

