Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

- JMP User Community
- :
- Discussions
- :
- How to use JMP to calculate the technical indicators of stock————MACD?

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

Highlighted

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Dec 31, 2018 3:07 AM
(4989 views)

New Year is coming, I wish community friends a happy New Year!

Now I want to use JMP for stock data statistics, but it is still a novice, find a few stock JMP sample file, did not see the calculation of technical indicators example.

For example, in the calculation of "MACD", I still don't understand the calculation of EMA.

After searching the manual books, the formula (mark 1 in the Image) for EMA in the manual is at the first place, but the formula (mark 2) in the example file does not seem to be this one

Consult to everybody expert, thank!

MACD calculation formula:

DIF : EMA(CLOSE,12) - EMA(CLOSE,26);

DEA : EMA(DIF,6);

MACD : 2*(DIF-DEA);

1 ACCEPTED SOLUTION

Accepted Solutions

Highlighted

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

I found another website with an Excel sheet with MACD. The table I posted had the correct formulas except for MACD, it should have been EMA12-EMA26, my sign was the opposite.

The site with the Excel sheet is how-to-calculate-macd-in-excel.

Attached is a script that can be run on any table as long as the columns Date and Close exist. I simplified the EMA12 and EMA26 and Signal so that the SMA columns are not required. If High and Low are columns then the area plot is drawn, otherwise, not.

Below is the picture from the website regarding Excel followed by the Graphbuilder picture.

To test, open the JMP sample data table **Current Stock Averages.jmp** then run the attached script CalculateMACD.jsl. Note the graph will be dirfferent than the previously posted, since previously, I had the MACD sign reversed.

The formulas for your calculation are reasonable, however, be careful calling it MACD if you are publishing it. it is my experience that when there is a widely accepted metric, even slight deviations without clear notice will create distrust for any results.

12 REPLIES 12

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Re: How to use JMP to calculate the technical indicators of stock————MACD?

dt = Open( "$SAMPLE_DATA/Current Stock Averages.jmp" );

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Re: How to use JMP to calculate the technical indicators of stock————MACD?

It seems that EMA calculation of stock software is different from JMP formula？

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Re: How to use JMP to calculate the technical indicators of stock————MACD?

EMA represents an exponential moving average, which can be found with with more recent versions of JMP usinge the Moving Average and proper weighting. EMA[i] = EMA[i-1] + (Close[i] - EMA[i-1]) *lambda In your example below, lambda is 2/(12+1)

This link explains the MACD /what-moving-average-convergence-divergence-macd-formula-and-how-it-calculated

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Re: How to use JMP to calculate the technical indicators of stock————MACD?

Thank gzmorgan0!

In this way, my calculation method on the second floor is the same as that in the link.

EMA of JMP is another algorithm?How can JMP methods use parameters to calculate this effect?Thank you very much!

In this way, my calculation method on the second floor is the same as that in the link.

EMA of JMP is another algorithm?How can JMP methods use parameters to calculate this effect?Thank you very much!

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Re: How to use JMP to calculate the technical indicators of stock————MACD?

Created:
Jan 3, 2019 2:01 AM
| Last Modified: Jan 3, 2019 2:12 AM
(4916 views)
| Posted in reply to message from gzmorgan0 01-03-2019

__If__ I read the link that I posted correctly, the attached JMP file is a modification of the JMP sample data Current Stock Prices.JMP

I believe there was a previous discussion (or wish list) for Hi-Lo-Close bars for GraphBuilder. I did not look it up, but copped out with an area range for Hi-Lo and used a line for Close.

The script to create this plot is attached to the data table. Note to get the histogram of the difference of MACD and its signal to be red when negative and green when positive, two columns were used. They are named Bull (green) and Bear (red) and use the same difference formula but is conditioned on whether MACD > Signal.

The JMP statistical column formula **Col Moving Average()** uses a weighted average and produces a result as long as a single value is non-empty versus returning empty if any of the "n" values are missing. Also in JMP, the EWMA or EMA intial value is the value itself, while these stock indicators begin with a simple moving average.

What was not clear in the MACD documentation is the weighting factor. For EMA12 it used 2/(12+1). Does that imply that EMA26 uses 2/(26+1) and the Signal for MACD does it use 2/(9+1), or was 12 used as scaling for 12 months, that is the lambda is always the same?? I used formulas so they can be adjusted if needed.

Maybe one of the super experts have a solution for red and green bars to depict the daily range, or someone has knowledge regarding the smoothing lambda for EMA26 or the Signal which is an EMA9 of MACD.

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Re: How to use JMP to calculate the technical indicators of stock————MACD?

Created:
Jan 3, 2019 2:48 AM
| Last Modified: Jan 3, 2019 2:54 AM
(4908 views)
| Posted in reply to message from gzmorgan0 01-03-2019

t seems to be a little different. On the right hand side are the formulas and results of my calculation.

Nevertheless I may use the result of the index oneself of stock software and computation check, the problem was solved,Thank gzmorgan0!

@gzmorgan0 wrote:

I read the link that I posted correctly, the attached JMP file is a modification of the JMP sample data Current Stock Prices.JMPIfI believe there was a previous discussion (or wish list) for Hi-Lo-Close bars for GraphBuilder. I did not look it up, but copped out with an area range for Hi-Lo and used a line for Close.

The script to create this plot is attached to the data table. Note to get the histogram of the difference of MACD and its signal to be red when negative and green when positive, two columns were used. They are named Bull (green) and Bear (red) and use the same difference formula but is conditioned on whether MACD > Signal.

The JMP statistical column formula

Col Moving Average()uses a weighted average and produces a result as long as a single value is non-empty versus returning empty if any of the "n" values are missing. Also in JMP, the EWMA or EMA intial value is the value itself, while these stock indicators begin with a simple moving average.

What was not clear in the MACD documentation is the weighting factor. For EMA12 it used 2/(12+1). Does that imply that EMA26 uses 2/(26+1) and the Signal for MACD does it use 2/(9+1), or was 12 used as scaling for 12 months, that is the lambda is always the same?? I used formulas so they can be adjusted if needed.

Maybe one of the super experts have a solution for red and green bars to depict the daily range, or someone has knowledge regarding the smoothing lambda for EMA26 or the Signal which is an EMA9 of MACD.

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Re: How to use JMP to calculate the technical indicators of stock————MACD?

I'm going to try to compute the implementation of the "SMA" function in the RSI formula.Thanks!

Highlighted

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

I found another website with an Excel sheet with MACD. The table I posted had the correct formulas except for MACD, it should have been EMA12-EMA26, my sign was the opposite.

The site with the Excel sheet is how-to-calculate-macd-in-excel.

Attached is a script that can be run on any table as long as the columns Date and Close exist. I simplified the EMA12 and EMA26 and Signal so that the SMA columns are not required. If High and Low are columns then the area plot is drawn, otherwise, not.

Below is the picture from the website regarding Excel followed by the Graphbuilder picture.

To test, open the JMP sample data table **Current Stock Averages.jmp** then run the attached script CalculateMACD.jsl. Note the graph will be dirfferent than the previously posted, since previously, I had the MACD sign reversed.

The formulas for your calculation are reasonable, however, be careful calling it MACD if you are publishing it. it is my experience that when there is a widely accepted metric, even slight deviations without clear notice will create distrust for any results.

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Re: How to use JMP to calculate the technical indicators of stock————MACD?

Thank gzmorgan0! I'm so touched by your help!

The parenthesis indicated by the arrow can be omitted so that the two formulas are basically the same.If you have a lot of data, the error is negligible.

Article Labels

There are no labels assigned to this post.