Hi, I was wondering if you could help me with the regression algorithm.
What is the trade logic out of the below algorithm.
How are you using the intercept.
Is trade logic based on a prediction?
Hi, I was wondering if you could help me with the regression algorithm.
What is the trade logic out of the below algorithm.
How are you using the intercept.
Is trade logic based on a prediction?
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 Andrew,
Thank you for your interest in this algorithm. We only use the slope, not the intercept term, for creating trading signals. Generally speaking, we use the slope to model the price trend of this equity. The detailed trading logic is as follows: (1) Get the slope of the linear model on the historical open prices for each symbol, (2) If the slope is over the buy threshold, then we enter the long position for this stock; if the slope is smaller than the liquidate threshold, then we just liquidate this stock. Besides, the weights for the stocks in the portfolio are equal. Hope it helps!
Hi Daniel!
Sincere thanks for the reply. Appreciate the support.
I have a couple of question regarding the structure of the algorithm.
Hi Andrew,
All of the answers to your questions can be found by actually reading the code:
Hi Douglas!
Thank you :)!
was very clear.
I am not sure about the detail of the regression. So are we regressing againest previous price data, with the model? The way I read your answer is that we are regressing a column of price data to a column of one's which does not make much sense?
Many thanks
Kind regards,
Andrew
Hi Andrew - from what I can tell, what's being done is a simple least-squares regression of price versus time (essentially like plotting the timeseries in Excel and doing "Add Trendline"). Then, the slope is being divided by the intercept and the resulting variable is called "slope" (not something I would personally agree with, but I didn't write the algo).
Daniel can fill in if this is not what's being done.
The column of ones indicates the weights that each price receives. If they're all 1s, all prices receive the same weight.
A few google searches for "sklearn linear regression examples" can point you to other examples of this regression, which might be helpful to see.
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!