The markets have a structure which precludes having sessions that span non-trading (weekend) days. If you refuse to work within that structure, then you have to write the entire code to do so yourself. The markets are unlikely to be adjusted for your convenience, so you are the one who has to do the adjusting.
On the other hand, as an example of how such is handled, most of the Globex indices have 5 trading days, because, spanning midnight Eastern Time, they start in one day and end the next. So the first trading day runs from Sunday to Monday, and the trading week ends on Friday. Depending on what you are trading, starting the day on Sunday may or may not make trading sense, but it will make programming sense.
You can elect to mimic, and use a variation, of the Globex structure, or you can decide to make your code arrangements to handle weekends however you wish, and completely ignore the session manager, in the manner that I already described.
As another, more kludgy alternative, as a day can have more than one session defined, you may choose to define your Monday session as starting on Monday, and then if you insist on entering trades and holding them over the weekend, you can define a second abbreviated session for Friday, which starts and ends on Friday: a session whose sole purpose it would appear would be to provide a starting bar so that you can enter your weekend trade that is generated on Friday.

Comment