Backtest vs Live trading - processing orders on Close

Back

Let's say I'm trading daily bars. I go long if today's close price closes above 10-day SMA, and close my long if closes below 10-day SMA. In backtests, I assume trades are executed exactly at close price. Since the close is available, the 10-day SMA, which is dependent on the most recent close, is also available.

In live trading, how is this logic actually carried out on QuantConnect? Since the Close is not known until market is closed, the 10-day SMA is not available until after market close. I'm writing an algo that trades at close and am wondering how to calculate my indicators so that I can evaluate them at market close....

Or are indicators updated continuously so that if I decide to trade 5 minutes before close, the 15:55 values are fed into my indicators?

Many thanks in advance.

Update Backtest







 
0

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.


Hi Che,

As the daily SMA is only updated when the market closes, it's not possible to trade at the close knowing what the new SMA value is. If we'd like to keep the algorithm trading daily bars, we can keep the strategy logic as-is, but we need to change the entry time. If we submit a market order when we receive a new daily bar, the order is filled at the market open.

Best,
Derek Melchin

0

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.


Update Backtest





0

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.


Loading...

This discussion is closed