Reading Parameter Surfaces
An optimization produces one row you were looking for and several hundred you were about to discard. The rows you were about to discard are the evidence. The one you were looking for is a summary statistic of a search you ran, and on its own it cannot tell you whether the search found something or merely found the largest number in a pile of noise.
This lesson is about looking at the whole pile. By the end you should be able to lay a two-parameter optimization out as a surface, open AmiBroker’s 3D chart correctly, tell a plateau from a spike and say why the distinction matters, name four specific mechanisms that put noise into a surface, and read a spiky surface as a statement about your data rather than about your rules.
What a surface is
Section titled “What a surface is”Two Optimize() calls give you a grid. One parameter runs along one axis, the other along
the second, and every intersection is one complete backtest of your whole universe over your
whole date range. Choose a metric — any column in the result list — and that metric becomes
the height of the grid at each point. A grid of heights is a surface.
Nothing about that requires three dimensions or a chart. A surface is just the result list re-laid-out so that neighbouring parameter values sit next to each other, which is exactly what a list sorted by profit destroys. The list tells you which cell was highest. The grid tells you what the region around it looks like, and that is the information you need.
AmiBroker’s 3D Optimization chart
Section titled “AmiBroker’s 3D Optimization chart”The built-in viewer draws the surface for you, with documented rules that are easy to trip over.
It needs exactly two Optimize() calls. Not one, not three. Run the optimization first,
then use the drop-down arrow on the Optimize button and choose 3D Optimization chart.
(Older guide text calls the same command “View 3D optimization graph”.)
It plots Net profit unless you tell it otherwise, and the way you tell it is unintuitive. There is no metric selector. To plot a different column you click that column’s header in the result list to sort by it — a blue arrow appears — and then reopen the 3D chart. The plotted metric follows the current sort column.
The viewer’s controls are documented: drag with the left mouse button to rotate, drag with the right to zoom, hold Ctrl and drag to translate, press Space to auto-rotate, use the arrow keys to rotate and the numeric keypad to zoom and pan. Page Up and Page Down move a “water level” that floods the surface below a chosen height — genuinely the most useful control in the viewer, because raising the water until only a few islands remain is a direct way of seeing whether your good results form one continent or an archipelago.
The guide’s own interpretive advice is worth stating in full, because it is unusually direct for vendor documentation. Robust settings are the regions showing gradual rather than abrupt changes in the surface; radical changes or spikes clearly show over-optimization; you should choose a parameter region that produces a broad and wide plateau; and parameter sets producing profit spikes will not work reliably in real trading.
Reading it flat
Section titled “Reading it flat”You do not need the 3D chart, and for careful work a flat grid is better: you can put numbers
in it, you can compare two of them side by side, and you can paste it into your research
notes. The result list can be copied out — the SetOption( "ExtraColumnsLocation", 1 )
documentation notes that moving the parameter columns changes the visual order only and not
the export or copy-paste order — so the usual route is to copy the list into a spreadsheet
and pivot it: one parameter down the rows, the other across the columns, your chosen metric
in the cells.
Here are two such grids. They are synthetic: I constructed them to show two shapes clearly, and they are not results from any market, any instrument or any real backtest.
Surface A — a plateau (illustrative, synthetic figures)
Section titled “Surface A — a plateau (illustrative, synthetic figures)”Target metric, arbitrary units. Fast period down the side, slow period across the top.
| Fast \ Slow | 90 | 110 | 130 | 150 | 170 |
|---|---|---|---|---|---|
| 10 | 0.55 | 0.61 | 0.64 | 0.60 | 0.52 |
| 15 | 0.68 | 0.81 | 0.86 | 0.79 | 0.66 |
| 20 | 0.74 | 0.89 | 0.94 | 0.88 | 0.71 |
| 25 | 0.70 | 0.85 | 0.90 | 0.83 | 0.69 |
| 30 | 0.59 | 0.72 | 0.75 | 0.71 | 0.58 |
The best cell is 20/130 at 0.94. What makes this surface interesting is not that cell but its neighbours: every cell adjacent to it is between 0.85 and 0.90, and the whole block from fast 15–25 by slow 110–150 sits in a narrow band. If you had been forced to pick blind from anywhere in that block, you would have got something close to the same answer.
Surface B — a spike (illustrative, synthetic figures)
Section titled “Surface B — a spike (illustrative, synthetic figures)”| Fast \ Slow | 90 | 110 | 130 | 150 | 170 |
|---|---|---|---|---|---|
| 10 | 0.31 | 0.28 | 0.35 | 0.22 | 0.29 |
| 15 | 0.24 | 0.41 | 0.19 | 0.33 | 0.26 |
| 20 | 0.36 | 0.22 | 1.87 | 0.27 | 0.31 |
| 25 | 0.29 | 0.34 | 0.25 | 0.38 | 0.23 |
| 30 | 0.33 | 0.21 | 0.30 | 0.24 | 0.35 |
The best cell is 20/130 at 1.87, five times its own neighbours. Sorted as a list, Surface B looks better than Surface A: its top row is much higher. As a surface it is obviously worse, and the reason is that its top row is not connected to anything.
Ask what it would mean to trade 20/130 from Surface B. Twenty and 130 were not chosen because theory says so; they were chosen because they scored highest. A fast period of 19 or 21 would have been an equally defensible choice a priori, and both score around 0.3. The result therefore rests entirely on a decision you had no independent reason to make. That is the definition of a fitted parameter.
Where the noise comes from
Section titled “Where the noise comes from”Surfaces are not smooth, and understanding why makes you better at reading them. Four mechanisms account for most of it.
Adjacent cells do not share all their trades. Two cells that differ by one step in one parameter share most of their signals, but not all: some crossovers happen a bar earlier, some marginal ones disappear, and a few trades exist in one cell and not the other. Metrics computed from a few dozen trades move noticeably when a handful of them change.
One trade can dominate. Trade outcomes are heavily skewed. If the best trade in a test accounts for a large share of the profit, then every cell where that trade fired scores well and every cell where it did not scores badly — and whether it fired can turn on a single bar. Sort your result list by the number of trades and look at the extremes: the cells with the fewest trades are the cells where this effect is largest, and they are disproportionately represented at both ends of a profit ranking.
Portfolio constraints reshuffle everything. In a portfolio backtest with a position limit,
signals compete. Change a parameter slightly, and a symbol that previously missed a slot now
gets one, which displaces a different symbol, which changes the cash available three months
later, which changes what happened in an entirely unrelated part of the test. Portfolio
surfaces are meaningfully noisier than single-symbol surfaces for this reason, and the
PositionScore line in your formula is a full participant in the effect.
Cells do not all test the same period. This one is subtle and specific to indicator
parameters. MA() returns Null until it has enough bars, so a cell using a 260-bar slow
average cannot produce a signal until 260 bars into your data, while a cell using a 60-bar
average starts two hundred bars earlier.
Two cells, two different effective test periods
If your data begins in 2010 and the market did something unusual in 2010 and 2011, cells with
short slow averages are exposed to it and cells with long ones are not. The fix is to start
the Analysis Range after the longest warm-up in your grid, so that every cell is judged on
the same history. Nothing in AmiBroker does this for you.
What a spiky surface is telling you
Section titled “What a spiky surface is telling you”The tempting reading is “this system is fragile”. The more useful reading is that the test was not able to distinguish between parameter settings, and there are only a handful of reasons why.
- Too few trades. With a few dozen trades in total and only a handful per cell, the metric is mostly sampling variation. This is the most common cause and the easiest to check.
- Too short a period, or too narrow a universe. One bull market is one observation. A surface computed over a single market phase describes that phase.
- One instrument dominating. If a single symbol supplies a large share of the trades, the surface is a study of that symbol wearing a portfolio’s clothes. Sorting the trade list by symbol answers this in seconds.
- A discontinuous rule. Rules with thresholds — cross above a level, close above the highest high of N bars — can flip on and off with a one-step parameter change in a way that smooth rules do not. Some spikiness here is structural rather than statistical.
Note what is not on that list: “the market changed”. It might have, but a spiky surface is not evidence for it, and reaching for that explanation is how a diagnostic result gets converted into a story.
Visualising without deceiving yourself
Section titled “Visualising without deceiving yourself”A few habits that make surfaces useful rather than decorative:
- Plot the metric you will judge on, not Net profit by default. Sort first, then open the chart.
- Look at a second metric on the same grid. A region that is a plateau in
CAR/MaxDDand a spike inNet Profit %is telling you something specific about how it earns. - Overlay the trade count. Build the same grid with the number of trades in the cells. Regions of the surface where the count collapses are regions you cannot interpret.
- Use the water level. Raise it until only ten per cent of the surface is above water and look at the shape of what remains. One continent is a result; scattered islands are a warning.
- Keep the grid. Paste it into your research notes with the universe, period and costs written above it. A surface you cannot reproduce in six months is a surface you cannot cite.
A two-parameter optimization is a surface, and the surface carries information that a sorted
list throws away. AmiBroker will draw it in three dimensions if you have exactly two
Optimize() calls, but it plots Net profit unless you sort by another column first, and a
flat grid in a spreadsheet is often the better tool.
A plateau — a broad, contiguous region whose cells behave alike — means your choice within that region barely matters, which is the only kind of parameter choice that is not a bet on your sample. A spike means the opposite: neighbouring values that were equally defensible before you ran the test do far worse, so the result depends on a decision you had no reason to make. Spikes come from thin trade counts, single dominant trades, portfolio slot competition and unequal warm-up periods, and they are most usefully read as statements about the test rather than about the rules.
The next lesson takes this one step further and asks the uncomfortable question directly: if the maximum is usually noise, what exactly should you report instead?
Check your understanding
Sources for this lesson
6 verified · checked 2026-08-31
- 01AmiBroker User's Guide — How to optimize a trading system§ Displaying 3D animated optimization chartsamibroker.com/guide/h_optimization.html2026-08-31
- 02AmiBroker User's Guide — Using New Analysis window§ Displaying the 3D Optimization Chartamibroker.com/guide/h_newanalysis.html2026-08-31
- 03AmiBroker AFL Function Reference — Optimizeamibroker.com/guide/afl/optimize.html2026-08-31
- 04AmiBroker AFL Function Reference — SetOptionamibroker.com/guide/afl/setoption.html2026-08-31
- 05AmiBroker AFL Function Reference — MAamibroker.com/guide/afl/ma.html2026-08-31
- 06AmiBroker User's Guide — Portfolio-level backtestingamibroker.com/guide/h_portfolio.html2026-08-31
Every technical claim on this page was checked against the official AmiBroker documentation on the date shown. Where the course disagrees with folklore, the source is how you can tell which one to trust.