Back

Custom ROC Indicator Problem

I'm trying to make a custom indicator, the rate of change of the rate of change in percent (ROCPROCP for short). To me it looks like I have the code correct, but when I go double-check the numbers, they aren't correct. Example: if the ROCP (RateOfChangePercent) is 10% today, and was 7% yesterday, the ROCPROCP would be (10-7)/7 * 100 = 43%. I used the ROCP plot to check the numbers, which don't match what I would expect.
Update Backtest








Hey @Nathan

You don't need to code a new indicator. Alll the work can be done with the "Of" indicator's method.

Please, check the code attached, I just changed the type of the ROCPROCPyear object an replaced:
ROCPROCPyear = new ROCPRateOfChangePercent(252);
RegisterIndicator(symbol, ROCPROCPyear, Resolution.Daily, Field.Close);

with:
ROCPROCPyear = new RateOfChange(252).Of(ROCPyear);
Hope it helps.

Best, JJ
1

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.


Ah thanks, that's easy
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