hi does anyone know what i'm doing wrong?
i'm not getting any errors but the algorithm isn't trading any futures contracts.
QUANTCONNECT COMMUNITY
hi does anyone know what i'm doing wrong?
i'm not getting any errors but the algorithm isn't trading any futures contracts.
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.
Ernest Shaggleford
Hi Apollos,
there were a few bugs that I found:
1. The futureNQ setfilter was using futureES variable
2. filter period was too short at 35d. Futures have quarterly expirations so need at least 90d.
3. some variables were not using self. reference
May I suggest that when debugging to log the raw OnData slice data to check any filters are working as intended.
-ES
Apollos Hill
wow thanks!. i need to brush up on my futures fundamentals . I never would have noticed the 35 day thing. I trade forex and options. never done futures. i appreaciate your help ES.
Ernest Shaggleford
No problem. Always fun to work out why things don't work :) Pay it forward if you get a chance.
Apollos Hill
Hi ES ,
thanks! i will see who i can help out on the forums! I am getting a wierd issue that i shouldn't be..i am trading over a thousand orders per trading signal...but i'm using IF not self.portfolio[self.front.symbol].IsShort/IsLong.. then initiate trade... i think the problem is in my liquidate IF statement. what do you think?
Jack Simonson
Hi Apollos,
I looked at the second backtest posted above and was replicating the problem where there were no futures contracts being returned, but it sounds like you've fixed that and now are encountering a different issue. Can you attach a backtest or the code that you're running so myself or someone in the community can assist you in debugging the algorithm?
Apollos Hill
Hi Jack. Thanks for your willingness to help. Here is my backtest from a couple weeks ago. I have since taken a break on it. I'm not finding any ES/NQ contracts to trade. I commented out the WTI /Brent code so i can focus on one pair at a time.
Jack Simonson
Apollos,
The first thing I noticed is that the logical conditions where the algorithm checks for the contract chain ticker (see the snippet below) are where things are breaking down. The Symbol given by chain.Key.Value is a full ticker but Futures.Indices.SP500EMini or NASDAQ100EMini are strings but just the prefix 'ES' or 'NQ', and so checking for logical equivalence will return False every time. The full list of Futures ticker prefixes can be found here. So what needs to occur, then, is filter contracts by checking if the symbol contains the proper prefixes. I've attached a backtest that is a skeleton if what your code is right now but outlines how to carry out the same general strategy of trading the front contracts and taking positions based on the contract symbol. Hopefully this will help you with the WTI/Brent section of the algorithm.
Apollos Hill
Thanks for explainig this Jack!
Apollos Hill
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!