Input Neutral = 50;
input KPeriod = 5;
input DPeriod = 3;
input priceH = high;
input priceL = low;
input priceC = close;
input slowing_period = 2;
input averageType = AverageType.SIMPLE;
input showBreakoutSignals = {default "No", "On FullK", "On FullD", "On FullK & FullD"};
def lowest_k = Lowest(priceL, KPeriod);
def c1 = priceC - lowest_k;
def c2 = Highest(priceH, KPeriod) - lowest_k;
def FastK = if c2 != 0 then c1 / c2 * 100 else 0;
Def isNeutral = Neutral > 40 and Neutral < 60;
def FullK = MovingAverage(averageType, FastK, slowing_period);
def FullD = MovingAverage(averageType, FullK, DPeriod);
def data = (if FullD crosses above Neutral then 1 else 0);
def data2 = (if FullD crosses below Neutral then 1 else 0);
###
plot xdata = if data[1] == 0 and data then (Lowest(low[1], 7)) else Double.NaN;
xdata.SetPaintingStrategy(PaintingStrategy.POINTS);
xdata.SetLineWeight(5);
plot xdata2 = if data[1] == 0 and data2 then (Highest(high[1], 7)) else Double.NaN;
xdata2.SetPaintingStrategy(PaintingStrategy.POINTS);
xdata2.SetLineWeight(5);
#------------------------------------------------
# change high to highest high and low to lowest low
def sh = if !IsNaN(xdata2) then highest(priceh[1], 5) else Double.NaN;
def sl = if !IsNaN(xdata) then lowest(priceL[1], 5) else Double.NaN;
input showhilowline = yes;
plot hilowline = if showhilowline == no then Double.NaN else if data2 == 1 then sh else sl;
hilowline.EnableApproximation();
hilowline.SetDefaultColor(Color.BLACK);
hilowline.HideBubble();