#// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
#// © Peter_O
#// + huge parts of code by Lonesometheblue and Everget's built-in divergence indicator
#study("Multiple divergences rework NON-REPAINT by PeterO", overlay=true)
# Converted by Sam4Cok@Samer800 - 05/2024
input Repaint = no; #, "Repaint or not?")
input MinimumDivCountToDisplay = 2; #, minval=1, maxval=10, title="Minimum Div Count to Display")
input PivotLookbackRight = 1; #(title="Pivot Lookback Right", defval=1)
input PivotLookbackLeft = 5; #(title="Pivot Lookback Left", defval=3)
input MaxLookbackRange = 60; #(title="Max of Lookback Range", defval=60)
input MinLookbackRange = 5; #(title="Min of Lookback Range", defval=1)
input showRegularBullishDiv = yes; #(title="Plot Bullish", defval=true)
input showRegularBearishDiv = yes; #((title="Plot Bearish", defval=true)
input showHiddenBullishDiv = no; #(title="Plot Hidden Bullish", defval=true)
input showHiddenBearishDiv = no; #((title="Plot Hidden Bearish", defval=true)
input showMacd = yes; #((true, title="MACD")
input showMacdHist = yes; #((true, title="MACD Histogram")
input showRsi = yes; #((true, title="RSI")
input showStochastic = yes; #((true, title="Stochastic")
input showCci = yes; #((true, title="CCI")
input showMomentum = yes; #((true, title="Momentum")
input showObv = yes; #((true, title="OBV")
input showDiosc = yes; #((true, title="Diosc")
input showVwMacd = yes; #((true, title="VWmacd")
input showChaikinMoneyFlow = yes; #((true, title="Chaikin Money Flow")
input showMoneyFlowIndex = yes; #((true, title="Money Flow Index")
def na = Double.NaN;
def cnt = MinimumDivCountToDisplay;
def lbr = PivotLookbackRight;
def lbl = PivotLookbackLeft;
def rngUp = MaxLookbackRange;
def rngLo = MinLookbackRange;
def plotBullish = showRegularBullishDiv;
def plotHiddenBull = showHiddenBullishDiv;
def plotBearish = showRegularBearishDiv;
def plotHiddenBear = showHiddenBearishDiv;
def calcstoc = showStochastic;
def calccci = showCci;
def calcmom = showMomentum;
def calcobv = showObv;
def calcdi = showDiosc;
def calcvwmacd = showVwMacd;
def calccmf = showChaikinMoneyFlow;
def calcmfi = showMoneyFlowIndex;
def off = if Repaint then lbR else 0;
# stoch(source, high, low, length) =>
script stoch {
input src = close;
input h = high;
input l = low;
input len = 14;
def hh = Highest(h, len);
def ll = Lowest(l, len);
def stoch = 100 * (src - ll) / (hh - ll);
plot return = stoch;
}
#vwma(source, length)
script VWMA {
input src = close;
input len = 14;
input vol = volume;
def nom = Average(src * vol, len);
def den = Average(vol, len);
def VWMA = nom / den;
plot result = VWMA;
}
script Pivots {
input series = close;
input leftBars = 10;
input rightBars = 10;
input isHigh = yes;
def na = Double.NaN;
def HH = series == Highest(series, leftBars + 1);
def LL = series == Lowest(series, leftBars + 1);
def pivotRange = (leftBars + rightBars + 1);
def leftEdgeValue = if series[pivotRange] == 0 then na else series[pivotRange];
def pvtCond = !IsNaN(series) and leftBars > 0 and rightBars > 0 and !IsNaN(leftEdgeValue);
def barIndexH = if pvtCond then
fold i = 1 to rightBars + 1 with p=1 while p do
series > GetValue(series, - i) else na;
def barIndexL = if pvtCond then
fold j = 1 to rightBars + 1 with q=1 while q do
series < GetValue(series, - j) else na;
def PivotPoint;
if isHigh {
PivotPoint = if HH and barIndexH then series else na;
} else {
PivotPoint = if LL and barIndexL then series else na;
}
plot pvt = PivotPoint;
}
#// RSI
def rsi = RSI(Price = close, Length = 14);
#// MACD
def macd = ExpAverage(close, 12) - ExpAverage(close, 26);
def signal = ExpAverage(macd, 9);
def macH = macd - signal;
#// Momentum
def mome = close - close[10];
#// CCI
def ma = Average(close, 10);
def cci = (close - ma) / (0.015 * Lindev(close, 10));
#// OBV
def OBV = TotalSum(Sign(close - close[1]) * volume);
#// Stoch
def stk = Average(stoch(close, high, low, 14), 3);
#// DIOSC
def DI = (high - high[1]) - (-(low - low[1]));
def trur = ATR(Length = 14);
def diosc = (100 * WildersAverage(DI, 14) / trur);
def dio = if !IsNaN(diosc) then diosc else dio[1];
#// volume weighted macd
def maFast = vwma(close, 12);
def maSlow = vwma(close, 26);
def vwmac = maFast - maSlow;
#// Chaikin money flow
def Cmfm = ((close - low) - (high - close)) / (high - low);
def Cmfv = Cmfm * volume;
def cmf = Average(Cmfv, 21) / Average(volume, 21);
#-- MFI
def mfi = MoneyFlowIndex(Length = 14);
#-- Div Script
script _inRange {
input cond = no;
input rangeLower = 5;
input rangeUpper = 60;
def bars = if cond then 0 else bars[1] + 1;
def inRange = rangeLower <= bars and bars <= rangeUpper;
plot out = inRange;
}
#// Regular Bullish
script divBull {
input osc = close;
input cond = yes;
input type = 1;
def pvt1;
def pvt2;
def val1;
def val2;
if cond {
pvt2 = pvt1[1];
pvt1 = osc;
val2 = val1[1];
val1 = low;
} else {
pvt2 = pvt2[1];
pvt1 = pvt1[1];
val2 = val2[1];
val1 = val1[1];
}
def divR = (osc > pvt2) and (low < val2);
def divH = (osc < pvt2) and (low > val2);
def oscHL = if type == 1 then divR else divH;
plot out = oscHL and cond;
}
script bullCond {
input osc = close;
input lbL = 10;
input lbR = 10;
input rangeLower = 1;
input rangeUpper = 60;
input plotBull = yes;
def pl = pivots(osc, lbL, lbR, no);
def plFound = !IsNaN(pl);
def inRange = _inRange(plFound[1], rangeLower, rangeUpper);
def divBull = divBull(osc, plFound, 1);
def bullCond = plotBull and divBull and inRange;
plot out = if IsNaN(bullCond) then 0 else bullCond;
}
#// Hidden Bullish
script hidBull {
input osc = close;
input lbL = 10;
input lbR = 10;
input rangeLower = 5;
input rangeUpper = 60;
input plotHiddenBull = yes;
def pl = pivots(osc, lbL, lbR, no);
def plFound = !IsNaN(pl);
def inRange = _inRange(plFound[1], rangeLower, rangeUpper);
def divBull = divBull(osc, plFound, 0);
def hiddenBullCond = plotHiddenBull and divBull and inRange;
plot out = if IsNaN(hiddenBullCond) then 0 else hiddenBullCond;
}
#// Regular Bearish
script DivBear {
input osc = close;
input cond = yes;
input type = 1;
def pvt1;
def pvt2;
def val1;
def val2;
if cond {
pvt2 = pvt1[1];
pvt1 = osc;
val2 = val1[1];
val1 = high;
} else {
pvt2 = pvt2[1];
pvt1 = pvt1[1];
val2 = val2[1];
val1 = val1[1];
}
def divR = (osc < pvt2) and (high > val2);
def divH = (osc > pvt2) and (high < val2);
def oscLH = if type == 1 then divR else divH;
plot out = oscLH and cond;
}
script bearCond {
input osc = close;
input lbL = 10;
input lbR = 10;
input rangeLower = 1;
input rangeUpper = 60;
input plotBear = yes;
def ph = pivots(osc, lbL, lbR, yes);
def phFound = !IsNaN(ph);
def inRange = _inRange(phFound[1], rangeLower, rangeUpper);
def divBear = DivBear(osc, phFound, 1);
def bearCond = plotBear and divBear and inRange;
plot out = if IsNaN(bearCond) then 0 else bearCond;
}
#// Hidden Bearish
script hidBear {
input osc = close;
input lbL = 10;
input lbR = 10;
input rangeLower = 1;
input rangeUpper = 60;
input plotHiddenBull = yes;
def ph = pivots(osc, lbL, lbR, yes);
def phFound = !IsNaN(ph);
def inRange = _inRange(phFound[1], rangeLower, rangeUpper);
def divBear = DivBear(osc, phFound, 0);
def hiddenBearCond = plotHiddenBull and divBear and inRange;
plot out = if IsNaN(hiddenBearCond) then 0 else hiddenBearCond;
}
# bull
def rsiRbull = bullCond(rsi , lbL, lbR, rngLo, rngUp, plotBullish);
def macRbull = bullCond(macd , lbL, lbR, rngLo, rngUp, plotBullish);
def hisRbull = bullCond(macH , lbL, lbR, rngLo, rngUp, plotBullish);
def momRbull = bullCond(mome , lbL, lbR, rngLo, rngUp, plotBullish);
def cciRbull = bullCond(cci , lbL, lbR, rngLo, rngUp, plotBullish);
def obvRbull = bullCond(obv , lbL, lbR, rngLo, rngUp, plotBullish);
def stcRbull = bullCond(stk , lbL, lbR, rngLo, rngUp, plotBullish);
def dioRbull = bullCond(dio , lbL, lbR, rngLo, rngUp, plotBullish);
def vwmRbull = bullCond(vwmac , lbL, lbR, rngLo, rngUp, plotBullish);
def cmfRbull = bullCond(cmf , lbL, lbR, rngLo, rngUp, plotBullish);
def mfiRbull = bullCond(mfi , lbL, lbR, rngLo, rngUp, plotBullish);
def posDivRsi = if (showRsi and rsiRbull) then 1 else 0;
def posDivMacd = posDivRsi + (if showMacd and macRbull then 1 else 0);
def posDivDelt = posDivMacd + (if showMacdHist and hisRbull then 1 else 0);
def posDivMom = posDivDelt + (if calcmom and momRbull then 1 else 0);
def posDivCCI = posDivMom + (if calccci and cciRbull then 1 else 0);
def posDivOBV = posDivCCI + (if calcobv and obvRbull then 1 else 0);
def posDivSTC = posDivOBV + (if calcstoc and stcRbull then 1 else 0);
def posDivDIO = posDivSTC + (if calcdi and dioRbull then 1 else 0);
def posDivVWM = posDivDIO + (if calcvwmacd and vwmRbull then 1 else 0);
def posDivCMF = posDivVWM + (if calccmf and cmfRbull then 1 else 0);
def posDivMFI = posDivCMF + (if calcmfi and mfiRbull then 1 else 0);
#hidden Bull
def rsiHbull = hidBull(rsi , lbL, lbR, rngLo, rngUp, plotHiddenBull);
def macHbull = hidBull(macd , lbL, lbR, rngLo, rngUp, plotHiddenBull);
def hisHbull = hidBull(macH , lbL, lbR, rngLo, rngUp, plotHiddenBull);
def momHbull = hidBull(mome , lbL, lbR, rngLo, rngUp, plotHiddenBull);
def cciHbull = hidBull(cci , lbL, lbR, rngLo, rngUp, plotHiddenBull);
def obvHbull = hidBull(obv , lbL, lbR, rngLo, rngUp, plotHiddenBull);
def stcHbull = hidBull(stk , lbL, lbR, rngLo, rngUp, plotHiddenBull);
def dioHbull = hidBull(dio , lbL, lbR, rngLo, rngUp, plotHiddenBull);
def vwmHbull = hidBull(vwmac , lbL, lbR, rngLo, rngUp, plotHiddenBull);
def cmfHbull = hidBull(cmf , lbL, lbR, rngLo, rngUp, plotHiddenBull);
def mfiHbull = hidBull(mfi , lbL, lbR, rngLo, rngUp, plotHiddenBull);
def HposDivRsi = if (showRsi and rsiHbull) then 1 else 0;
def HposDivMacd = HposDivRsi + (if showMacd and macHbull then 1 else 0);
def HposDivDelt = HposDivMacd + (if showMacdHist and hisHbull then 1 else 0);
def HposDivMom = HposDivDelt + (if calcmom and momHbull then 1 else 0);
def HposDivCCI = HposDivMom + (if calccci and cciHbull then 1 else 0);
def HposDivOBV = HposDivCCI + (if calcobv and obvHbull then 1 else 0);
def HposDivSTC = HposDivOBV + (if calcstoc and stcHbull then 1 else 0);
def HposDivDIO = HposDivSTC + (if calcdi and dioHbull then 1 else 0);
def HposDivVWM = HposDivDIO + (if calcvwmacd and vwmHbull then 1 else 0);
def HposDivCMF = HposDivVWM + (if calccmf and cmfHbull then 1 else 0);
def HposDivMFI = HposDivCMF + (if calcmfi and mfiHbull then 1 else 0);
# bear
def rsiRbear = bearCond(rsi , lbL, lbR, rngLo, rngUp, plotBearish);
def macRbear = bearCond(macd , lbL, lbR, rngLo, rngUp, plotBearish);
def hisRbear = bearCond(macH , lbL, lbR, rngLo, rngUp, plotBearish);
def momRbear = bearCond(mome , lbL, lbR, rngLo, rngUp, plotBearish);
def cciRbear = bearCond(cci , lbL, lbR, rngLo, rngUp, plotBearish);
def obvRbear = bearCond(obv , lbL, lbR, rngLo, rngUp, plotBearish);
def stcRbear = bearCond(stk , lbL, lbR, rngLo, rngUp, plotBearish);
def dioRbear = bearCond(dio , lbL, lbR, rngLo, rngUp, plotBearish);
def vwmRbear = bearCond(vwmac , lbL, lbR, rngLo, rngUp, plotBearish);
def cmfRbear = bearCond(cmf , lbL, lbR, rngLo, rngUp, plotBearish);
def mfiRbear = bearCond(mfi , lbL, lbR, rngLo, rngUp, plotBearish);
def negDivRsi = if (showRsi and rsiRbear) then 1 else 0;
def negDivMacd = negDivRsi + (if showMacd and macRbear then 1 else 0);
def negDivDelt = negDivMacd + (if showMacdHist and hisRbear then 1 else 0);
def negDivMom = negDivDelt + (if calcmom and momRbear then 1 else 0);
def negDivCCI = negDivMom + (if calccci and cciRbear then 1 else 0);
def negDivOBV = negDivCCI + (if calcobv and obvRbear then 1 else 0);
def negDivSTC = negDivOBV + (if calcstoc and stcRbear then 1 else 0);
def negDivDIO = negDivSTC + (if calcdi and dioRbear then 1 else 0);
def negDivVWM = negDivDIO + (if calcvwmacd and vwmRbear then 1 else 0);
def negDivCMF = negDivVWM + (if calccmf and cmfRbear then 1 else 0);
def negDivMFI = negDivCMF + (if calcmfi and mfiRbear then 1 else 0);
#hidden Bear
def rsiHbear = hidBear(rsi , lbL, lbR, rngLo, rngUp, plotHiddenBear);
def macHbear = hidBear(macd , lbL, lbR, rngLo, rngUp, plotHiddenBear);
def hisHbear = hidBear(macH , lbL, lbR, rngLo, rngUp, plotHiddenBear);
def momHbear = hidBear(mome , lbL, lbR, rngLo, rngUp, plotHiddenBear);
def cciHbear = hidBear(cci , lbL, lbR, rngLo, rngUp, plotHiddenBear);
def obvHbear = hidBear(obv , lbL, lbR, rngLo, rngUp, plotHiddenBear);
def stcHbear = hidBear(stk , lbL, lbR, rngLo, rngUp, plotHiddenBear);
def dioHbear = hidBear(dio , lbL, lbR, rngLo, rngUp, plotHiddenBear);
def vwmHbear = hidBear(vwmac , lbL, lbR, rngLo, rngUp, plotHiddenBear);
def cmfHbear = hidBear(cmf , lbL, lbR, rngLo, rngUp, plotHiddenBear);
def mfiHbear = hidBear(mfi , lbL, lbR, rngLo, rngUp, plotHiddenBear);
def HnegDivRsi = if (showRsi and rsiHbear) then 1 else 0;
def HnegDivMacd = HnegDivRsi + (if showMacd and macHbear then 1 else 0);
def HnegDivDelt = HnegDivMacd + (if showMacdHist and hisHbear then 1 else 0);
def HnegDivMom = HnegDivDelt + (if calcmom and momHbear then 1 else 0);
def HnegDivCCI = HnegDivMom + (if calccci and cciHbear then 1 else 0);
def HnegDivOBV = HnegDivCCI + (if calcobv and obvHbear then 1 else 0);
def HnegDivSTC = HnegDivOBV + (if calcstoc and stcHbear then 1 else 0);
def HnegDivDIO = HnegDivSTC + (if calcdi and dioHbear then 1 else 0);
def HnegDivVWM = HnegDivDIO + (if calcvwmacd and vwmHbear then 1 else 0);
def HnegDivCMF = HnegDivVWM + (if calccmf and cmfHbear then 1 else 0);
def HnegDivMFI = HnegDivCMF + (if calcmfi and mfiHbear then 1 else 0);
def posdiverg = posDivMFI[-off];
def posdivHid = HposDivMFI[-off];
def negdiverg = negDivMFI[-off];
def negdivhid = HnegDivMFI[-off];
#-- Reg Bull
plot posDivR1 = if (posdiverg[lbr] == 1 and cnt < 2) then 1 else na;
plot posDivR2 = if (posdiverg[lbr] == 2 and cnt < 3) then 2 else na;
plot posDivR3 = if (posdiverg[lbr] == 3 and cnt < 4) then 3 else na;
plot posDivR4 = if (posdiverg[lbr] == 4 and cnt < 5) then 4 else na;
plot posDivR5 = if (posdiverg[lbr] == 5 and cnt < 6) then 5 else na;
plot posDivR6 = if (posdiverg[lbr] == 6 and cnt < 7) then 6 else na;
plot posDivR7 = if (posdiverg[lbr] == 7 and cnt < 8) then 7 else na;
plot posDivR8 = if (posdiverg[lbr] == 8 and cnt < 9) then 8 else na;
plot posDivR9 = if (posdiverg[lbr] == 9 and cnt < 10) then 9 else na;
plot posDivR0 = if (posdiverg[lbr] > 9 and cnt < 11) then 10 else na;
# Hidden Bull
plot posDivH1 = if (posdivHid[lbr] == 1 and cnt < 2) then 1 else na;
plot posDivH2 = if (posdivHid[lbr] == 2 and cnt < 3) then 2 else na;
plot posDivH3 = if (posdivHid[lbr] == 3 and cnt < 4) then 3 else na;
plot posDivH4 = if (posdivHid[lbr] == 4 and cnt < 5) then 4 else na;
plot posDivH5 = if (posdivHid[lbr] == 5 and cnt < 6) then 5 else na;
plot posDivH6 = if (posdivHid[lbr] == 6 and cnt < 7) then 6 else na;
plot posDivH7 = if (posdivHid[lbr] == 7 and cnt < 8) then 7 else na;
plot posDivH8 = if (posdivHid[lbr] == 8 and cnt < 9) then 8 else na;
plot posDivH9 = if (posdivHid[lbr] == 9 and cnt < 10) then 9 else na;
plot posDivH0 = if (posdivHid[lbr] > 9 and cnt < 11) then 10 else na;
# Reg Bear
plot negDivR1 = if (negdiverg[lbr] == 1 and cnt < 2) then 1 else na;
plot negDivR2 = if (negdiverg[lbr] == 2 and cnt < 3) then 2 else na;
plot negDivR3 = if (negdiverg[lbr] == 3 and cnt < 4) then 3 else na;
plot negDivR4 = if (negdiverg[lbr] == 4 and cnt < 5) then 4 else na;
plot negDivR5 = if (negdiverg[lbr] == 5 and cnt < 6) then 5 else na;
plot negDivR6 = if (negdiverg[lbr] == 6 and cnt < 7) then 6 else na;
plot negDivR7 = if (negdiverg[lbr] == 7 and cnt < 8) then 7 else na;
plot negDivR8 = if (negdiverg[lbr] == 8 and cnt < 9) then 8 else na;
plot negDivR9 = if (negdiverg[lbr] == 9 and cnt < 10) then 9 else na;
plot negDivR0 = if (negdiverg[lbr] > 9 and cnt < 11) then 10 else na;
# Hidden Bear
plot negDivH1 = if (negdivhid[lbr] == 1 and cnt < 2) then 1 else na;
plot negDivH2 = if (negdivhid[lbr] == 2 and cnt < 3) then 2 else na;
plot negDivH3 = if (negdivhid[lbr] == 3 and cnt < 4) then 3 else na;
plot negDivH4 = if (negdivhid[lbr] == 4 and cnt < 5) then 4 else na;
plot negDivH5 = if (negdivhid[lbr] == 5 and cnt < 6) then 5 else na;
plot negDivH6 = if (negdivhid[lbr] == 6 and cnt < 7) then 6 else na;
plot negDivH7 = if (negdivhid[lbr] == 7 and cnt < 8) then 7 else na;
plot negDivH8 = if (negdivhid[lbr] == 8 and cnt < 9) then 8 else na;
plot negDivH9 = if (negdivhid[lbr] == 9 and cnt < 10) then 9 else na;
plot negDivH0 = if (negdivhid[lbr] > 9 and cnt < 11) then 10 else na;
#-- Style
posDivR1.SetPaintingStrategy(PaintingStrategy.VALUES_BELOW);
posDivR2.SetPaintingStrategy(PaintingStrategy.VALUES_BELOW);
posDivR3.SetPaintingStrategy(PaintingStrategy.VALUES_BELOW);
posDivR4.SetPaintingStrategy(PaintingStrategy.VALUES_BELOW);
posDivR5.SetPaintingStrategy(PaintingStrategy.VALUES_BELOW);
posDivR6.SetPaintingStrategy(PaintingStrategy.VALUES_BELOW);
posDivR7.SetPaintingStrategy(PaintingStrategy.VALUES_BELOW);
posDivR8.SetPaintingStrategy(PaintingStrategy.VALUES_BELOW);
posDivR9.SetPaintingStrategy(PaintingStrategy.VALUES_BELOW);
posDivR0.SetPaintingStrategy(PaintingStrategy.VALUES_BELOW);
posDivH1.SetPaintingStrategy(PaintingStrategy.VALUES_BELOW);
posDivH2.SetPaintingStrategy(PaintingStrategy.VALUES_BELOW);
posDivH3.SetPaintingStrategy(PaintingStrategy.VALUES_BELOW);
posDivH4.SetPaintingStrategy(PaintingStrategy.VALUES_BELOW);
posDivH5.SetPaintingStrategy(PaintingStrategy.VALUES_BELOW);
posDivH6.SetPaintingStrategy(PaintingStrategy.VALUES_BELOW);
posDivH7.SetPaintingStrategy(PaintingStrategy.VALUES_BELOW);
posDivH8.SetPaintingStrategy(PaintingStrategy.VALUES_BELOW);
posDivH9.SetPaintingStrategy(PaintingStrategy.VALUES_BELOW);
posDivH0.SetPaintingStrategy(PaintingStrategy.VALUES_BELOW);
posDivR1.SetDefaultColor(Color.CYAN);
posDivR2.SetDefaultColor(Color.CYAN);
posDivR3.SetDefaultColor(Color.CYAN);
posDivR4.SetDefaultColor(Color.CYAN);
posDivR5.SetDefaultColor(Color.CYAN);
posDivR6.SetDefaultColor(Color.CYAN);
posDivR7.SetDefaultColor(Color.CYAN);
posDivR8.SetDefaultColor(Color.CYAN);
posDivR9.SetDefaultColor(Color.CYAN);
posDivR0.SetDefaultColor(Color.CYAN);
posDivH1.SetDefaultColor(Color.DARK_GREEN);
posDivH2.SetDefaultColor(Color.DARK_GREEN);
posDivH3.SetDefaultColor(Color.DARK_GREEN);
posDivH4.SetDefaultColor(Color.DARK_GREEN);
posDivH5.SetDefaultColor(Color.DARK_GREEN);
posDivH6.SetDefaultColor(Color.DARK_GREEN);
posDivH7.SetDefaultColor(Color.DARK_GREEN);
posDivH8.SetDefaultColor(Color.DARK_GREEN);
posDivH9.SetDefaultColor(Color.DARK_GREEN);
posDivH0.SetDefaultColor(Color.DARK_GREEN);
negDivR1.SetPaintingStrategy(PaintingStrategy.VALUES_ABOVE);
negDivR2.SetPaintingStrategy(PaintingStrategy.VALUES_ABOVE);
negDivR3.SetPaintingStrategy(PaintingStrategy.VALUES_ABOVE);
negDivR4.SetPaintingStrategy(PaintingStrategy.VALUES_ABOVE);
negDivR5.SetPaintingStrategy(PaintingStrategy.VALUES_ABOVE);
negDivR6.SetPaintingStrategy(PaintingStrategy.VALUES_ABOVE);
negDivR7.SetPaintingStrategy(PaintingStrategy.VALUES_ABOVE);
negDivR8.SetPaintingStrategy(PaintingStrategy.VALUES_ABOVE);
negDivR9.SetPaintingStrategy(PaintingStrategy.VALUES_ABOVE);
negDivR0.SetPaintingStrategy(PaintingStrategy.VALUES_ABOVE);
negDivH1.SetPaintingStrategy(PaintingStrategy.VALUES_ABOVE);
negDivH2.SetPaintingStrategy(PaintingStrategy.VALUES_ABOVE);
negDivH3.SetPaintingStrategy(PaintingStrategy.VALUES_ABOVE);
negDivH4.SetPaintingStrategy(PaintingStrategy.VALUES_ABOVE);
negDivH5.SetPaintingStrategy(PaintingStrategy.VALUES_ABOVE);
negDivH6.SetPaintingStrategy(PaintingStrategy.VALUES_ABOVE);
negDivH7.SetPaintingStrategy(PaintingStrategy.VALUES_ABOVE);
negDivH8.SetPaintingStrategy(PaintingStrategy.VALUES_ABOVE);
negDivH9.SetPaintingStrategy(PaintingStrategy.VALUES_ABOVE);
negDivH0.SetPaintingStrategy(PaintingStrategy.VALUES_ABOVE);
negDivR1.SetDefaultColor(Color.MAGENTA);
negDivR2.SetDefaultColor(Color.MAGENTA);
negDivR3.SetDefaultColor(Color.MAGENTA);
negDivR4.SetDefaultColor(Color.MAGENTA);
negDivR5.SetDefaultColor(Color.MAGENTA);
negDivR6.SetDefaultColor(Color.MAGENTA);
negDivR7.SetDefaultColor(Color.MAGENTA);
negDivR8.SetDefaultColor(Color.MAGENTA);
negDivR9.SetDefaultColor(Color.MAGENTA);
negDivR0.SetDefaultColor(Color.MAGENTA);
negDivH1.SetDefaultColor(Color.DARK_ORANGE);
negDivH2.SetDefaultColor(Color.DARK_ORANGE);
negDivH3.SetDefaultColor(Color.DARK_ORANGE);
negDivH4.SetDefaultColor(Color.DARK_ORANGE);
negDivH5.SetDefaultColor(Color.DARK_ORANGE);
negDivH6.SetDefaultColor(Color.DARK_ORANGE);
negDivH7.SetDefaultColor(Color.DARK_ORANGE);
negDivH8.SetDefaultColor(Color.DARK_ORANGE);
negDivH9.SetDefaultColor(Color.DARK_ORANGE);
negDivH0.SetDefaultColor(Color.DARK_ORANGE);
#-- END of COde