For some reason my code is only exectuing one trade at the start date and time of the scheduled event. My thoughts are; does scheduled event only trigger once? Or maybe my stop loss and take profit are not working correctly, since the market should move 5 to 11 pips to trigger either the stop loss or take profit during the high volume overnight time. Attached my backtest for the code. Ideally I just want the code to run once per week at 3 AM for one trade.
Fireball
I have a few observations that maybe someone can shed some light on. 1), 3), and 4) seem like bugs.
1) I have it running 1 out of 6 months now, but then it just stops showing trades?
2) I also noticed that limit and stop markets don't cancel when one fills. Any way around this? I attempted to do it a backhand way shown at the end of the code, but it didn't work. Can this be implemented by the QuantConnect team?
3) Putting the schedule at several times other than (6,0) results in the backtest giving the first Market order as Market on Open order (even though I don't have a Market on Open order coded), What market schedule is the data on? Forex should be open from Sunday to Friday night US time. So calling a regular order anytime on Monday shouldn't be an issue.
4) How can I have -6000 unrealized and +337 net profit on my backtest results?
I attached my latest backtest if it helps.
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.
Fireball
Thanks for your feedback and comments! I've tried to implement the OCO, but the code doesn't seem to be entering the if statement in the def OnOrderEvent. Any ideas? See attached code.
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.
Fireball
I just went into debugger mode and put the break point at line 39, the market order. After this it did not go to def OnOrderEvent. Even though I watched the variable self.EntryTicket which was now set to 1: Order ID: (BrokerID:1) Filled Market Order for 100000 units of EURUSD Request Count:1 Response Count:1
Maybe Oanda is not supported by def OnOrderEvent ?
I also #23 and#32 to remove the schedule factor to help debug
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.
Fireball
I think I figured it out. Can someone please doublecheck my algorithm? Also to my comment in the intital post I think a "market order on open" shows when it's a holiday? Ie. January 1st? It happens in this backtest, even though I don't have a market order on open coded.
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.
Fireball
Looks like it's working, but I can only run buy or sell at once, not both at the same time.
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!