12:32 Paris: Here's an example from BLT several years ago that normalizes plots.
# Normalized Plots
# ZZZ
# 05.30.2015
# Chat room request from Moneymiser21
# Plot the following:
#
# (A) Standard MACD line (12, 26, 9), no histogram, no signal line.
# (B) Vertical line whenever the MACD shows positive divergence from ADX(14)
#
# ADX by itself tells you strength of trend but not the direction of trend.
# It might be best to include DI+/DI- to know if it is truly divergent.
#
# While implementation of this using normalization of plots may not be perfect,
# it is close to the relationships of the actual indicators. This study includes
# the MACD.value, DI+, DI- and ADX.
#
# On the daily SPX we can see that there are a couple of places where DI- peaks
# and starts falling (bullish) while MACD is still falling (bearish). These
# types of divergences are not seen with ADX alone. With all of the plots in
# one study, it will be easier for one to see divergences.
declare lower;
script normalizePlot {
input data = close;
input newRngMin = -1;
input newRngMax = 1;
def hhData = HighestAll( data );
def llData = LowestAll( data );
plot nr = ((( newRngMax - newRngMin ) * ( data - llData )) / ( hhData - llData )) + newRngMin;
}
input newRngMax = 100;
input newRngMin = 0;
plot newMACDplot = normalizePlot(macd().value, newRngMin, newRngMax);
plot newADXplot = normalizePlot(adx(), newRngMin, newRngMax);
plot newDIplus = normalizePlot(diPlus(), newRngMin, newRngMax);
plot newDIminus = normalizePlot(diminus(), newRngMin, newRngMax);