I'm having some trouble with my FX trading algo. It trades only once per week but needs to open a position as soon as the US retail FX market opens on Sunday at 5pm. It's encountering the two following main issues.
1. "Warning: fill at stale price (05/15/2020 17:00:00 America/New_York)". Seems to still have this problem even if I push the scheduled Trade() function later on Sunday night. Ideally it would just behave the same as the market on open orders available to Equity markets.
2. The market order to open a position is being filled in the same bar as its take-profit/stop-loss order (resulting in "BrokerageModel declared unable to submit order"). I'm using the OCO implementation described here: Support for one-cancels-the-other order (OCO ) by Levitikon
I'm already using the highest resolution available and the width of the orders seems wide enough as suggested in the above thread?
Derek Melchin
Hi P Chen,
(1) The attached research notebook illustrates that there is missing data on 5/17/2020 from the open until 18:06. This is what causes the stale prices. I have submitted the data issue here.
(2) In the algorithm published above, both of the OCO orders submitted are deemed invalid. In the `TradeLong` method, the profit target is placed below the entry and the stop loss is placed above the current market price in this case. An issue here is that the profit target is set to Friday's close. So if the market gaps up on Sunday and stays above Friday's close, the long entry profit target will always be below our entry. The order placement logic needs to be reworked. Consider selecting their placement as a function of the trailing ATR.
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.
P Chen
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!