10. Trading Schedule & EOD Terminator
Session Schedule (Terminal Local Time)
Each weekday has its own trading window:
Monday: Inp_Hours_Monday = "00:00-22:00"
Tuesday: Inp_Hours_Tuesday = "00:00-22:00"
Wednesday: Inp_Hours_Wednesday = "00:00-22:00"
Thursday: Inp_Hours_Thursday = "00:00-22:00"
Friday: Inp_Hours_Friday = "00:00-05:00" // earlier close — weekend risk
Format: "HH:MM-HH:MM" — multiple ranges per day can be entered, comma-separated, e.g. "09:00-12:00,15:00-20:00". Saturday and Sunday are automatically blocked.
EOD Terminator
An emergency mechanism for closing all positions at a defined time:
Friday: Inp_EOD_Time_Friday = "21:39"
Other days: Inp_EOD_Time_OtherDays = "22:29"
Algorithm with retry logic:
- Attempts to close all positions on the symbol
- If the broker rejects an order → waits 5 seconds → retries (up to 10 attempts)
- On success:
g_Last_EOD_Day = dt.day_of_year(does not repeat on the same day)
Log: "EOD TERMINATOR: Emergency closing all positions..." → "EOD SUCCESS: Closed position #123." → "EOD TERMINATOR: Chart cleared. Goodnight."
