Hi everyone,
The parameter optimization feature was recently shipped and I wanted to share a simple long/hold strategy that utilizes it. We build our algorithm in the algorithm framework and we aim to optimize our take-profit parameter.
First, we need to add a new parameter in Algorithm Parameters which can be found here:
Once we do this, call self.GetParameter("take-profit") in our initialize method to get our value. It is important to note that although you may be able to call GetParameter in your Alpha Model or any other module, you will be unable to optimize the parameter unless it is called in the initialize method.
Now let's start optimizing our parameter:
First, we select our optimization strategy and our target. Currently, Grid Search is the only optimization strategy available.
The second step is to constrain our take-profit parameter between 0.01 and 0.1 and to set our step count to 0.01 decimals. Therefore, we will have 10 backtests.
Lastly, we select our nodes and receive a cost estimate. You can click on each node and read a small description below it to better understand its optimal use.
And now we have our optimized parameter! take-profit = 0.04
Jared Broad
You beat me to it! =D Thank you for sharing a demonstration
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.
.ekz.
Fantastic work, guys.
I just joined recently, and optimization is a core part of my algo design workflow, so this is amazing to see.
Looking forward to using it once I am done with bootcamp!
Dexter Llait
But how can we compare the backtest result?
Is there any suitable way?
Dresdner
Can we optimize more than 2 parameters? I cannot add more than 2 parameters - it is not useful at all with such constraints.
Derek Melchin
Hi Dresdner,
Refer to this related thread.
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.
Jovad Uribe
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!