What Is a Program Order and How Do You Place One?
A program order is an order a computer program generates and sends automatically by rules written in advance; program trading is the whole process, and the program order is only the last order in it. You do not have to write the code yourself, but you need to understand the rules and backtest them with costs before the first order goes out.
By Soren Huang · Published · updated · Editorial policy
Contents
- What is a program order?
- How do you place a program order? The sequence from opening an account to the first order
- Do you have to write code for a program order?
- How does a program order differ from a conditional order?
- What order types and risk controls do program orders commonly use?
- How do you backtest a rule before placing a program order?
- Frequently asked questions
- References
What is a program order?
A program order is an order that a computer program generates automatically from preset rules and sends to the futures broker. You write the rules, start the program and reconcile afterward; when to enter, when to exit and how many contracts are all decided by the program. Program trading is the whole process. A program order is only the last order that chain sends out.
Take a program order apart and you find three separate layers. Strategy rules are entry and exit conditions you can state in plain words, for example “go long when the close is above the 20-day average and close out when it falls below”. The trading program is the software that turns those rules into steps a computer can run and re-evaluates them at the end of every bar. The order channel is the API or connection module your futures broker provides, which the program uses to send orders to the futures exchange. Keeping the three layers apart pays off in practice: when you lose money, it lets you tell whether the rule was bad all along, the program was written wrong, or the connection dropped. Common rule types such as trend following and mean reversion each backtest differently; Four common types of quant trading strategy and how their backtests differ lays them out.
One claim runs through this article: the value of a program order is not that it is automatic, but that the rule can be tested beforehand and reconciled afterward. A rule that has not been backtested, sent by program, only executes its mistakes faster and more punctually.
How do you place a program order? The sequence from opening an account to the first order
In Taiwan the sequence for placing a program order is fixed: open an account and enable program trading permission, install software that can take orders, load the strategy, run on a paper account for a while and reconcile, and only then switch to live trading. The most common result of doing the steps out of sequence is finding out in live trading that the number of contracts or the symbol code is set wrong.
- Open an account with a futures broker and enable program trading permission. Most futures brokers treat the API or program trading as a separate service, which needs an extra application and signed documents. Ask everything at account opening: which trading software is supported, whether the API has a fee, and how to apply for a paper account.
- Install order-taking trading software and connect. MultiCharts writes strategies in PowerLanguage and connects to the account through a connection module the futures broker provides. Touchance is order software that several Taiwan futures brokers provide to their customers, and it connects directly to that broker's account. Its features, fees and whether it can run strategies are covered neutrally in What is Touchance and which futures brokers support it. There is only one test for choosing software: it can connect to the futures broker where you opened your account.
- Load the strategy and set the symbol, contracts and session. The symbol code, contract month, contracts per entry and whether the program runs the night session are all fixed in this step, not adjusted at the open.
- Run on a paper account for at least several weeks and reconcile. Reconciliation means comparing, one by one, the entries and exits the program recorded against the fill reports the futures broker sends back, and checking that price, contracts and time agree. This step is the gate before live trading.
- Switch to the live account, with a daily maximum loss shutdown already set. Use the smallest size on the first day and repeat the reconciliation from step 4.
If you are starting with TAIEX futures, Program trading for TAIEX futures: zero to first strategy, no coding spells out each step above as Taiwan futures brokers actually handle it. If you want a practice plan with a timetable, First algo trading strategy: a 30-day route for beginners lays out account opening, backtesting, paper trading and live trading as a month-long schedule.
Do you have to write code for a program order?
You do not have to write code yourself, but you must understand the rules the program runs. There are three routes to a program order: write it yourself, use a strategy someone else wrote, or first generate and backtest rules without writing code and then export them as source code the platform can read. The three routes differ in how much code you write and how much you can see, change and judge.
| Item | Write the code yourself | Use a ready-made strategy | Generate rules without coding, then export |
|---|---|---|---|
| Do you need to code? | Yes | No | No |
| Can you see the full rules? | Yes | Partly (depends on whether the author publishes them) | Yes |
| Can you change the parameters? | Yes | Partly | Yes |
| Can you diagnose problems yourself? | Yes | No or partly | Yes, if you have read the rules |
Understanding the rules does not mean knowing how to code. It means being able to say in one sentence why each order was sent. The minimum bar is this: once you have a strategy, pick any three trades from the backtest yourself and, against the bars, explain which rule each entry and exit meets. If you cannot, you also cannot tell whether a fault lies in the rule, the program or the connection. On the third route, AlphaPrime (Valynox) exports the rules it generated and backtested as readable strategy source code, which you then load into a trading platform to send orders; for the platforms it supports, see trading platforms supported by strategy source code export. Once you have the source code, you still need to do the “pick three trades and check them against the rules” step from the previous paragraph yourself.
How does a program order differ from a conditional order?
Conditional orders and program orders are both automatic order placement. The differences are who evaluates, how many times, and who sends the order if the connection drops. A conditional order is a trigger condition you set by hand in the futures broker's order software, for example “sell 1 contract when the traded price reaches a given level”; whoever is watching quotes sends one order for you when the condition is met. A program order is your own program continuously reading quotes and re-evaluating the rule on every bar or every trade, deciding entry, adding and exit itself, with entry and exit linked to each other.
| Item | Conditional order | Program order |
|---|---|---|
| Who checks the condition | Futures broker's server (cloud conditional order) or your order software | Your own program |
| How many checks | Triggers once, then done | Re-checked on every bar or every trade |
| Entry and exit linked? | No, one conditional order maps to one action | Yes, the exit rule knows a position is open |
| If the computer disconnects | If the futures broker's server is watching, it still sends the order | The program stops; after reconnecting, reconcile before continuing |
| Suited for | A single stop loss, a single entry at a price | A whole strategy: entry, adding, exit, contracts |
Look closely at the disconnection row. A conditional order held on the futures broker's server still triggers when your computer is off; a program order stops along with your computer. This matters especially in the night session, because the program has to keep running until the early hours while you are asleep. The night session has thinner liquidity and larger slippage; After-hours trading explained: hours, liquidity, backtest pitfalls covers what that does to program-order fills and to backtests. A common safe practice is to use both: the program order runs the strategy, and a conditional order on the broker's server serves as a protective stop loss, which the program cancels as soon as the position is closed.
What order types and risk controls do program orders commonly use?
The four order types a program order usually sends are market, limit, stop and stop-limit, and each trades off between “the order always fills” and “the price is certain”. Risk control needs at least four items, written into the program's decision loop rather than relying on someone watching the screen. Start with order types. A market order asks to fill immediately at whatever price can be filled right now. A limit order names a price and fills only at that price or better. A stop order turns into a market order once the traded price touches the set level. A stop-limit order turns into a limit order after it triggers, which gives price certainty at the cost of possibly not filling on a gap.
| Order type | Always fills? | Price certain? | Common use in program orders |
|---|---|---|---|
| Market | Yes | No | Enter or exit immediately on a signal |
| Limit | No | Yes | Rest an order at a fixed price and wait for a fill |
| Stop | Yes, once triggered | No | Stop loss exit, breakout entry |
| Stop-limit | No | Yes | Avoid a wild fill price on a gap |
Backtest assumptions must match the orders the program actually sends. If a backtest assumes a limit order fills whenever price touches it, in live trading it often queues and never gets to the front. If a backtest fills at the close, a live market order takes slippage. These two gaps are what the weeks on the paper account are meant to surface through reconciliation.
There are four risk controls, and leaving out any one means the job is not done:
- Daily maximum loss shutdown. When the day's realized plus unrealized loss exceeds a preset amount, the program closes out and stops sending orders until it is restarted the next day.
- Maximum contracts cap. No matter how many entry signals the rule produces in a row, total position cannot exceed the cap. This one guards against duplicate orders when the program logic is wrong.
- Reconnection after a disconnect. When the program detects that the connection has dropped, it reconnects automatically and sends no new orders until the reconnection succeeds.
- Position reconciliation. After every order and after every reconnection, compare the position the program thinks it holds with the position the futures broker reports; if they disagree, shut down and let a person handle it.
Hypothetical example
An account of NT$500,000, a daily maximum loss shutdown set at NT$10,000 and a cap of 2 contracts. In the morning the rule enters long 1 contract; at noon another signal adds 1 contract; when the third signal appears, the program checks that it is already at 2 contracts and sends no order. In the afternoon the loss builds to NT$12,000, past the NT$10,000 shutdown line, so the program closes both contracts at market and stops sending orders until it restarts the next day. Nobody watched the market during the whole process, and each of the four rules blocked something once.
How do you backtest a rule before placing a program order?
Before any rule sends its first program order, run it through a backtest that includes commission and slippage and fills at the next bar, then check it with out-of-sample data and walk-forward analysis. A backtest replays the rule over historical prices to see which orders it would place and how they turn out. Costs are included because every program order really does pay them; next-bar fills are used because the program decides at the bar's close and cannot fill at that bar's closing price; out-of-sample means the stretch of history that took no part in choosing the rule, and only it can score the rule fairly.
Below is a real backtest report, used to show how to read one. It tests NQ (Nasdaq-100 futures) daily bars, from 2019-01-02 to 2025-06-30, long and short with 1 contract each, with $20 commission and $10 slippage deducted per trade. Entries and exits use a single ADX indicator rule, with no stop loss, no profit target and no filters. It is a stand-in rule built from a standard indicator, not the subject of program orders itself; it is used only because its structure is simple and easy to read.
Source: AlphaPrime product engine (CPU), run 2026-10-31. NQ daily, 2019-01-02 to 2025-06-30, long and short, 1 contract, $20 commission and $10 slippage per trade.
| Number | Result |
|---|---|
| Net profit (closed trades) | $102,875 |
| Max drawdown | $80,685 |
| Trades | 43 |
| Win rate | 58.14% |
| Profit factor | 1.436 |
| Average trade | $2,392.44 |
| Time in market | 41.52% |
How do you read these numbers? They are the one candidate the search kept, ranked by return to drawdown, after it tried 1,024 candidates. Picking the best of more than a thousand after the fact inflates the result by itself, and Bailey et al. (2014) work out clearly how much this kind of selection inflates it. So the net profit of $102,875 does not mean the ADX rule earned that money, and it is certainly not a number anyone can expect. What to look at is the proportions and the sample: the maximum drawdown of $80,685 is close to eighty percent of net profit, which means the rule has to absorb very deep pullbacks; 43 trades is few over six and a half years, and an average trade of $2,392.44 is easily swung by two or three big trades; time in market of 41.52% means it sat in cash for more than half of the days. These are the questions you have to answer for yourself before sending the first program order, and the report's job is to lay them out.

One full-period backtest is only the first gate. Two things come next. Hold back a stretch of history that took no part in selection as out-of-sample, run it with the same cost settings, and see how much of the average trade survives. Then use walk-forward analysis (choose parameters on one stretch of data, run them unchanged on the next, and roll forward and repeat) to confirm the result does not rest on one market phase; Pardo (2008) gives a full account of the method. In AlphaPrime, strategy validation makes walk-forward analysis a fixed step, and a strategy that fails an earlier check stops there, which keeps the number of candidates that reach the end small.
Your next step is concrete: take the rule you plan to run as a program order and run an out-of-sample backtest with the same settings as above ($20 commission and $10 slippage per trade, or your futures broker's actual fees, with next-bar execution). Write down three numbers: average trade, maximum drawdown and number of trades. Then decide whether to send the first program order.
Frequently asked questions
Are a program order and program trading the same thing?
No. Program trading is the whole process: writing the rules, writing or obtaining the program, connecting to the futures broker's order channel, and monitoring and reconciling. A program order is only the last order that process sends. In everyday speech the two get mixed up, but when something goes wrong you need to separate them, because a wrong rule, a wrong program and a wrong connection are fixed in completely different ways.
Does the computer have to stay on to run program orders?
Yes. A program order is decided and sent by your own program, so if the computer shuts down or disconnects, the program stops and no new entry or exit signals are sent. That is why the program needs reconnection after a disconnect and reconciliation after reconnecting, and why you can also place a conditional order on the futures broker's server as a protective stop loss, which still triggers when the computer is off.
Can you use program orders and conditional orders together?
Yes, and it is a common practice. The program order handles entry, adding and exit for the whole strategy; the conditional order sits on the futures broker's server as a protective stop loss for when the computer disconnects. Watch the sync between the two: cancel the conditional order as soon as the program closes the position, or the conditional order will open an opposite position when it triggers.
How long should a paper account run before switching to live?
Decide by reconciliation results, not by number of days. Run at least until the program has been through an open, a close, a contract month change and one disconnect-and-reconnect, and every fill the program recorded matches the futures broker's report. Switch to live only after several consecutive weeks of reconciliation with no differences. On the first day after switching, use the smallest size and repeat the same reconciliation.
References
- Bailey, D. H., Borwein, J., López de Prado, M., & Zhu, Q. J. (2014). Pseudo-Mathematics and Financial Charlatanism: The Effects of Backtest Overfitting on Out-of-Sample Performance. Notices of the American Mathematical Society, 61(5), 458–471.
- Pardo, R. (2008). The Evaluation and Optimization of Trading Strategies (2nd ed.). John Wiley & Sons.
- U.S. Securities and Exchange Commission. Stop, Stop-Limit, and Trailing Stop Orders (Investor Bulletin). https://www.investor.gov/introduction-investing/general-resources/news-alerts/alerts-bulletins/investor-bulletins-15
- U.S. Securities and Exchange Commission. Understanding Order Types (Investor Bulletin). https://www.investor.gov/introduction-investing/general-resources/news-alerts/alerts-bulletins/investor-bulletins-14

