Hello,
I am trying following -
- Calculate exponential regression for x number of days (125 and 250 days) - NOT SURE
- Calculate r squared value (Wiki details) - NOT SURE
- Then I will try to calculate based on these values the best portfolio to create - CAN BE HANDLED
- I would like to calculate the Exp regression * r squared for both 125 and 250 days - EASY TO HANDLE
- Finally find a ratio for this - 125/250d values - CAN BE HANDLED
- Now there are some other checks which are doable - CAN BE HANDLED
- Any direct functions I can use? I saw LSMA but not sure if it is the exponential regression from point 1 above.
- I know the calculations but currently no clue how to calculate this value hopefully with an inbuilt function. I found this function and also that Quantconnect supports it - link. But I am not able to exactly figure out who to do it.
- Can you confirm my question 1 if LSMA is same
- Can you help me calculate r squared value or point me to some example which can do this?
Ray Trader
When I mark it as NOT SURE, it means I don't know how to do it
When I mark as CAN BE HANDLED, I can do it I think, just to clarify :)
Derek Melchin
Hi Ray,
The LSMA indicator doesn't utilize exponential regression to compute its indicator value, it uses linear regression. See the source code here. For convenience, I've attached a research notebook that demonstrates how we can fit an exponential regression model to sample data and calculate the R2 value.
Best,
Derek Melchin
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.
Ray Trader
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!