Back

Percentage Price Oscillator (PPO) values

The PPO values don't look correct to me which means I'm likely doing something wrong - I'm new here.

The code attached runs a standard 12, 26, 9 PPO against SPY through yesterday, April 16.  QC is returning a PPO of 1.46 and a PPO signal value of 4.09.   My calculations in the attched code returns PPO of -0.4565 and a PPO signal of -0.7408.  StockCharts generally agrees with PPO = -0.449  and signal = -0.734.

Any input would be appreciated.  The relevant output in the attached backtest is in the log file.

As a secondary question, what would be the best way to handle the conversions necessary for my math.  After an hour or so of trying I converted everything over to floats, but suspect there is a better way.

Thanks,

Update Backtest








Hi Hugh,

Indicators require a warm-up period to initialize. Please check this example

https://github.com/QuantConnect/Lean/blob/master/Algorithm.Python/WarmupAlgorithm.py

You could either change the decimal price into a float or change the float number into decimal.

0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Hi Jing Wu, thank you for the comment.

Please note the backtest is run from Jan 1, 2018, so the warmup period should be exceeded. Data was logged after April 1 to focus on the stable, current time period.

0

Jing Wu, I should have noted in my reply that I was just studying some of your shared backtests - nice work.

0

SOLVED - The PPO indicator does not support the smoothed signal line but does expect a moving average type to be defined.

Therefore my original line:.

self.qcPPO = self.PPO(self.SymData, 12,26,9)
should have been
self.qcPPO = self.PPO(self.SymData, 12, 26, MovingAverageType.Exponential)
Then, separately, I would need to take a 9 period ema of PPO to have a signal line.
Thanks for the comments above because it encouraged me to look at the github page for PPO.
0

Update Backtest





0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Loading...

This discussion is closed