Skip to content

Glossary

Terms are defined the way this course uses them, which is sometimes narrower than common usage and occasionally at odds with it. Where a word is genuinely ambiguous in the wider literature, the entry says so.

Each entry links to the lesson that teaches the concept, and “see also” links resolve within this page. If a “see also” ever points at a term that is not here, the page renders a build warning rather than a dead link.

A

Adjusted dataalso: back-adjusted data

Price history restated so that corporate actions — splits, dividends, consolidations — do not appear as price moves. Unadjusted data manufactures gaps, breakouts and volume spikes on the bars where the action occurred, which is exactly what many studies are looking for. Adjustment is done by the data vendor, and different vendors do it differently.

See also:Corporate actionData qualitySurvivorship biasTaught in:Part 2 — Splits, Dividends and Adjusted Data

Advance/decline linealso: A/D line

A running total of the number of instruments that rose minus the number that fell, computed across a defined universe. A description of how widely a move was shared, not a forecast.

See also:BreadthCompositeUniverseTaught in:Part 16 — Breadth Concepts: Participation and Its Measures

AFLalso: AmiBroker Formula Language

AmiBroker's formula language. Array-oriented: almost every variable holds one value per bar, and an operation applies to every bar at once. Understanding that model is the single most important thing in learning it.

See also:ArrayArray modelBarTaught in:Part 8 — What AFL Is and Where It Runs

Alert

A notification raised by AlertIf() when a condition becomes true, appearing in the Alert Output window and optionally as a sound or an email. In this course the chain ends at alert → human review → decision; nothing is automated.

See also:SignalReal-time dataTaught in:Part 25 — Alert Mechanisms and AlertIf()

AmiQuote

The quote-downloader program bundled with the AmiBroker installer. Fetches free end-of-day data from several internet sources.

See also:End-of-day dataDatabaseTaught in:Part 3 — Importing and Updating Market Data

Analysis windowalso: New Analysis window

The AmiBroker window that runs a formula across many symbols in one of four modes: Scan, Exploration, Backtest and Optimization. Its Apply To and Range settings live in the dialog rather than in the formula, which is why results are so often irreproducible.

See also:ScanExplorationBacktestOptimizationAPX fileTaught in:Part 12 — The Analysis Window and Its Four Modes

APX filealso: Analysis Project

A self-contained Analysis Project file holding the formula together with every setting, including Apply To and the date range. The reliable way to make a run reproducible, and what the Batch window operates on.

See also:Analysis windowBatch windowReproducibilityTaught in:Part 12 — Exporting Results and Building a Daily Workflow

Array

A series of values, one per bar. In AFL, Close, MA( Close, 50 ) and Close > MA( Close, 50 ) are all arrays. Operations are element-wise: comparing two arrays produces an array of Booleans, not a single true or false.

See also:Array modelBoolean arrayScalarBarTaught in:Part 8 — The Array Model: The Most Important Lesson in This Course

Array model

AFL's central idea: a formula describes a calculation applied to every bar simultaneously rather than a loop over bars. It is why if( Close > Open ) is an error and IIf( Close > Open, x, y ) is not, and why almost every beginner mistake in AFL is a scalar/array confusion.

See also:ArrayScalarBoolean arrayVectorised thinkingTaught in:Part 8 — The Array Model: The Most Important Lesson in This Course

ATRalso: Average True Range

A volatility measure: an average of the true range, which is the greatest of the current bar's range, the distance from the previous close to the current high, and the distance from the previous close to the current low. Used throughout this course to make distances comparable across instruments. Note that TrueRange() is not an AFL function; ATR( 1 ) is the documented single-bar equivalent.

See also:VolatilityNormalisationPosition sizingTaught in:Part 10 — Project: ATR Volatility Indicator

B

Backfill

Historical bars supplied by a real-time plug-in when AmiBroker first touches a symbol. How far back it reaches is the single most consequential number in a vendor comparison, and the one vendors are vaguest about.

See also:Real-time dataIntraday dataPlug-inTaught in:Part 17 — Delayed, Real-Time and Historical Data

Backtest

A simulation of trading a rule set over historical data. Not a measurement: a stack of assumptions with a number printed on top. A backtest result means nothing without the universe, period, costs, fill assumption, data source and sizing model attached.

See also:Portfolio backtestLook-ahead biasExposureWalk-forward analysisTaught in:Part 28 — Backtester Basics: Signals and Trade Prices

Bad tick

A print that no chart should show — an erroneous or out-of-context trade. Some feeds filter them and some deliberately do not, passing the tape through as received. Whatever filtering a plug-in offers applies to the incoming stream; prints already in your database are a separate job for a quality scan and the Quote Editor.

See also:Data qualityPlug-inReal-time dataTaught in:Part 18 — Appendix: IQFeed

Bar

One period of price data, summarised as open, high, low, close and volume. A bar hides everything about the order in which prices occurred inside it — which is why a backtest cannot know whether a high or a low came first.

See also:OHLCVIntervalTimeframeTickTaught in:Part 2 — OHLCV and What a Bar Hides

Bar Replay

AmiBroker's facility for stepping historical data forward one bar at a time, as though it were arriving live. The basis of this course's Level A path for every real-time topic. GetPlaybackDateTime() returns the playback position, or zero when replay is not running.

See also:Real-time dataLevel ADecision logTaught in:Part 26 — Bar Replay: Mechanics and Honest Limits

Base interval

The finest bar size a database stores. Every higher interval is compressed from it on demand. Choosing it decides both what analysis is possible and how much disk and memory the database consumes.

See also:DatabaseIntervalTimeframeTaught in:Part 19 — The Base Interval Decision

Base rate

What happened on average without the condition — the unconditional outcome over the same universe and period. A conditional result is uninterpretable without it: a positive average after breakouts in a market that rose is evidence that the market rose.

See also:Reality checkNull modelBenchmarkTaught in:Part 12 — Reality Check: Do High-Volume Breakouts Lead Anywhere?

Batch window

AmiBroker's automation facility, introduced in version 6.20. Runs sequences of Analysis operations from saved APX project files, with steps for exporting results, running external programs, importing data and more.

See also:APX fileAnalysis windowTaught in:Part 12 — Exporting Results and Building a Daily Workflow

Benchmark

The thing a strategy result is compared against. A benchmark measured over a different universe compares two universes at least as much as it tests the strategy; the benchmark that isolates a rule is passive ownership of the same instruments over the same period paying the same costs.

See also:Base rateBuy and holdUniverseTaught in:Part 28 — Reality Check: Is the Golden Cross Worth Anything?

Boolean array

An array of true/false values, one per bar, produced by a comparison. Close > MA( Close, 50 ) is not one answer — it is a series of answers, one for every bar in the loaded range.

See also:ArrayArray modelStateSignalTaught in:Part 8 — Boolean Arrays: Close > MA(Close, 50)

Breadth

How widely a market move is shared across the instruments in a universe: how many rose, how many are above a moving average, how many made new highs. A description of participation, and only meaningful over the universe it was measured on.

See also:Advance/decline lineCompositeUniverseMarket regimeTaught in:Part 16 — Breadth Concepts: Participation and Its Measures

Breakout

Price moving beyond a defined level — typically the highest high or lowest low of a look-back window. The word is meaningless until the level and the window are stated, which is why every study in this course defines them numerically.

See also:Support and resistanceTriggerSetupTaught in:Part 5 — Breakouts, Failed Breakouts and Role Reversal

Buy and hold

Owning an instrument for the whole test period. As a benchmark it must pay the same costs and cover the same universe as the strategy it is compared with; removing its costs to be "fair" destroys the comparison, because the cost difference is the economic argument against trading.

See also:BenchmarkExposureCostsTaught in:Part 28 — Reality Check: Is the Golden Cross Worth Anything?

C

CAR/MaxDD

Compound annual return divided by maximum system drawdown. A single figure combining growth and pain, and like every single figure it discards information — two systems with the same ratio can have very different drawdown shapes.

See also:DrawdownRisk adjusted returnBacktestTaught in:Part 29 — Risk Metrics: Drawdown and Its Relatives

Chandelier exit

A trailing stop placed a fixed number of ATRs below the highest high since entry. Implemented in AFL as a single ApplyStop( stopTypeTrailing, stopModePoint, mult * ATR( n ), style, True ) call, where the volatile argument is what lets the distance follow ATR during the trade.

See also:StopTrailing stopATRTaught in:Part 28 — Stops with ApplyStop()

Chart pattern

A named shape in price data. The difficulty is not whether patterns exist but whether they can be defined objectively enough that two people identify the same instances — which is the precondition for testing any claim about them.

See also:Support and resistanceReality checkHypothesisTaught in:Part 7 — Classic Chart Patterns

Commission

A broker's fee, charged on entry and again on exit. Set in AFL with SetOption( "CommissionMode", n ) and SetOption( "CommissionAmount", x ). The documented modes are a portfolio-manager table, a percentage of trade value, a currency amount per trade, and a currency amount per share.

See also:CostsSlippageSpreadTaught in:Part 28 — Costs: Commissions, Slippage and the Spread

Compositealso: composite ticker

An artificial symbol built by AddToComposite() during a Scan, storing a value accumulated across a universe. Composites are stored data, not live calculations, so they must be rebuilt after every data update.

See also:BreadthScanUniverseTaught in:Part 16 — Building Composites with AddToComposite()

Corporate action

A split, dividend, consolidation, merger or similar event that changes an instrument's price series for reasons unconnected with supply and demand. Unadjusted data records these as price moves.

See also:Adjusted dataData qualitySurvivorship biasTaught in:Part 2 — Splits, Dividends and Adjusted Data

Costsalso: transaction costs

Everything that makes a trade cost more than the quoted price: commission (a fee), spread (you buy at the ask and sell at the bid) and slippage (a worse price than you aimed at). A commission is deducted from the account; spread and slippage change the trade's own arithmetic and therefore belong in the price arrays.

See also:SlippageSpreadCommissionTaught in:Part 28 — Costs: Commissions, Slippage and the Spread

Cross

Cross( a, b ) is true on the one bar where a first becomes greater than b having previously not been. The difference between it and a > b is the difference between an event and a state, and confusing them is why a scanner returns the same names every day.

See also:EventStateSignalTriggerTaught in:Part 9 — State versus Event: The Distinction That Breaks Formulas

Curve fitting

Adding complexity to a model until it describes the particular wiggles of one sample rather than any general behaviour. A rule that excludes exactly the three worst trades is curve fitting. Distinct from optimisation, which becomes curve fitting when the number of things tried grows large relative to the independent information in the data.

See also:Data snoopingOverfittingDegrees of freedomParameter surfaceTaught in:Part 30 — Data Snooping, Curve Fitting and Overfitting

D

Data quality

Whether the data says what happened. Missing bars, bad prints, zero volumes, unadjusted corporate actions and misaligned time stamps all produce confident and wrong conclusions, and a study is a very efficient machine for converting bad data into them.

See also:Adjusted dataBad tickCorporate actionTaught in:Part 2 — Data Defects in Practice

Data snoopingalso: data dredging

A property of a whole research process: how many specifications were evaluated against one dataset in total, including every abandoned attempt, every universe swapped and every date range moved. Test enough ideas and something will look excellent whether or not anything is there.

See also:Curve fittingOverfittingResearch logDegrees of freedomTaught in:Part 30 — Data Snooping, Curve Fitting and Overfitting

Database

AmiBroker's store of symbols and quotes, with a base time interval fixed at creation. The base interval determines what can be compressed from it: higher intervals are built upward from the base, never downward.

See also:Base intervalIntervalAmiQuoteTaught in:Part 3 — Databases and the Base Time Interval

Decision log

A written record of each decision made at a live or replayed decision point: what the alert said, the context, the decision, the reason, and what would have changed your mind — all written before the outcome is known. The only evidence in a research process about the discretionary layer sitting on top of the rules.

See also:Research logBar ReplayAlertTaught in:Part 37 — Component 5: Real-Time or Replay Workspace

Defensive AFL

Writing formulas that fail loudly rather than producing a plausible wrong answer: validating parameters, guarding division, handling Null explicitly, checking bar counts, and choosing — per condition — what a missing value should mean.

See also:NullNzWarm-upIsFiniteTaught in:Part 11 — Defensive AFL: Guarding Against Bad Input and Bad Data

Degradation

How much worse an out-of-sample result is than the in-sample result that produced its parameters. Some degradation is expected; the useful question is how much, and whether the selected parameters were stable.

See also:Walk-forward analysisOut-of-sampleOverfittingTaught in:Part 32 — Interpreting Out-of-Sample Degradation

Degrees of freedom

Every choice in a strategy that could have been made differently: each numeric parameter, each rule included or excluded, the universe, the date range, the exit design, the sizing rule, the ranking rule and the costs assumed. Routinely undercounted by an order of magnitude.

See also:Data snoopingCurve fittingResearch logTaught in:Part 30 — Data Snooping, Curve Fitting and Overfitting

Drawdown

The decline from a peak in the equity curve to the subsequent trough, expressed in currency or as a percentage. Maximum system drawdown is the worst such decline over a test. It is the number that decides whether a strategy is survivable, and it is systematically understated by optimistic fill assumptions.

See also:Equity curveRisk of ruinCAR/MaxDDTaught in:Part 34 — Drawdown and Risk of Ruin in Practice

E

End-of-day dataalso: EOD data

One bar per trading day. Sufficient for every part of this course except live intraday work, available free from several sources, and the basis of the Level A path.

See also:Intraday dataLevel AAmiQuoteTaught in:Part 18 — Free and End-of-Day Sources with AmiQuote

Equity curve

Account value over time in a simulation. A smoothly exponential equity curve is usually a warning rather than a triumph: real portfolio equity is lumpy, and the smooth version often means positions grew into instruments that could not have absorbed them.

See also:DrawdownBacktestPosition sizingTaught in:Part 29 — Equity Curve Analysis

Error 42

AmiBroker's error when an #include fails: wrong path, unset standard include path, or a different extension. The correct response is to fix the path, never to paste the file's contents in — which creates a second copy that will silently diverge.

See also:Include fileLibraryTaught in:Part 11 — Include Files and Building a Library

Event

Something that is true on one bar — the bar on which a condition first became true. Cross() produces events. The counterpart of a state.

See also:StateCrossTriggerSignalTaught in:Part 9 — State versus Event: The Distinction That Breaks Formulas

ExitAtStop

The fourth argument of ApplyStop(), and the setting that most often makes a backtest fiction. Value 0 checks the trade price only; value 1 checks the bar's high–low range and fills at exactly the stop level, including on bars that gapped straight past it; value 2 checks the range but exits on the next bar at the regular trade price. On daily data, 2 is the defensible default.

See also:StopGapBacktestSlippageTaught in:Part 28 — Stops with ApplyStop()

expandLast

The default and causally safe expansion mode: a compressed value appears on the last bar of its period, which is when it exists. expandFirst publishes it on the first bar — a weekly high on Monday — and is the mode that can look into the future. expandPoint writes only the last bar and leaves the rest Null.

See also:TimeFrameExpandTimeFrameGetPriceLook-ahead biasTaught in:Part 14 — Expansion Modes and the Look-Ahead Trap

Exploration

An Analysis mode that produces a table defined by Filter and AddColumn(). Distinct from a Scan, which reports where signal arrays are true. Explorations are how this course measures things.

See also:ScanFilterAnalysis windowBacktestTaught in:Part 12 — Exploration: Filter, AddColumn and AddTextColumn

Exposure

The fraction of the test period during which capital was actually at work. Two systems with different exposures cannot be compared on return alone — which is what Risk Adjusted Return exists to correct. Read it before any return figure.

See also:Risk adjusted returnBacktestBenchmarkTaught in:Part 29 — Return Metrics: Net Profit, CAR, RAR and Exposure

F

Filter

The reserved AFL variable that decides which bars an Exploration reports. Filter = Status( "lastbarinrange" ) gives one row per symbol; Filter = Condition gives one row per qualifying bar.

See also:ExplorationStatusTaught in:Part 12 — Exploration: Filter, AddColumn and AddTextColumn

Foreign

Reads one price field from another symbol, aligned to the current symbol's bars. That alignment is the part people forget: bars the current symbol did not trade are silently dropped from the foreign series.

See also:SetForeignRelative strengthBenchmarkTaught in:Part 15 — Foreign(), SetForeign() and RestorePriceArrays()

G

Gap

An opening price away from the previous close, with no trading in between. Gaps are why a stop is not a guarantee: an order resting at a level that the market opened beyond was never available at that level.

See also:StopExitAtStopSlippageTaught in:Part 4 — Chart Types and What Each One Shows

Global

AFL's default scope. A variable assigned inside a function is visible outside it unless declared local, which is the source of the most confusing bugs in reusable AFL.

See also:LocalUser-defined functionLibraryTaught in:Part 11 — Variable Scope: local, global and the Traps

Golden cross

A shorter moving average crossing above a longer one — conventionally 50 and 200 days. Widely reported as marking the start of a major uptrend, a claim that is untestable as stated and becomes testable only once the universe, holding period, costs and benchmark are specified.

See also:Moving averageReality checkBenchmarkTaught in:Part 28 — Reality Check: Is the Golden Cross Worth Anything?

H

Hypothesis

A claim stated so that it could be false, naming the population, the event and the measurable consequence. "Momentum works" is not one. The recurring spine of this course is hypothesis → rules → test → evidence → risk → decision.

See also:Reality checkResearch logRefutation criterionTaught in:Part 27 — From Observation to Hypothesis

I

Include file

A file of AFL brought into another formula by #include or #include_once. The one place in AFL where a path takes single backslashes. A failed include reports Error 42, and the correct response is to fix the path rather than paste the contents in.

See also:LibraryLocalError 42Taught in:Part 11 — Include Files and Building a Library

Indicator

A transformation of past market data into another series. Not a prediction machine, not a signal, and not independent evidence when several indicators are computed from the same price series.

See also:ArrayOscillatorMoving averageNormalisationTaught in:Part 6 — What an Indicator Actually Is

Interval

The concrete bar size — inDaily, five-minute, weekly. Distinct from timeframe, which is the conceptual horizon. Interval() returns it in seconds; Interval( 2 ) returns its name.

See also:TimeframeBarBase intervalTaught in:Part 2 — Timeframes, Ticks and How Bars Are Built

Intraday data

Bars finer than daily. Storage grows quickly as the base interval shrinks, and history depth from any vendor is far shorter than for end-of-day data. Historical intraday data needs no live feed and supports the Level A path for most real-time topics.

See also:Base intervalEnd-of-day dataLevel ABackfillTaught in:Part 19 — The Base Interval Decision

IsFinite

Returns non-zero when a value is not infinite. The guard for division, because a zero denominator produces an infinity that plots as a spike looking exactly like a discovery.

See also:NzDefensive AFLNullTaught in:Part 11 — Defensive AFL: Guarding Against Bad Input and Bad Data

L

LastValue

Returns the last element of an array as a scalar. The usual way to reduce an array to a number so that an if can use it — and choosing which reduction to apply is choosing what the test means.

See also:ScalarArraySelectedValueTaught in:Part 9 — Counting and Accumulating: BarsSince, Cum, Sum

Level A

This course's term for the no-subscription data path: free end-of-day data, any historical intraday data you have, and Bar Replay. Every part of the course, including the capstone, is completable at Level A.

See also:Bar ReplayEnd-of-day dataReal-time dataTaught in:Part 17 — Edition Requirements and the Three Access Levels

Library

A file of reusable AFL functions brought in with #include. Holds decisions you want to make once — safe division, warm-up guards, normalisation — and not trading rules, which become rules you forget you are running.

See also:Include fileLocalUser-defined functionTaught in:Part 11 — Project: Your Personal AFL Utility Library

Liquidity

Whether an instrument trades enough for a position to be entered and exited near the quoted price. Usually measured as median turnover — Close * Volume — over a look-back window, and a median rather than a mean because one rebalance day can be twenty times a normal one.

See also:TurnoverParticipationSlippageTaught in:Part 12 — Building Screening Filters That Mean Something

Local

The AFL declaration that keeps a variable assigned inside a function invisible outside it. Without it, two library functions using the same variable name interfere depending on call order — the failure mode a naming convention cannot prevent.

See also:LibraryUser-defined functionGlobalTaught in:Part 11 — Variable Scope: local, global and the Traps

Look-ahead biasalso: future leak

Using information in a decision that was not available when the decision was made. The most common forms are a positive Ref() shift, filling inside the bar that produced the signal, and a higher-timeframe value read without a negative shift. It produces spectacular results and invalidates everything downstream.

See also:RefTimeFrameGetPriceTrade delayBacktestTaught in:Part 30 — Look-Ahead Bias

M

Market regime

A classification of overall market conditions used as a gate on a strategy. Read from a benchmark rather than from each candidate, so that every instrument is classified the same way on the same date. A definition, not a discovery.

See also:BenchmarkRegime dependenceSetupTaught in:Part 27 — From Hypothesis to Rules

MaxOpenPositions

The cap on simultaneously open positions. It does nothing on its own: a position size of 100% of equity means the account can hold exactly one position however high the cap is set.

See also:Portfolio backtestPosition sizingPositionScoreTaught in:Part 28 — Portfolio Backtesting: Many Symbols, One Account

Monte Carlo

Resampling a trade sequence many times to produce a distribution of outcomes rather than one path. It addresses sequence risk, not regime risk: it can only rearrange the trades you got, and standard resampling assumes an independence that correlated, time-clustered trades do not have.

See also:RobustnessRisk of ruinRegime dependenceTaught in:Part 33 — What Monte Carlo Can and Cannot Tell You

Moving averagealso: MA

The mean of a price series over a look-back window, recomputed each bar. A smoother of past data. It lags by construction — that is arithmetic, not a defect — and it is undefined until it has its full look-back.

See also:IndicatorWarm-upGolden crossTaught in:Part 6 — Moving Averages: SMA and EMA

N

Normalisation

Making a measurement comparable, in one of two distinct ways: against the instrument's own price (ATR as a percentage of price), or against the instrument's own history (a percentile of its own recent values). Mixing the two up is how a screen quietly selects one kind of instrument.

See also:PercentileATRRankingTaught in:Part 13 — Relative Strength: What It Does and Does Not Mean

Null

AFL's empty value. It propagates through arithmetic and makes comparisons false — which is the dangerous half, because false is an ordinary answer nothing flags. Nz() replaces it, IsNull() tests it, and deciding what a Null should mean for each condition is the whole of defensive AFL.

See also:Warm-upNzDefensive AFLTaught in:Part 8 — Null Values, Nz() and Warm-Up Periods

Null model

A system carrying no information at all — random entries — run on the same universe, costs, sizing and trade frequency as the real one. The distribution of its results is what a real result has to stand out from. In a rising market it frequently makes money.

See also:Base rateBenchmarkData snoopingTaught in:Part 30 — Data Snooping, Curve Fitting and Overfitting

Nz

Converts Null, NaN and infinity to zero or to a value you choose. Convenient and dangerous in screening filters: Nz( x ) makes a missing value zero, and zero often passes a "less than" test — promoting a broken symbol rather than removing it.

See also:NullIsFiniteDefensive AFLTaught in:Part 8 — Null Values, Nz() and Warm-Up Periods

O

OHLCV

Open, high, low, close and volume — the five fields that summarise a bar. What they omit is the sequence of prices inside the bar, which is why a daily backtest cannot know whether the high or the low came first.

See also:BarIntervalTickTaught in:Part 2 — OHLCV and What a Bar Hides

Optimization

Repeated backtests across a parameter range, driven by Optimize(). Legitimate as a way to understand a parameter surface; a route to overfitting when the best cell of hundreds is reported as though it were the only specification tried.

See also:Parameter surfaceCurve fittingWalk-forward analysisTaught in:Part 31 — What Optimize() Actually Does

Oscillator

An indicator bounded within a fixed range, such as RSI between 0 and 100. Boundedness makes readings comparable across instruments; it says nothing about whether an extreme reading means anything.

See also:IndicatorRSINormalisationTaught in:Part 6 — The Stochastic Oscillator

Out-of-samplealso: OOS, hold-out

Data deliberately not used to develop a model, tested on once. The moment you look at the result and change the model, that data has joined the training set and cannot be recovered — which is how walk-forward analysis quietly becomes in-sample fitting.

See also:Walk-forward analysisData snoopingResearch logTaught in:Part 32 — In-Sample and Out-of-Sample

Overfitting

The outcome: a model that performs well on the data it was built from and poorly on data it has not seen. Data snooping is about the process and curve fitting is about the model; overfitting is what they produce.

See also:Curve fittingData snoopingOut-of-sampleTaught in:Part 30 — Data Snooping, Curve Fitting and Overfitting

P

Parameter surface

How a performance metric varies across a parameter grid. A broad plateau suggests a property of the idea; a single spike surrounded by mediocrity is what curve fitting looks like from outside; a flat surface is a result too.

See also:OptimizationCurve fittingRobustnessTaught in:Part 31 — Reading Parameter Surfaces

Participation

How large an intended position is relative to what actually traded — as a share of the entry bar's volume or of median turnover. A backtest whose positions are a large fraction of daily turnover is reporting profits from trades that could not have been established.

See also:LiquidityPosition sizingSlippageTaught in:Part 30 — Position Sizing and Portfolio Errors

Percentilealso: PercentRank

Where a value sits within its own recent history, on a 0–100 scale. PercentRank( array, range ) answers "unusual for this instrument" rather than "large in absolute terms", which is what makes readings comparable across instruments and across time.

See also:NormalisationVolatilityRankingTaught in:Part 10 — Project: ATR Volatility Indicator

Plug-inalso: data plug-in

The DLL that connects AmiBroker to a data vendor. Which build is loaded, and what its Configure dialog offers, is read from Tools → Plugins — the only reliable statement about your own installation.

See also:Real-time dataBackfillBad tickTaught in:Part 17 — Plugins and the Database Relationship

Portfolio backtest

A simulation in which every symbol shares one cash balance and a maximum number of open positions, so candidates compete. The competition is what a single-symbol test cannot show — including whether your selection rule is any good, since it never has to select.

See also:BacktestPositionScoreMaxOpenPositionsExposureTaught in:Part 28 — Portfolio Backtesting: Many Symbols, One Account

Position sizing

How much of the account goes into each trade. Fixed shares varies both money and risk; percent of equity equalises money and leaves risk unequal; ATR risk-based equalises risk and leaves money unequal. Identical signals under three sizing models produce three different systems.

See also:Risk per tradeParticipationEquity curveTaught in:Part 28 — Position Sizing with SetPositionSize()

PositionScore

The array that decides which candidates are taken when signals outnumber slots or cash. Ranked on its absolute value, which is the trap in long-and-short systems. It is a second strategy sitting on top of the first, and deserves the same scrutiny.

See also:Portfolio backtestRankingMaxOpenPositionsTaught in:Part 28 — Portfolio Backtesting: Many Symbols, One Account

R

Ranking

Ordering a universe by a score, as opposed to filtering it by a threshold. A filter answers "is this eligible"; a rank answers "which is preferred". A ranking rule is a strategy and should be tested like one.

See also:PositionScoreNormalisationRelative strengthTaught in:Part 13 — Ranking versus Filtering

Real-time data

Streaming market data pushed by a vendor as it arrives. In AmiBroker it requires the Professional edition: GetRTData() returns Null for every field on Standard. Every real-time topic in this course also has a Level A path.

See also:Level ABar ReplayBackfillPlug-inTaught in:Part 17 — The Real-Time Architecture, End to End

Reality check

This course's recurring exercise: take a popular market claim, replace every undefined word with a number, define the outcome and the comparison, measure it, and describe the result without deciding in advance what you wanted it to be. The usual finding is that the difference is small relative to the noise.

See also:Base rateHypothesisNull modelTaught in:Part 6 — Reality Check: Does RSI Above 70 Mean Sell?

Ref

Shifts an array in time. A negative period references the past; a positive period references the future. A positive shift is legitimate in a study measuring what followed an event, and is look-ahead bias the moment it reaches a signal array.

See also:Look-ahead biasArrayWarm-upTaught in:Part 9 — Referencing Past Bars with Ref()

Refutation criterion

The result that would make you abandon an idea, written down and dated before the test is run. If no result would have changed your mind, the study was decorative.

See also:HypothesisResearch logData snoopingTaught in:Part 37 — Component 9: The Research Report

Regime dependence

A result that holds in one kind of market and not others. A fifteen-year backtest of a largely rising market is one observation of a market, however many bars and trades it contains.

See also:Market regimeBase rateOut-of-sampleTaught in:Part 30 — Insufficient Evidence and Regime Dependence

Relative strength

How an instrument has performed compared with a benchmark or with its peers over the same window. A cross-sectional comparison, not the Relative Strength Index, which is a different thing with a confusingly similar name.

See also:RSIRankingBenchmarkForeignTaught in:Part 13 — Relative Strength: What It Does and Does Not Mean

Reproducibility

Whether somebody else, given your files, universe, date range and settings, would get the same number. Half of a run lives in dialogs rather than in the formula, which is why an APX file and a research log matter more than any technique.

See also:APX fileResearch logAnalysis windowTaught in:Part 12 — Exporting Results and Building a Daily Workflow

Research log

A dated list of every specification evaluated, including the abandoned ones and why. It is what makes "how many things did you try?" answerable, and it is the only record of how many times a hold-out has been looked at.

See also:Data snoopingOut-of-sampleReproducibilityDecision logTaught in:Part 35 — Journalling and Separating Two Kinds of Performance

RestorePriceArrays

Restores the current symbol's price arrays after SetForeign(). Omitting it is a silent error: the formula continues to run and every later line describes a different instrument.

See also:SetForeignForeignTaught in:Part 15 — Foreign(), SetForeign() and RestorePriceArrays()

Risk adjusted return

In AmiBroker's report, annual return divided by exposure. The figure designed for comparing systems that are in the market for different fractions of the time — which is why exposure is read first.

See also:ExposureCAR/MaxDDBacktestTaught in:Part 29 — Return Metrics: Net Profit, CAR, RAR and Exposure

Risk of ruin

The probability of losing enough capital to be unable to continue. Depends on the size of the edge, the size of the bets and the number of them — and on whether the losses are independent, which for a portfolio of correlated positions they are not.

See also:DrawdownPosition sizingRisk per tradeTaught in:Part 34 — Drawdown and Risk of Ruin in Practice

Risk per trade

How much of the account a single trade can lose if the stop is honoured. The conditional clause is the whole point: a gap through the stop is unbounded, and a backtest using ExitAtStop = 1 has never shown you one.

See also:StopPosition sizingGapRisk of ruinTaught in:Part 34 — Risk Per Trade and Stop Distance

Robustness

Whether a result survives changes that should not matter: small parameter changes, a different period, a different subset of the universe, a different ordering of trades. Not the same as being profitable — a robustly mediocre system is a real finding.

See also:Parameter surfaceOut-of-sampleMonte CarloTaught in:Part 33 — What Monte Carlo Can and Cannot Tell You

RSIalso: Relative Strength Index

A bounded momentum oscillator running 0 to 100, computed from the ratio of average gains to average losses over a look-back. It measures how one-sided recent moves have been. It is not relative strength, and "above 70 means sell" is a claim this course tests rather than teaches.

See also:OscillatorRelative strengthReality checkTaught in:Part 6 — RSI and Rate of Change

S

Scalar

A single number, as opposed to an array. BarCount is a scalar; BarIndex() is an array. if, while and for require scalars, which is why passing an array to one raises Error 6.

See also:ArrayArray modelLastValueTaught in:Part 8 — The Array Model: The Most Important Lesson in This Course

Scan

An Analysis mode that reports the symbols and bars where Buy, Sell, Short or Cover are true. Distinct from an Exploration, which produces an arbitrary table. Note that trade delays are implemented only by the backtester and do nothing in a Scan.

See also:ExplorationAnalysis windowSignalTrade delayTaught in:Part 12 — The Analysis Window and Its Four Modes

SelectedValue

Returns the value of an array at the bar under the chart crosshair, or the last bar if nothing is selected. Display only: it reads one bar, so it must never be used to build a signal.

See also:LastValueScalarArrayTaught in:Part 10 — Chart Titles and Dynamic Text

Selection bias

Any systematic difference between the sample tested and the population the conclusion is about. A personal watch list assembled after the period is worse than an index list, because it was curated by somebody who already knew how those names performed.

See also:Survivorship biasUniverseData snoopingTaught in:Part 30 — Survivorship and Selection Bias

SetForeign

Replaces the current symbol's price arrays with another symbol's, so that subsequent calculations operate on that symbol. RestorePriceArrays() puts them back — and forgetting it means everything afterwards silently describes the wrong instrument.

See also:ForeignRestorePriceArraysRelative strengthTaught in:Part 15 — Foreign(), SetForeign() and RestorePriceArrays()

Setup

The conditions that make an instrument a candidate — a state, true over a span of bars. Distinct from the trigger, which is the event that turns a candidate into an entry. Using a state where a trigger belongs makes a scanner return the same names every day.

See also:TriggerStateEventMarket regimeTaught in:Part 27 — From Hypothesis to Rules

Signal

A non-zero value in Buy, Sell, Short or Cover. The four signal arrays carry no timing information whatsoever — a 1 on bar 40 says an entry belongs to bar 40, not when during bar 40 — and the price arrays carry none either.

See also:Trade delayTriggerBacktestCrossTaught in:Part 28 — Backtester Basics: Signals and Trade Prices

Slippage

Getting a worse price than you aimed at, from queue position, movement between decision and fill, or your own size. A worse price rather than a fee, so it belongs in the price arrays — remembering that AmiBroker silently clamps an assigned price back inside the bar's high–low range.

See also:CostsSpreadParticipationGapTaught in:Part 28 — Costs: Commissions, Slippage and the Spread

Spreadalso: bid-ask spread

The gap between the best bid and the best ask. You buy at the ask and sell at the bid, so you cross half of it each way. It is widest exactly when a system most wants to trade — around the open, around news, during fast moves.

See also:CostsSlippageLiquidityTaught in:Part 22 — Quote Fields and the Real-Time Quote Window

State

A condition true over a span of bars — Close > MA( Close, 50 ). The counterpart of an event. Almost every confusing scanner or backtest result comes from using one where the other belongs.

See also:EventCrossSetupBoolean arrayTaught in:Part 9 — State versus Event: The Distinction That Breaks Formulas

Static variable

A value that persists between formula executions and between symbols, set with StaticVarSet(). The mechanism that makes cross-sectional work — ranking a universe — possible in AFL, which otherwise processes one symbol at a time.

See also:RankingScanCompositeTaught in:Part 13 — Static Variables for Cross-Sectional Work

Status

Returns information about the run: Status( "action" ) says which mode is executing, Status( "lastbarinrange" ) is true only on the final bar of the range, Status( "stocknum" ) gives the symbol's ordinal. Documented as returning a NUMBER or an ARRAY depending on the field.

See also:FilterExplorationScanTaught in:Part 12 — Exploration: Filter, AddColumn and AddTextColumn

Stopalso: stop loss

An exit triggered by price reaching a level rather than by a rule. AmiBroker provides four built-in types through ApplyStop(): maximum loss, profit target, trailing and N-bar. A stop caps a loss given that you were filled near your level — it does not survive a gap, and it says nothing about correlated positions stopping out together.

See also:ExitAtStopTrailing stopGapRisk per tradeTaught in:Part 28 — Stops with ApplyStop()

Support and resistance

Price areas where transactions previously clustered, described after the fact. The concept is a description of where trading happened, not a mechanism that makes it happen again — and a level nobody can define objectively cannot be tested.

See also:BreakoutChart patternTaught in:Part 5 — Support and Resistance as Zones

Survivorship bias

Testing on a universe that contains only the instruments that still exist. Everything delisted, merged or taken over is absent, and that population's returns were worst — so results are biased upward by an amount that usually cannot be quantified with retail data. It can always be stated.

See also:UniverseData qualitySelection biasTaught in:Part 30 — Survivorship and Selection Bias

T

Tick

A single trade print. Bars are built by aggregating ticks; a tick database is the finest base interval available and by far the largest.

See also:BarBase intervalBad tickTaught in:Part 2 — Timeframes, Ticks and How Bars Are Built

Timeframe

The conceptual horizon — weekly context, daily setup, hourly entry. Distinct from interval, which is the concrete bar size. Keeping the two words separate prevents a great deal of confusion in multi-timeframe work.

See also:IntervalTimeFrameGetPriceBarTaught in:Part 14 — Why Traders Use Multiple Timeframes

TimeFrameExpand

Stretches an array computed in a higher timeframe back onto the current interval's bars. Required: comparing a compressed array with an uncompressed one silently compares different time scales, which the User's Guide lists among the standard AFL mistakes.

See also:TimeFrameGetPriceexpandLastTimeframeTaught in:Part 14 — Expansion Modes and the Look-Ahead Trap

TimeFrameGetPrice

Reads an OHLCV field from a higher timeframe. Its signature is TimeFrameGetPrice( field, interval, shift = 0, mode = expandFirst ), and the documentation warns explicitly that with shift 0 the compressed data may look into the future — the weekly high can be known on Monday. A trading system must use a negative shift.

See also:Look-ahead biasexpandLastTimeframeTimeFrameExpandTaught in:Part 14 — Expansion Modes and the Look-Ahead Trap

Trade delay

The gap between a signal and its fill, set with SetTradeDelays(). The engine implements it by shifting the four signal arrays with Ref()and nothing else, so any other array your formula feeds the backtester must be shifted by hand. Delays are implemented only by the backtester and do nothing in Scan, Exploration or Indicator modes.

See also:SignalLook-ahead biasBacktestTaught in:Part 28 — Backtester Basics: Signals and Trade Prices

Trailing stop

A stop that follows price in the favourable direction and never retreats. In AFL, stopTypeTrailing with the volatile argument set to True lets the distance vary during the trade — which works in backtestRegular mode only.

See also:StopChandelier exitExitAtStopTaught in:Part 28 — Stops with ApplyStop()

Trigger

The specific event that turns a candidate into an entry — true on one bar. Usually built with Cross().

See also:SetupEventCrossSignalTaught in:Part 27 — From Hypothesis to Rules

Turnover

Close * Volume — the money that changed hands. Money only when Volume is share volume, which is not true for futures, for contracts, or for instruments quoted in cents. A liquidity filter silently measuring the wrong quantity is an efficient way to build a universe you cannot trade.

See also:LiquidityParticipationData qualityTaught in:Part 12 — Building Screening Filters That Mean Something

U

Universe

The set of instruments a study is run over, and how that list was built. The most under-reported element of almost every published backtest, and the one that most often explains a result.

See also:Survivorship biasSelection biasBenchmarkTaught in:Part 2 — Survivorship, Delistings and Index Membership

User-defined function

A named block of AFL declared with function (returns a value) or procedure (does not). Every variable it assigns should be declared local, or it escapes into the caller's namespace.

See also:LocalLibraryInclude fileTaught in:Part 11 — User-Defined Functions and Procedures

V

Vectorised thinking

Expressing a calculation as operations on whole arrays rather than as a loop over bars. Faster in AFL, and — more importantly — it makes the shape of the calculation visible instead of hiding it inside control flow.

See also:Array modelArrayScalarTaught in:Part 8 — The Array Model: The Most Important Lesson in This Course

Volatility

How large price moves are, by some stated measure. Usually ATR here, expressed as a percentage of price to compare instruments and as a percentile of its own history to compare across time. A description of the recent past, not a prediction of the near future.

See also:ATRPercentileNormalisationTaught in:Part 10 — Project: ATR Volatility Indicator

W

Walk-forward analysis

Optimise on a window, apply the winner to the next window, roll forward, repeat, and evaluate only the concatenated out-of-sample segments. It tests the process rather than a parameter set — and parameter stability across steps is often more informative than the performance figures.

See also:Out-of-sampleOptimizationRobustnessDegradationTaught in:Part 32 — Walk-Forward Methodology

Warm-up

The bars at the start of an array where a look-back function cannot yet have a real value. Some functions return Null there and some — Wilder's, such as ATR and RSI — return seed-contaminated numbers with no Null to detect, which is worse. The only defence is to know the property and discard a generous margin.

See also:NullMoving averageATRDefensive AFLTaught in:Part 8 — Null Values, Nz() and Warm-Up Periods

Sources for this lesson

2 verified · checked 2026-08-31

  1. 01AmiBroker User's Guideamibroker.com/guide2026-08-31
  2. 02AmiBroker AFL Function Referenceamibroker.com/guide/a_funref.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.