Hi,
I'm new here, and I've been testing this mean reversion short strategy.
Backtesting from 2020 give me around 350 trades, the one attached under here. But if i change to earlier years, I get fewer Total Trades the longer back I go. Testing from 2015 give about 200 trades, and from 2005 around 130 trades in Total. I can't see any reason for this happening…
It's set up with no leverage/margin, and the cash to trade seems to be available. Every trade is set to liquidate after 6 days, and it doesn't seem like any old trades are hanging around blocking anything.
Can someone test this code and see if it happens to you, and maybe see why? Thanks!
MildJoe
Also another issue;
I want to keep all the triggers/indicators on the Daily, but I want to send the order after open the next day, to trade 10min after open. This to avoid the overnight gap. It kicks me out of a lot of trades (even though I have set positionsize to 92% of "available positionsize". It also gives better control of the actual invested sum in each position.
Not sure how to implement this though….
MildJoe
I've tried moving around some code, maybe cleaning up a bit. Still… the attached code backtests from 2005 and gives 302 Total Trades. If you change the from-date to 2020,1,5 it gives 442 Total Trades. Feels like I'm not understanding some key concept here. I'd be happy to read up on it, but I don't understand what it is…
MildJoe
Just talking to myself here, but in case anyone stops by: i found the error. 😊
Rookie mistake (I'm also new to Python and coding).
Had to replace “ if symbol not in self.universe: ” in start of coarse filter with a check of .IsShort instead.
The former kicked me out of every Symbol that had been checked in the filter ever before. So a lot of trades on day 1, and from then on only newly created tickers could enter the universe.
MildJoe
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!