Insights

Trader.AI for Experienced Traders: Exact Rules, Real Costs, Out-of-Sample Tests and MT5 EAs

November 19, 20269 min read|By Trader.AI Team

If you already trade with rules, Trader.AI is a fast way to test them through your AI: describe or paste a strategy, and it is compiled into an exact rule set, backtested bar by bar on historical MT5 data and returned with a full trade-level breakdown. This page covers how the engine works, what you control and where its limits are today.

How is a strategy defined?

Every strategy compiles to one rule document for one instrument and one timeframe, chosen when the backtest runs. It contains:

  • Parameters with ranges and optional constraints (for example, fast length below slow length).
  • Features: indicators and expressions computed on every bar. Built-ins include EMA and other moving averages, RSI, ATR, MACD, Bollinger Bands, Keltner and Donchian channels, DMI/ADX, Stochastic and Stochastic RSI, Supertrend, Williams %R, VWAP, OBV and Heikin Ashi, plus crosses, lags and arithmetic.
  • Rules in three classes, evaluated in order on each bar: risk, then exit, then entry. The first rule whose condition holds and whose action is possible fires. One order per bar at most.
  • Position management: stop loss, take profit, trailing stop and time stop.
  • Risk limits: maximum position size, maximum order size, maximum daily loss, a cooldown after exits and a maximum number of trades per day.

Every rule has a readable id, and each trade in the report shows the rule that opened it and why it closed.

How are orders filled?

  • Signals are evaluated on the closed bar; orders fill at the next bar's open.
  • Lookahead is rejected when the strategy is compiled: no expression can read a future bar.
  • Stops, targets and trailing stops trigger when price touches them. Gaps can fill beyond the level in live trading; the backtest notes this.
  • You set spread, commission and slippage per run. They default to zero, so add them before trusting a result.
  • Leverage is a backtest setting and defaults to 1:1. Risk-based sizing on forex or metals usually needs more (for example 1:100), or entries are rejected for margin. Rejections are reported with the reason.

What sizing and exits are supported?

ElementOptions
Position sizePercentage of equity, fixed lots, fixed notional, or risk-based (a share of equity at the stop)
Stop lossA price distance (typically ATR-based), a percentage of entry, or the risk-based sizing distance
Take profitA distance, a percentage, or a multiple of the stop distance (R)
Trailing stopStarts after a set number of R in profit, then only tightens
Time stopCloses after a set number of bars

How does parameter search work? (Pro)

You pick up to two whole-number parameters and a grid. Each setting is tuned on the first 70% of the period and ranked on the last 30%, which it wasn't tuned on. Settings whose in-sample results don't carry into the out-of-sample period, or that only work as an isolated peak, are flagged. The baseline always runs too, and nothing is saved until you choose a setting.

Can I test an Expert Advisor I already have?

Yes. Paste the .mq5 source into your AI and ask it to backtest the logic with Trader.AI. The logic is rebuilt as exact rules, and your AI tells you which parts can't be expressed yet instead of quietly dropping them.

How does the MT5 export work? (Pro)

The downloaded Expert Advisor is generated from the exact version you backtested and uses the same rule engine as the backtest, so the logic you tested is the logic that runs. Run it in the MT5 strategy tester or on a demo account before going live.

What are the current limits?

  • One position per strategy. Entries only fire when flat, so no pyramiding or scaling in yet.
  • Stops by distance, not by price level. A stop at "the previous bar's high" can be approximated with an exit rule, but that exits at the next bar's open, not intrabar.
  • Ten symbols (major forex pairs, gold, silver, NAS100, SP500, USOIL, BTC and ETH), history from 2025.
  • Maximum range per run depends on the timeframe, from 60 days on 1-minute bars to 9 years on 4-hour and longer bars, within the data history.

What does the report include?

Return, maximum drawdown, win rate, profit factor, Sharpe ratio, trade counts and an equity summary; every trade with entry, exit, size, profit, holding time, opening rule and exit reason; profit and loss by entry rule, exit reason and side; and entries blocked by risk limits or rejected by execution, with reasons. Every run gets a shareable report link, and every version is kept for comparison.

Backtests are hypothetical. Trader.AI never places trades and gives no investment advice.

Frequently Asked Questions

When do Trader.AI backtest orders fill?

Signals are evaluated on the closed bar and orders fill at the next bar's open. Stops, targets and trailing stops trigger when price touches them.

Can I add spread, commission and slippage?

Yes, per backtest. They default to zero, so set realistic values before relying on a result.

Does Trader.AI support pyramiding?

Not yet. A strategy holds one position at a time; entry rules only fire when flat.

How does Trader.AI avoid overfitting in parameter search?

Settings are tuned on the first 70% of the period and ranked on the last 30%, which they weren't tuned on. Settings that look overfit or only work as an isolated peak are flagged.

Is the exported MT5 EA the same as the backtest?

It is generated from the exact version you backtested and uses the same rule engine. Test it in the MT5 strategy tester or on a demo account first.

Related Resources

More Articles

Ready to see verified AI trading in action?

Every Bot on Trader.AI publishes its complete trade history. No fake results. No hidden losses.

View Leaderboard