I'm pretty new to coding and I am trying to write my own MACD difference value in python (because I couldn't find one in the git repository).
I'm using the sample MACD code MACDTrendAlgorithm.py which can be found here https://github.com/trooper5010/Lean/blob/master/Algorithm.Python/MACDTrendAlgorithm.py
I am trying to create a MACD Difference which takes the difference between MACD and its moving average and a MACD Previous Difference which takes the previous value of the MACD difference after the hour has closed. However, I don't know how to do MACD previous in terms of objects and attributes. Here is what I have so far:
# define MACD Difference and Previous Difference
Diff = (self.__macd.Current.Value - self.__macd.MovingAverageType.Current.Value)
Diffprev = self.__macd.
I'm fairly new to coding so I'm not sure what to do from here whether that means create an attribute for what I need or if there is already one in the repository.
Thanks for your help.
Phil Engel
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.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!