glgene 616 posts msg #103141 - Ignore glgene |
10/28/2011 5:33:20 PM
In looking at the MACD.histogram numbers on a Symlist of stocks -- with the stocks being priced differently -- I tried to compare them apples-to-apples with a Percent Price Oscillator (PPO) indicator.
Because using MACD only, and sorting on the histogram column, it won't help me. If SPY has a price of $128.60 and QQQ has a price of $58.94 and each had a MACD histogram of .25, you couldn't say they tied...because of their price difference.
But here is my SF scripting problem: I added a column called PPO Histogram(12,26,9), but the output comes out as PPO(20,50). Where does the 20,50 come from??
I think correct PPH Histogram output will give me the apples-to-apples comparison I'm looking for. Unless, of course, one can't compute a PPO Histogram in Stockfetcher. ??
Any help with the erroneous PPO 20,50 output? I want PPO 12,26,9 histogram output.
Thanks.
Gene
|
four 5,087 posts msg #103143 - Ignore four modified |
10/28/2011 6:38:29 PM
I believe,
PPO is a "simple moving average" and MACD is an "exponential".
I made a custom MA(9) of PPO.
The histogram would be the subtraction that occurs with the plot and the cma(9).
|
glgene 616 posts msg #103144 - Ignore glgene |
10/28/2011 8:13:23 PM
four,
Your script amendment seems to do the trick! Thanks!
I'll add a Sort on the PPO column. In your output, there were a few at .02. I assume that SF will sort on 4 decimal places. Would that be correct?
A couple of more questions:
1). Is it possible to convert PPO to an EMA? So it matches MACD logic. If not, no big deal. The MA of PPO should do just fine.
2). Is there a better way to show what I'm seeking in line with MACD-type thinking in comparing stocks or indice-type ETFs.
Again...thanks!
Gene
|
four 5,087 posts msg #103145 - Ignore four modified |
10/29/2011 12:38:19 AM
1). Is it possible to convert PPO to an EMA? So it matches MACD logic.
--
Both take the difference, however:
PPO = Percentage
MACD = Value
Here is PPO with ema of 9
|
glgene 616 posts msg #103147 - Ignore glgene |
10/29/2011 1:22:22 AM
Thanks again, four.
I'll study your info over the weekend and get back to you. I really appreciate your help.
Gene
|
mahkoh 1,065 posts msg #103151 - Ignore mahkoh |
10/29/2011 3:30:57 PM
As you seem to be looking for the histogram value, this add on should provide that
Still all kind of odd, as stockcharts states the following about PPO:
Calculation
Percentage Price Oscillator (PPO): {(12-day EMA - 26-day EMA)/26-day EMA} x 100
Signal Line: 9-day EMA of PPO
PPO Histogram: PPO - Signal Line
While MACD measures the absolute difference between two moving averages, PPO makes this a relative value by dividing difference by the slower moving average (26-day EMA). PPO is simply the MACD value divided by the longer moving average. The result is multiplied by 100 to move the decimal place two spots. The table below shows Intel (INTC) with values for the 12-day EMA, 26-day EMA, MACD and PPO. Intel is priced in the low 20s and MACD values range from -44 cents to +64 cents. PPO puts this in percentage terms with values ranging from -2.01 to +2.85. It is easier to compare levels over time with percentages. -2.01 is equivalent to -2.01%, while +2.85 is equivalent to +2.85%.
http://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:price_oscillators
|
glgene 616 posts msg #103176 - Ignore glgene |
10/31/2011 10:13:33 PM
four and mahkoh,
Shown below is a stretched script -- including MACD and PPO. I included the S&P 9 sectors and VTI. Thanks for both of your assistance!
I did a long-hand version of MACD calculations so interested persons can see the step-by-step construction of MACD, MACD Signal line and MACD Histogram. [I also imbedded a /* line */ to shorten the script for the MACD Histogram for those interested.]
PPO Oscillator and PPO Histogram are on the right-hand side.
I know with the MACD, its Histogram seems to be the holy grail, but I'm not sure that would be the case with PPO. I would like others' opinion as to which is more relevant -- PPO Oscillator or PPH Histogram.
One script problem that I'm either blind to see, or there is a programming snafu. I've got the script supposedly sorting on Col. 11 descending (PPO Histogram), but it doesn't. ???
Any other comments about the script?
The original purpose of this script was to construct a PPO. I don't believe SF scripting language uses EMA (which you should), so that was added thru a CEMA command.
MACD and PPO are cousins. Except PPO allows the comparison of stocks based on % price difference, whereas MACD is soley on price. For comparisons, PPO is more relevant.
|
glgene 616 posts msg #103177 - Ignore glgene |
11/1/2011 12:25:43 AM
In my previous post, I made a statement..."I don't believe SF scripting language uses EMA (which you should), so that was added thru a CEMA command."
What I meant to say is the SF documentation doesn't reference use of EMA in its PPO indicator section (page 88). Thus, the need to create an EMA using the CEMA command (short and sweet).
Gene
|
glgene 616 posts msg #103193 - Ignore glgene |
11/1/2011 6:56:50 PM
??? I don't know how the MACD histograms (that is most of them) can be positive...yet the PPO histograms are all negative at end-of-day Nov. 1, 2011. They should line up...the only difference being MACD histogram is in dollars and cents, whereas the PPO histogram is expressed in percentage.
I must have scripted this incorrectly (see my latest script by scrolling up 2 msgs.) I'm pretty sure the MACD histogram is computed correctly. PPO histogram help is needed. This is driving me nuts after seeing today's numbers. I need fresh eyes on this. ???
Gene
|
mahkoh 1,065 posts msg #103197 - Ignore mahkoh |
11/2/2011 8:46:43 AM
Percentage Price Oscillator (PPO): {(12-day EMA - 26-day EMA)/26-day EMA} x 100 (=ppo2)
Signal Line: 9-day EMA of PPO (=osc)
PPO Histogram: PPO - Signal Line (So this should not be macd-osc, but ppo2 - osc)
|