#// Indicator for TOS
# //Alex Orekhov (everget)
#study("Kurtosis Indicator", shorttitle="Kurtosis")
# Converted by Sam4Cok@Samer800 - 03/2025
Declare lower;
input source = close; # "Source"
input momentumLength = 3; # "Momentum Length"
input fastMovAvgType = AverageType.EXPONENTIAL;
input fastLength = 66; # "Fast Length"
input fastSlowMaType = AverageType.SIMPLE;
input fastSlowLength = 3; # "Fast/Slow Length"
def na = Double.NaN;
def last = IsNaN(close);
#// Kurtosis
def chang = source - source[momentumLength];
def K = chang - chang[1];
#// Fast Kurtosis
def FK = MovingAverage(fastMovAvgType, K, fastLength);
#// Fast / Slow Kurtosis
def FSK = MovingAverage(fastSlowMaType, FK, fastSlowLength);
#---plots
plot Fast = if !last then FK else na; # "Fast"
plot FastSlow = if !last then FSK else na; # "Fast / Slow",
plot zero = if !last then 0 else na;
Fast.SetLineWeight(2);
FastSlow.SetLineWeight(2);
zero.SetPaintingStrategy(PaintingStrategy.DASHES);
Fast.SetDefaultColor(Color.CYAN);
FastSlow.SetDefaultColor(Color.MAGENTA);
zero.SetDefaultColor(Color.GRAY);
#-- END of CODE