Correctly handling different trading hours per asset

Posted By: MegaTanker

Correctly handling different trading hours per asset - 12/14/21 13:08

I wanted to live test a strategy the other day that trades different index CFDs but quickly had an order rejected because it was generated at the close of the last bar of the trading day, so I need to handle this within the script. Please let me know if this is the correct approach:

- The BR_FLAT flag is necessary, because otherwise the first selected asset is used to determine the trading hours based on when bars are unavailable in the history, which could end up "swallowing" legitimate bars from assets that have different trade hours.

- With BR_FLAT enabled, can I set asset-specific StartMarket and EndMarket times?

- If an order is generated at the close of the last bar before EndMarket, will this order be automatically delayed until the StartMarket open, or do I need to handle this in the script manually?
Posted By: jcl

Re: Correctly handling different trading hours per asset - 12/14/21 16:28

Yes, use BR_FLAT when you trade assets on different markets. Start/EndMarket are normally not needed, just check the market hours by script before entering a trade. When you want to skip price series or indicators outside market hours, use the NOSHIFT flag.
© 2024 lite-C Forums