Using Price Momentum Indicator PMO instead of MACD? Here's a histogram version.

theLEMband

Member
VIP
Price Momentum Indicator PMO
I've taken TDA's PMO script and modified it to show a histogram. From what I've read PMO works like MACD, but may be better, especially for comparing stocks.
a3.png

Ruby:
## PMO_Histogram
## ver 21.08.06.0
## TD Ameritrade's script modified by theLEMband to produce a histogram
## ver 21.08.09.0
## Modified to include the ability to switch PMO/signal lines off/on
## ver 21.08.18.0
## Fixed histogram coloring error

declare lower;

input price = close;
input length1 = 35;
input length2 = 20;
input signalLength = 10;
input plotlines = yes;

def rate = 100 * (price - price[1]) / price[1];

def PMOCalc = ExpAverage(10 * ExpAverage(rate, length1), length2);
def SignalLineCalc = ExpAverage(PMOcalc, signalLength);
def PMODiffCalc =  PMOCalc - SignalLineCalc;


plot PMO = if plotlines then pmoCalc else Double.NaN;
plot SignalLine = if plotlines then SignalLineCalc else Double.NaN;
plot PMODiff =  PMODiffCalc;
plot ZeroLine = 0;

AddCloud(PMO, SignalLine, Color.GREEN, Color.RED);
PMO.SetDefaultColor(GetColor(1));
SignalLine.SetDefaultColor(GetColor(3));
ZeroLine.SetDefaultColor(GetColor(7));


PMODiff.SetDefaultColor(GetColor(5));
PMODiff.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
PMODiff.SetLineWeight(3);
PMODiff.DefineColor("Positive and Up", Color.GREEN);
PMODiff.DefineColor("Positive and Down", Color.DARK_GREEN);
PMODiff.DefineColor("Negative and Down", Color.RED);
PMODiff.DefineColor("Negative and Up", Color.DARK_RED);
PMODiff.AssignValueColor(if PMODiff >= 0 then if PMODiff > PMODiff[1] then PMODiff.color("Positive and Up") else PMODiff.color("Positive and Down") else if PMODiff < PMODiff[1] then PMODiff.Color("Negative and Down") else PMODiff.Color("Negative and Up"));
## End Code##
Shared Study Link: http://tos.mx/vgU8XzK
Click here for --> Easiest way to load shared links
 
Last edited:

theLEMband

Member
VIP
Further edited to add the ability to turn the PMO and signal lines off/on.
pu9QyLE.png

## PMO_Histogram
## ver 21.08.06.0
## TD Ameritrade's script modified by theLEMband to produce a histogram
## ver 21.08.09.0
## Modified to include the ability to switch PMO/signal lines off/on


declare lower;

input price = close;
input length1 = 35;
input length2 = 20;
input signalLength = 10;
input plotlines = yes;

def rate = 100 * (price - price[1]) / price[1];

def PMOCalc = ExpAverage(10 * ExpAverage(rate, length1), length2);
def SignalLineCalc = ExpAverage(PMOcalc, signalLength);
def PMODiffCalc = PMOCalc - SignalLineCalc;


plot PMO = if plotlines then pmoCalc else Double.NaN;
plot SignalLine = if plotlines then SignalLineCalc else Double.NaN;
plot PMODiff = PMODiffCalc;
plot ZeroLine = 0;

AddCloud(PMO, SignalLine, Color.GREEN, Color.RED);
PMO.SetDefaultColor(GetColor(1));
SignalLine.SetDefaultColor(GetColor(3));
ZeroLine.SetDefaultColor(GetColor(7));

PMODiff.SetDefaultColor(GetColor(5));
PMODiff.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
PMODiff.SetLineWeight(3);
PMODiff.DefineColor("Positive and Up", Color.GREEN);
PMODiff.DefineColor("Positive and Down", Color.DARK_GREEN);
PMODiff.DefineColor("Negative and Down", Color.RED);
PMODiff.DefineColor("Negative and Up", Color.DARK_RED);
PMODiff.AssignValueColor(if PMOCalc >= 0 then if PMOCalc > PMOCalc[1] then PMODiff.color("Positive and Up") else PMODiff.color("Positive and Down") else if PMOCalc < PMOCalc[1] then PMODiff.Color("Negative and Down") else PMODiff.Color("Negative and Up"));SignalLine.SetDefaultColor(GetColor(3));
ZeroLine.SetDefaultColor(GetColor(7));
Shared Study Link http://tos.mx/kWngl3z
 

theLEMband

Member
VIP
Go to scan page, click add filter, select study, select edit (pencil icon at the right side of the new filter). In the window that opens, click on the thinkscript editor tab and replace the code with below. Similar for the DownSignal.

Ruby:
PMO_Histogram()."UpSignal" is true
 

mbarcala

New member
Go to scan page, click add filter, select study, select edit (pencil icon at the right side of the new filter). In the window that opens, click on the thinkscript editor tab and replace the code with below. Similar for the DownSignal.

Ruby:
PMO_Histogram()."UpSignal" is true
I did what you write here but I getting a error! any idea why?
 

Similar threads

Top