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:
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
 
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
 
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?
 

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
484 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top