Guide
How to Schedule a TradeZero Python Strategy on Windows
Schedule Alphanume and TradeZero Python jobs with Windows Task Scheduler, Eastern-time session checks, logs, duplicate protection and recovery steps.
A scheduler starts a program at a time. The program still needs to know whether the market is open, whether the job already ran, and what to do if it starts late. This guide schedules the Alphanume + TradeZero starter without putting broker keys into a task definition.
Download the Python starter, Windows wrapper, and offline tests. Extract it before running commands. The ZIP includes setup instructions and the complete source.
Complete the connection checks and read the exit workflow first. Alphanume provides the daily candidates; TradeZero executes the orders. The machine must remain awake, connected and able to run Python through the whole workflow.
Keep the clock and account consistent
For these trigger times, set Windows to Eastern Time (US & Canada) with daylight saving enabled. Python independently uses America/New_York. Do not mix an Eastern trigger table with a machine using a different local time zone.
Store credentials as user environment variables under the same Windows user that runs the tasks. Keep the extracted starter in one permanent folder, such as C:\Trading\alphanume-tradezero. A second copy would have different state files and would not share its duplicate-run protection.
Create three tasks
Open Task Scheduler and use Create Task. Set the program to powershell.exe and Start in to the extracted folder. Add weekday triggers as follows. The early triggers give the runner time to start; its own calendar decides when to act.
- Entry: 08:55 and 09:10 ET. The runner waits until 09:08 and will not submit at or after 09:24.
- Exit: 11:50 and 13:50 ET. It waits until 14:00 normally, or noon for a 13:00 early close.
- Reconcile: 16:10 ET. It checks fills and remaining starter positions without submitting orders.
Use these arguments for the entry task, replacing the path. The example budget is fictional and the task is a dry run.
-NoProfile -WindowStyle Hidden -File "C:\Trading\alphanume-tradezero\scheduled.ps1" -Job entry -Budget 500
For exit, replace -Job entry -Budget 500 with -Job exit. For reconciliation use -Job reconcile. Select Do not start a new instance, allow at least five hours for the exit task, and verify the account used to run each task.
With “Run only when user is logged on,” signing out prevents execution. Test the exact task under its intended user. If local PowerShell policy blocks your script, review that policy and the file with your administrator rather than silently disabling it.
Let Python handle the market calendar
def windows(opened, closed):
# Entry 09:08-09:24 ET; exit 14:00 normally or one hour before an early close.
entry = opened - timedelta(minutes=22)
cutoff = opened - timedelta(minutes=6)
exit_start = min(opened.replace(hour=14, minute=0), closed - timedelta(hours=1))
return entry, cutoff, exit_start
The opened and closed inputs come from the NYSE session calendar. Weekends and holidays return no session, so the entry and exit jobs do nothing. See the calendar library documentation for schedule and early-close behavior.
Check early-close residuals at the actual close too. A 16:10 report is after an early close and cannot manage a position that needed attention hours earlier.
Test dry runs before adding write switches
Right-click each task and choose Run. Inspect Last Run Result and the dated file under logs/. A waiting task should remain running until its target window. A preview should show proposed requests without any new broker orders or locate purchases.
For live operation, add -Expect Live -Submit to entry and exit. Add -AcceptLocateFees to entry only if you want it to pay for qualifying locates. Reconcile takes only -Expect Live. To check live data without writes, use -Expect Live alone.
Know what a restart will do
An account lock prevents overlapping processes using the same folder. Before the first live entry write, the runner saves a daily attempt marker. A second entry launch does not buy locates or submit the basket again. If the first attempt crashed halfway through, unfinished entries stay skipped for that day.
Exit restarts inspect the recorded order IDs and current position. Unknown outcomes stop for review. Never delete state/ to make a failed job run again. Preserve it, read the account, and resolve the recorded requests first. Create an empty HALT file to prevent new entries while allowing exits to continue.
Common questions
Does the backup trigger guarantee recovery?
No. It gives the runner another opportunity to start. It cannot restore power, network access or missing credentials, and uncertain brokerage outcomes still require inspection.
Will HALT cancel my existing orders?
No. It blocks new entries. Existing orders and positions remain at the broker; the exit workflow can continue.
Will I receive an alert if a job fails?
The starter writes a log and returns a failure status, but it does not send notifications. Monitor Task Scheduler and TradeZero directly, or add a separately tested alert integration.
For help constructing this setup, use the AI assistant prompts. The series overview explains the full day.
API documentation checked September 27, 2026. Route availability and account access can change. Examples describe the included starter; they do not establish trading performance.