Hi everyone,
this is my first attempt to work with QC and, even though I have done all the bootcamp, and watched several videos I cannot seem to get ahold of the 30 min timeframe consolidator.
I am trying to replicate this strategy I found online:
Now… I have identified 2 problems.
- I cannot seem to make the algo work with the 30 min timeframe. I worked with the same logic of the video on the 1h timeframe but the results were terrible. Not sure if it was because I have made some mistake while coding the algo (not an expert) or because the strategy doesn't work on the 1h timeframe. That needs further investigation and, I would say, at the moment I'm more concerned about the ability to work with 30 min timeframe.
- I cannot seem to set the leverage anywhere. I tried several things but I simply cannot push the algo to invest 2% of my account with a 200 leverage. If my calculations are correct, backtesting with 5000$ starting cash, the first trade shuld be investing 0.02 x 5000 x 200 = 20000 $. But when I check… it always enters the position with 100$. In the attached algo I commented it because I didn't want to mess with it anyways.
Can anyone help me please to understand what's wrong in my algo?
Thanks very much in advance.
Dario
Louis Szeto
Hi Dario
Note that the indicator you’re calling is non-warmed up and required manual updates, so we should not include an “if indicator.IsReady” condition in the indicator updating logic (in your consolidator handler), otherwise the indicators and rolling windows will never be updated as they are not ready in default.
Also, ATR and stochastic indicators have to be updated by QuoteBar. We believe that you’ll also need to break the last for-loop in the OnData method if any order is made. Please check the attached backtest for your reference.
Best
Louis
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!