EMA Angle Trend Strength
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © undisputed140188
//@version=5
indicator("EMA Angle Trend Strength", "EATS", overlay = false)

emaLength = input(10, "EMA Length", "Number of candles for EMA")
eatsLength = input.int(3, "Precision", minval = 1, tooltip =  "How many candles for angle calculation")

ema = ta.ema(close, emaLength)
emaSlope(int x2) =>
    emaSlope = math.abs(math.atan((ema[0] - ema[x2]) / -x2) * 180.0 / math.pi)
eats(float slope) =>
    eats = (math.abs(slope) / 90) *100
sig = eats(emaSlope(eatsLength))
plot(sig, "EATS")
