I'm trying to understand how to short and take profit with a momentum swing in the market using QC. This simplistic example implements the core of what I'm discussing. I want to short the market and then capture a certain number of basis points when the market drops in price. The statistics confuse me. How can I win 100% of the time and my average win be 0%? Am I shorting and capturing my short correctly here? Limit orders should gaurantee a price. My average win should be 10 basis points set in this algorithm.
1) Am I shorting and setting a limit around my short correctly?
2) How am I losing money when I win 100% of the time?
3) Why isn't my average win 10 basis points?
Derek Melchin
Hi Trevor,
#1 Yes, the limit orders are being set 10 basis points below the short entry price.
#2 The algorithm above has a negative net profit because the limit order of the final trade isn't filled before the end of the backtest. See the attached backtest for reference. When we exclude the last trade, the net profit is positive.
#3 The "Average Win" is 0% because it represents the average percent return on our winning trades. Since the return of the short trades is so small, the number gets rounded down to 0%. Refer to the source code here and here.
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.
Trevor Woods Richardson
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!