The code you quoted includes inputs, that you can change to whatever you like.
Code:
input fastLength = 12;
input slowLength = 26;
input MACDLength = 9;
This is the code I tried, I couldn't find the divergence of maximum and minimum points
# Divergence Pivots
# Mobius
# V03.05.2015 Upper Study
input n = 7;
input fastLength = 5;
input slowLength = 34;
#input MACDLength = 0;
input averageType = AverageType.SIMPLE;
def h = high;
def l = low;
def bar = barNumber();
def Diff = (Average(CLOSE, fastLength) - Average(CLOSE, slowLength));
def CurrMACDh = if Diff > 0
then fold i = 1 to n + 1
with p = 1
while p
do Diff > getValue(Diff, -i)
else 0;
def CurrMACDPivotH = if (bar > n and
Diff == highest(Diff, n) and
CurrMACDh)
then h
else double.NaN;
def CurrMACDl = if Diff < 0
then fold j = 1 to n + 1
with q = 1
while q
do Diff < getValue(Diff, -j)
else 0;
def CurrMACDPivotL = if (bar > n and
Diff == lowest(Diff, n) and
CurrMACDl)
then l
else double.NaN;
def CurrPHBar = if !isNaN(CurrMACDPivotH)
then bar
else CurrPHBar[1];
def CurrPLBar = if !isNaN(CurrMACDPivotL)
then bar
else CurrPLBar[1];
def PHpoint = if !isNaN(CurrMACDPivotH)
then CurrMACDPivotH
else PHpoint[1];
def priorPHBar = if PHpoint != PHpoint[1]
then CurrPHBar[1]
else priorPHBar[1];
def PLpoint = if !isNaN(CurrMACDPivotL)
then CurrMACDPivotL
else PLpoint[1];
def priorPLBar = if PLpoint != PLpoint[1]
then CurrPLBar[1]
else priorPLBar[1];
def HighPivots = bar >= highestAll(priorPHBar);
def LowPivots = bar >= highestAll(priorPLBar);
def pivotHigh = if HighPivots
then CurrMACDPivotH
else double.NaN;
plot PlotHline = pivotHigh;
PlotHline.enableApproximation();
PlotHline.SetDefaultColor(GetColor(7));
PlotHline.SetStyle(Curve.Short_DASH);
plot pivotLow = if LowPivots
then CurrMACDPivotL
else double.NaN;
pivotLow.enableApproximation();
pivotLow.SetDefaultColor(GetColor(7));
pivotLow.SetStyle(Curve.Short_DASH);
plot PivotDot = if !isNaN(pivotHigh)
then pivotHigh
else if !isNaN(pivotLow)
then pivotLow
else double.NaN;
pivotDot.SetDefaultColor(GetColor(7));
pivotDot.SetPaintingStrategy(PaintingStrategy.POINTS);
pivotDot.SetLineWeight(3);
# End Code Pivots with Projections