VALYNOXSTRATEGY RESEARCH TECHNOLOGY
AlphaPrimeAlphaPrime
ACADEMY / Strategy generation

Automated futures trading: 6 things you need before going live

Automated futures trading is a loop in which written rules read each new bar, decide an order and send it to the broker without a human click. Before going live you need six things: written rules, price data, a broker link, capital sized for a drawdown worse than the backtest one, a fixed test sequence and risk limits that run without you.

By · Published · updated · Editorial policy

Contents
  1. How does automated futures trading work?
  2. How much capital do you need for automated futures trading?
  3. Do you need to write code to trade futures automatically?
  4. How do you test an automated strategy before going live?
  5. Which platform connects to a broker, and how does the order get there?
  6. Can automated futures trading run fully unattended?
  7. Frequently asked questions
  8. References

How does automated futures trading work?

Automated futures trading is a loop: written rules read each new price bar, decide an order and send it to your broker without a human clicking. To run it you need six things: written rules, price data, a broker link, enough capital for the drawdown, a test sequence and risk limits that work when you are away.

A thermostat is the everyday version of this loop. It reads the temperature, compares it with a written setting, switches the heater on or off, and does the same thing again a minute later. Nobody stands next to it. An automated futures system does the same with prices: a new bar arrives, the rules are evaluated at the bar close, an order goes out at the next bar open, and the position and risk are checked. Then the next bar arrives and the cycle repeats. Because the human is removed from every step, the quality of the written rules decides everything that follows; a bad rule is repeated with perfect discipline. If the idea of rule-based trading is new to you, what algo trading is and why most rules lose explains the ground it stands on.

The automated trading loop: a new bar arrives, the rules are evaluated at the bar close, an order is sent at the next bar open, position and risk are checked, and the loop repeats on every bar with no human click A loop on every bar Repeats every bar, no human click 1 New bar 2 Rules at close 3 Order at open 4 Risk check A bad rule repeats perfectly. So: write exact rules first.
The loop that runs on every bar. The first three boxes are the system; the fourth is the part that protects the account.

The six things split into two groups. The first three form the loop in the figure. The last three decide whether the loop survives contact with a real account.

Thing you needWhat it isWhat goes wrong without it
Written rulesEntry, exit and sizing conditions that a program can evaluate with no judgment callNothing can be automated; "buy when it looks strong" cannot run
Price dataHistorical bars for testing and a live feed for trading, both with the same session settingsThe backtest and the live system see different bars and make different decisions
Execution linkA trading platform connected to a broker that accepts the order types your rules useOrders are decided but never reach the exchange
Capital for the drawdownMargin plus a buffer for a losing stretch worse than the backtest showedThe account is stopped out by a drawdown the strategy would have recovered from
Test sequenceA fixed order of tests with pass rules written before each one runsYou go live on a result that was chosen after the fact
Risk limitsStops, a daily loss limit, a position cap, a connection check and a kill switchOne bad day or one dropped connection becomes an account-size loss

The sections below take the six in order. If you want a day-by-day plan for the first one, a 30-day route to a first algo trading strategy lays it out.

How much capital do you need for automated futures trading?

The account must cover the exchange margin plus a buffer for the worst drawdown the backtest showed, and because the live drawdown is usually larger than the backtest one, the drawdown figure sets the minimum, not the margin figure. Margin is the deposit the exchange and your broker require to hold one contract; it is the price of entry, not the cost of staying in the game. A drawdown is the fall from an equity peak to the following low before a new peak is made. Think of a car's fuel tank: you size it for the longest stretch without a petrol station, not for the first kilometre.

The reason the live drawdown is usually worse is selection. The backtest you look at is the one you kept, and you kept it partly because its drawdown was small over that one history. The run below makes this concrete. AlphaPrime (Valynox) searched 1,024 candidates on NQ daily bars from 2019-01-02 to 2025-06-30, long and short, one contract, using a MACD rule as the only entry and exit with no stop, target or filter. The one kept was chosen for its return against its drawdown, after the search had finished. The MACD rule is a stand-in built from standard indicators; it is not automated futures trading itself, it is an example of what a candidate looks like when it reaches this stage.

Source: AlphaPrime product engine (CPU), run 2026-10-31. NQ daily bars, 2019-01-02 to 2025-06-30, long and short, 1 contract, $20 commission and $10 slippage per trade.

NumberResult
Net profit (closed trades)$96,490
Max drawdown$41,205
Trades146
Win rate56.16%
Profit factor1.373
Average trade$660.89
Time in market17.7%

Picking the best of 1,024 after the fact flatters every number in that table, including the $41,205 drawdown. Bailey, Borwein, López de Prado and Zhu (2014) show that the best result from a large search is inflated by the search itself, and the inflation grows with the number of candidates. Nothing here says the MACD rule earned that money or that you would. What the box does give you is a starting point for the buffer: the account for one contract has to survive at least that drawdown, and more.

The contract size matters for the margin part. The E-mini Nasdaq-100 future is $20 per index point with a minimum tick of 0.25 points, worth $5.00 (CME Group contract specifications). Exchanges can change margin, tick and session values; read today's figures on the exchange's contract page, and use the free futures contract calculator to turn a point move into dollars for the contract you trade.

Account size for one NQ contract, not to scale: margin alone is a short bar, while the real need stacks margin, the backtest max drawdown and an extra buffer for a worse live drawdown Size for the drawdown One NQ contract, not to scale Margin only Check exchange page Real need Backtest Margin Drawdown Buffer Live drawdown is usually worse. So: fund the stack, not the margin.
Margin is only the bottom of the stack. The drawdown and its buffer are what decide the account size.

Hypothetical example

Suppose the exchange margin for one contract is $25,000 and the backtest max drawdown is $41,205. A trader who adds half again to the drawdown for a worse live run sets the buffer at $41,205 × 1.5 ≈ $61,800. The account minimum becomes about $25,000 + $61,800 ≈ $86,800 for one contract. A trader who is only willing to fund $50,000 does not trade a smaller buffer; the honest answer is that this strategy, at one contract, does not fit the account.

To read your own drawdown from an equity list, paste it into the free drawdown calculator, which also shows how long each recovery took. Recovery time matters as much as depth: a system that is under water for a year tests your patience as hard as it tests your account.

Do you need to write code to trade futures automatically?

You need a strategy written in a form the platform can run, and there are three ways to get there: write the code yourself, build the rules in a platform's rule editor, or generate the strategy and export its source code. Each route trades your time against your control in a different way, and none of them removes the need to understand what the rules do.

Three routes compared: writing your own code needs coding skill, gives full control, starts slowly and runs on one platform; a rule builder needs no coding, limits control, starts fast and runs on one platform; generating and exporting code needs no coding, gives full control, starts fast and runs on several platforms Who writes the code? Own code Builder Export Coding Control Start Runs on Needed None None Full Limited Full Slow Fast Fast One One Several Exported code is yours to read. So: review it before going live.
Three routes from an idea to a running strategy. The columns differ in who writes the code and where the result can run.
  1. Write the code yourself. You learn the platform's language and type every condition. You get full control and the slowest start, and every bug is yours to find. What Python algo trading needs and where it gets hard shows what this route costs in time when the language is a general-purpose one.
  2. Use the platform's rule builder. You pick conditions from menus and the platform writes the code behind them. The start is quick, and the rules are limited to what the menus offer. The strategy runs on that platform only.
  3. Generate and export source code. A research program searches rule combinations on your data, tests them, and writes the surviving strategy out as source code for a trading platform. You read the exported code before you run it, so the control is full, and the start is as quick as the review. AlphaPrime writes the kept strategy out as PowerLanguage for MultiCharts, Pine Script v6 for TradingView, EasyLanguage for TradeStation, NinjaScript for NinjaTrader, MQL4 for MetaTrader 4 and MQL5 for MetaTrader 5; the platform export page keeps the current list of supported platforms, which is the list to check before you pick a broker.

Whichever route you take, the rule must be exact. "Buy a breakout when volume is strong" is an idea; "buy at the next bar open when the close is above the highest high of the last 20 bars and volume is above its 50-bar average" is a rule. Turning ideas into rules is most of the work of building a system, and building a quantitative trading process step by step covers that translation before any code is written.

How do you test an automated strategy before going live?

Test in a fixed order, write the pass rule for each step before you run it, and let a failed step end the test there. The order is: a backtest with fees, slippage and next-bar fills; an untouched out-of-sample period; walk-forward windows; a simulated account for a set number of trades; and one contract live. Each step costs more time than the one before it, so a strategy that fails early saves you the later steps.

Five tests in order with a gate between each: backtest with costs, untouched out-of-sample period, walk-forward windows, simulated account, then one contract live; each gate has a pass rule written before the run, and a failed gate ends the test Five tests, five gates Gold gate: pass rule set first 1 2 3 4 5 Backtest Out-of-sample Walk-forward Sim account Go live A failed gate ends the test. So: no second look, no softer rule.
Five tests, five gates. The pass rule at each gate is written before the test runs, so the result is judged, not explained.
  1. Backtest with costs and next-bar fills. Commission and slippage are charged on every trade, and an order decided at the bar close fills at the next bar open, because that is the first price you could have traded. The NQ run above used $20 commission and $10 slippage per trade. Pass rule example: the average trade after costs is at least several times the round-trip cost.
  2. Untouched out-of-sample period. Out-of-sample data is the part of the history that was kept out of the search and is used once, with the rules unchanged. Pass rule example: the out-of-sample average trade keeps at least half of the in-sample average trade, and the sign does not flip.
  3. Walk-forward windows. Walk-forward analysis is a test that tunes settings on one stretch of history, runs them unchanged on the stretch that follows, moves forward and repeats (Pardo, 2008). Pass rule example: most windows are positive out-of-sample and no single window makes the whole result.
  4. Simulated account. The exported strategy runs on live bars with simulated money, through the same platform and broker connection you will use. Pass rule example: a set number of trades, say 30, with fills and signals that match what the backtest would have produced on the same bars.
  5. One contract live. The smallest real size, for a set number of trades, to see real fills, real slippage and your own reaction. Pass rule example: live slippage per trade within the figure you assumed in step 1.

The equity figure below is the product's report of the same NQ run. Look at the slope of the curve before and after the out-of-sample marker and at the depth of the shaded drawdowns: a strategy that only described noise in its search period usually changes shape at that line.

Compare the slope on each side of the out-of-sample marker and the depth of the drawdown shading. A shape change at the marker is the thing to look for.
Compare the slope on each side of the out-of-sample marker and the depth of the drawdown shading. A shape change at the marker is the thing to look for. NQ · daily · 2019-01-02 to 2025-06-30 · CPU engine backtest

Why write the pass rule first? Because after you see a result, you can explain almost any number. A drawdown looks "acceptable" once you know the net profit; a weak out-of-sample stretch becomes "a quiet year" once you want the strategy to pass. A rule written in advance takes that choice away from the version of you that has already fallen for the equity curve.

Which platform connects to a broker, and how does the order get there?

An order travels from the strategy code to a trading platform, from the platform to a broker connection, and from the broker to the exchange, so the platform you pick is decided by which broker it connects to and what order types that connection accepts, not by its chart features. A beautiful chart that cannot send a stop order to your broker is a chart, not a trading system.

An order travels from strategy code to trading platform to broker to exchange; the chain can break where the platform does not support the code, where the broker connection drops, and where the order type is refused Where an order can break Check each joint before going live Code Platform Broker Exchange ! ! ! No support Link drops Refused Each joint can break the order. So: check from the exchange back.
The chain an order travels. Each arrow is a place the chain can break, and each break has a different fix.

The chain has three joints, and each one is a question to settle before you fund an account:

JointWhat can breakWhat to check before going live
Code to platformThe platform does not run the language your strategy is written inThe strategy's source language is one the platform executes; the export list page names the platforms
Platform to brokerThe broker has no connection for that platform, or the connection drops during the sessionThe broker publishes a connection for the platform; the platform logs disconnections and tells you how open orders are handled
Broker to exchangeAn order type the rules use is not accepted, or is handled differentlyStop, stop-limit and bracket orders behave the way the strategy assumes, and whether stops rest at the exchange or on the broker's server

Work the chain backwards. Start from the exchange and contract you want to trade, find the brokers that clear it, see which platforms those brokers connect to, and only then decide where the strategy will run. Doing it in the other order, platform first, is how traders end up with a strategy that runs well in a simulated account and has no broker to send real orders to.

One more thing lives at the second joint: time zones and session settings. The platform's live bars must be built with the same session and time zone as the bars you backtested on. A strategy tested on bars that close at one time and run live on bars that close at another is a different strategy, and no gate in the previous section would have caught it.

Can automated futures trading run fully unattended?

A system can place orders without you, but it should never run without limits, and five layers of limits stop one bad day or one dropped connection from becoming an account-size loss. Think of fire protection in a building: a smoke detector, a sprinkler, a fire door, an alarm and the fire brigade. Each layer works when the one inside it has already failed, and the outer layers do not care why the fire started.

Five nested layers of protection from the inside out: per-trade stop, daily loss limit, position cap, heartbeat check and kill switch; the outer kill switch works even when the strategy logic is wrong Five layers of protection Kill switch Heartbeat check Position cap Daily loss limit Per-trade stop The outer layer works if logic fails. So: trigger each limit in simulation.
Five rings of protection. The inner ring belongs to the strategy; the outer ring belongs to you and works when the strategy is wrong.
  1. Per-trade stop. The largest loss one trade is allowed to take, placed as a resting order, not only as a condition the rules check at the next bar close.
  2. Daily loss limit. The loss after which the system takes no new trades until the next session. It caps a day in which the strategy is simply wrong about the market.
  3. Position cap. The maximum number of contracts the account may hold, enforced outside the strategy. It catches the bug that sends the same entry twice.
  4. Connection and data check. A heartbeat that confirms new bars are arriving and the broker link is alive. When it fails, the system knows it is blind and can stop sending orders.
  5. Kill switch. A kill switch is a single action, yours or automatic, that cancels all working orders and flattens every position regardless of what the strategy says. It is the only layer that works when the strategy logic itself is the problem.

The first layer is part of the strategy and gets tested in the backtest. The other four are not in the backtest at all, which is why traders forget them: nothing in a performance report shows what happens when the data feed stops at 03:00 with a position open. Set them up in the platform or at the broker, where they run even if the strategy crashes, and test each one on the simulated account by forcing the failure: unplug the network, send a duplicate entry, hit the kill switch with a position open.

Your next step: write the five limits down as numbers for your account before the simulated-account test begins, then trigger each one on purpose during that test and note what the platform did. A limit you have never seen fire is a limit you only hope exists.

Frequently asked questions

How much money do you need to start automated futures trading?

Enough to cover the exchange margin for the contracts you hold plus a buffer for a drawdown worse than the one your backtest showed. The backtest drawdown belongs to the candidate you kept, so the live one is usually deeper. Many traders add half again or more to the backtest drawdown and treat the total as the minimum for one contract; if that total does not fit the account, the strategy does not fit the account at that size.

Do I have to know how to code to trade futures automatically?

No, but you need a strategy written in a form the platform can run. You can write the code yourself, build the rules in a platform's rule editor, or generate the strategy and export its source code. The third route gives you readable code without typing it, and you still read it before it goes live.

Can an automated futures system run with nobody watching?

It can place orders without you, and it should still carry limits that run without you: a per-trade stop, a daily loss limit, a position cap, a connection check and a kill switch. These four outer layers are set at the platform or broker, not inside the strategy, so they work when the strategy itself is wrong. Test each one on a simulated account by forcing the failure before the system trades real money.

Which trading platform can connect to my broker?

Work backwards from the exchange and contract: find the brokers that clear it, see which platforms those brokers publish a connection for, and choose among those. Then confirm the connection accepts the order types your strategy uses, especially stops, and how it handles open orders when the link drops. The platform export page of AlphaPrime lists the platforms its exported strategies run on.

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.
  • CME Group. E-mini Nasdaq-100 Futures contract specifications (contract size $20 × index, minimum tick 0.25 index points = $5.00). cmegroup.com/markets/equities/nasdaq/e-mini-nasdaq-100.contractSpecs.html