Skip to content
Level 5 · Real-Time AmiBroker UserLabPart 26 · page 2 of 345 min
45Minutes
10AFL functions
7Sources
StandardRequires
AFL functions taught here10

Replay Exercise: Reading a Session Live

This exercise takes about forty-five minutes and produces one page of handwriting, one exploration output and a score out of twenty-four. None of the twenty-four points are awarded for being right about the market.

You will step through a stretch of history you have never looked at, classify what the price is doing at twelve fixed points using a definition rather than an impression, write down what would change your mind, and then find out what actually happened. The purpose is to make your reading of a chart repeatable and checkable. Whether it is profitable is a different question, asked in a different way, in Parts 28 to 33.

Three conditions, and the first is not negotiable.

A window you have never studied. Not last week’s market. Not the crash everyone remembers. Not the symbol you hold. If you can name what happened, the exercise is already spoiled, because the one thing replay exists to reproduce is not knowing. A reasonable method: pick a liquid instrument at random from your database, pick a year at random from its history, and start on the first trading day of a randomly chosen month.

Enough liquidity that the bars are real. A thin instrument produces gappy, sparse bars whose shape is an artefact of who happened to trade. Structure reading on those teaches you to read noise.

Enough history before your start date. The panel below needs at least fifty bars of warm-up before it will say anything, and more is better. If your Start date is near the beginning of the symbol’s history, everything will read “not enough history to classify” and you will have learned only that.

What you have Watch this Step this
One-minute intraday bars 5-minute chart 1 minute
Five-minute intraday bars 30-minute or hourly chart 5 minutes
End-of-day bars only Weekly chart Daily

The rule behind the table is the one from the previous lesson: keep the step interval finer than the interval you are looking at, so the bar on the right-hand edge builds up instead of appearing whole. A bar that forms in front of you is a bar you have to have an opinion about before it finishes, which is the situation you are training for.

Three panes, top to bottom: the price chart at your chosen viewing interval, the replay clock from the previous lesson, and the decision log panel below. Give the price chart most of the height.

Set the replay range with the ^ buttons rather than by typing: select the bar you want to start on, press ^ beside Start; select the bar you want to end on, press ^ beside End. Aim for about sixty steps of range — twelve decision points, five steps apart.

Set Speed to 0.2, but plan to work in Pause and Step Forward. Play is for the second half of the exercise, once you are warmed up.

At each decision point you need six pieces of information, and you need them fast enough that gathering them does not become the exercise. This panel puts all six in one title block: the structure classification, where the close sits in its recent range, the boundaries of that range, the distance from a trend average in units of the instrument’s own movement, that unit itself, and how heavily the bar traded relative to normal.

It deliberately produces no signal. There is no arrow, no colour that means act, and nothing that could be mistaken for advice. The judgement is the part you are practising, so the machine is not allowed to have any.

Complete runnable AFL

replay-decision-log.afl
// replay-decision-log.afl
// Part 26 - Replay Exercise: Reading a Session Live
//
// A chart panel that puts the six numbers you are asked to record at each
// decision point in one place, so the exercise measures your reading of the
// market rather than your arithmetic under time pressure.
//
// It deliberately does NOT tell you what to do. There is no signal here, no
// arrow, no colour that means "buy". Every value is a description of bars that
// have already closed. The judgement stays with you, which is the whole point
// of the exercise.
//
// How to run it:
// Formula Editor -> paste -> name it "Replay decision log" -> Apply Indicator.
// Put it in its own pane under the price chart, then drive the chart with
// Tools -> Bar Replay.
//
// Assumptions declared up front:
// - Chart formula, any interval, any database. No feed required.
// - Every calculation uses the current bar and bars before it. Nothing here
// reads a future bar, so the panel shows under replay exactly what it would
// have shown on the day.
// - Structure is defined mechanically (see StructureLook below) so that two
// readers of this course classify the same chart the same way. That is a
// definition, not a discovery, and a different definition gives different
// labels.
// - Bars with too little history behind them produce empty values rather than
// confident nonsense.
_SECTION_BEGIN( "Replay decision log" );
StructureLook = Param( "Structure lookback (bars)", 20, 5, 100, 1 );
RangePeriod = Param( "ATR period", 14, 2, 100, 1 );
TrendPeriod = Param( "Trend average period", 50, 5, 400, 1 );
VolumeLook = Param( "Relative-volume lookback", 20, 5, 200, 1 );
// --- Structure -------------------------------------------------------------
// "Higher high" means: the highest high of the last StructureLook bars is above
// the highest high of the StructureLook bars before those. Same idea for lows.
// Two windows, no drawing tools, no hindsight.
RecentHigh = HHV( High, StructureLook );
RecentLow = LLV( Low, StructureLook );
PriorHigh = Ref( RecentHigh, -StructureLook );
PriorLow = Ref( RecentLow, -StructureLook );
HigherHigh = RecentHigh > PriorHigh;
HigherLow = RecentLow > PriorLow;
EnoughBars = BarIndex() >= 2 * StructureLook AND BarIndex() >= TrendPeriod;
StructureText = WriteIf( ! EnoughBars, "not enough history to classify",
WriteIf( HigherHigh AND HigherLow, "higher high AND higher low",
WriteIf( ! HigherHigh AND ! HigherLow, "lower high AND lower low",
WriteIf( HigherHigh AND ! HigherLow, "higher high, lower low - expanding",
"lower high, higher low - contracting" ) ) ) );
// --- Location --------------------------------------------------------------
// Where in its own recent range is this bar closing? Zero is the bottom of the
// window, one hundred is the top. The guard stops a flat window dividing by nil.
WindowSpan = RecentHigh - RecentLow;
RangePos = IIf( WindowSpan > 0, 100 * ( Close - RecentLow ) / WindowSpan, Null );
// --- Movement scale --------------------------------------------------------
// Distance from the trend average, measured in units of the instrument's own
// recent daily movement, so that the number means the same thing on a EUR 8
// share and a EUR 800 share.
TrueRange = ATR( RangePeriod );
TrendLine = MA( Close, TrendPeriod );
TrendDistance = IIf( TrueRange > 0, ( Close - TrendLine ) / TrueRange, Null );
// --- Participation ---------------------------------------------------------
AverageVolume = MA( Volume, VolumeLook );
RelVolume = IIf( AverageVolume > 0, Volume / AverageVolume, Null );
// --- Where the clock is ----------------------------------------------------
PlaybackPos = GetPlaybackDateTime(); // zero when replay is not active
BarStamp = DateTimeToStr( LastValue( DateTime() ) );
if ( PlaybackPos )
{
ClockLine = "REPLAY at " + DateTimeToStr( PlaybackPos );
}
else
{
ClockLine = "Replay OFF - you are looking at the end of the database";
}
// Everything the log sheet asks for, in the order the log sheet asks for it.
Title = ClockLine + " bar " + BarStamp + "\n"
+ "1 Structure: " + StructureText + "\n"
+ "2 Close " + NumToStr( LastValue( Close ), 1.4 )
+ " in-range position " + NumToStr( LastValue( RangePos ), 1.0 ) + "%\n"
+ "3 Window high " + NumToStr( LastValue( RecentHigh ), 1.4 )
+ " window low " + NumToStr( LastValue( RecentLow ), 1.4 ) + "\n"
+ "4 Distance from " + NumToStr( TrendPeriod, 1.0 ) + "-bar average: "
+ NumToStr( LastValue( TrendDistance ), 1.2 ) + " ATR\n"
+ "5 ATR(" + NumToStr( RangePeriod, 1.0 ) + ") "
+ NumToStr( LastValue( TrueRange ), 1.4 ) + "\n"
+ "6 Relative volume " + NumToStr( LastValue( RelVolume ), 1.2 ) + "x";
// Draw the same numbers so the panel can be read without squinting at the title.
Plot( TrendDistance, "Distance from trend (ATR)", colorBlue, styleLine | styleThick );
Plot( 0, "Zero", colorLightGrey, styleLine | styleNoLabel );
Plot( RelVolume, "Relative volume (x)", colorOrange, styleLine | styleOwnScale );
_SECTION_END();

Download replay-decision-log.afl106 lines

Structure is defined by two windows, not by eye. The highest high of the last StructureLook bars is compared with the highest high of the StructureLook bars before those, and the same comparison is made on the lows. That yields four combinations, and WriteIf turns them into four sentences: higher high and higher low, lower high and lower low, higher high with a lower low (the window is expanding), and lower high with a higher low (it is contracting). A fifth branch fires when there is not enough history behind the bar to make either comparison, and it says so instead of guessing.

This is a definition, not a discovery. A different lookback gives different labels on the same chart. That is the point of writing it down: two readers of this course, on the same bar, with the same parameter, get the same word — which is the property that makes a disagreement about a chart worth having.

Location is RangePos, the close expressed as a percentage of the distance between the window’s low and its high. Zero is the bottom of the range, one hundred the top. The guard returns Null rather than dividing by a zero span, which happens on a perfectly flat window more often than you would expect on illiquid symbols.

Scale is the pair TrueRange and TrendDistance. Distance from a moving average in currency is meaningless across instruments; the same distance divided by ATR is comparable, and it is the number you will actually compare between decision points.

Participation is RelVolume, this bar’s volume over the average of the last VolumeLook bars. One means typical. Three means something happened.

The clock line repeats the replay position, so that a photograph or screenshot of the panel is self-dating and your log entries can be matched to bars afterwards.

Every calculation uses the current bar and bars before it. There is no Ref() with a positive shift anywhere in the file, which is what makes the panel honest under replay: it shows you exactly what it would have shown on the day.

  • HHV( array, periods ) and LLV( array, periods ) — highest and lowest value over a rolling window ending at the current bar.
  • Ref( array, -n ) — the value n bars ago. A negative shift looks backwards, which is safe; a positive shift looks forwards, which is the classic way to build a formula that cannot be traded.
  • ATR( periods ) — average true range, the instrument’s typical bar-to-bar movement.
  • WriteIf( condition, "true text", "false text" ) — conditional text, nested here to produce one of five sentences.
  • IIf( condition, x, y ) — the array-valued conditional. Used for every division guard.

Apply it as an indicator in its own pane. With replay off, the title should describe the most recent bar in your database and the two plotted lines should be drawn across the whole history: distance from trend oscillating around zero, and relative volume on its own scale.

Under replay, the title changes on every step, and the structure sentence changes rarely — typically every ten to thirty bars on a daily chart with the default lookback of twenty. If your structure sentence changes on almost every bar, the lookback is too short for the instrument’s noise; raise it before you start the exercise, not during it.

Two checks, both quick.

The look-ahead check. Note the six values at some bar under replay. Press Stop, find the same bar on the full chart, and read the panel there. Every value must be identical. If any of them differ, something in the formula is reading bars that came later, and every conclusion you draw from the exercise is contaminated.

The definition check. Set StructureLook to 5 and then to 60 on the same chart, and watch the structure sentence change on the same bars. Nothing is wrong; you are seeing that “the trend” is a parameter, not a fact. Put it back to 20 before you begin.

  • Every bar reads “not enough history”. The Start date is too close to the beginning of the symbol’s data, or TrendPeriod is longer than the history available.
  • Relative volume is empty. The symbol has no volume data — common for indices, currency crosses and some CFD symbols. Drop field 6 from the log for that instrument rather than pretending the blank is a value.
  • The two plotted lines are unreadable together. RelVolume is drawn on its own scale deliberately. If it still dominates, give the panel more height rather than rescaling.
  • The panel disagrees with the price chart’s own title. They are different formulas with different parameters. Read the panel, not the chart heading.

Add a seventh field: the number of bars since the structure sentence last changed. It takes one BarsSince() call on a comparison of the current label with its previous value, and it turns out to be one of the more informative numbers on the panel — a classification that has held for forty bars is a different situation from one that flipped two bars ago.

Paper is better than a spreadsheet here, because a spreadsheet invites you to go back and tidy. Rule up twelve rows with these columns.

Field What goes in it
Point 1 to 12
Bar time Copied from the replay clock, so entries can be matched to bars later
Structure The panel’s sentence, copied exactly. Not your paraphrase
Location RangePos, to the nearest whole percent
Trend distance In ATR units, to one decimal
Relative volume To one decimal
Reading One sentence in your own words: what you think is happening
Expectation What you expect over the next five bars, written so that it could turn out to be wrong
Falsifier What you would have to see to abandon that expectation
Confidence 1 to 5. 1 means a coin flip; 5 means you would be surprised to be wrong
Indicator note What your chosen indicator is doing, and whether it changed your reading

Two of these columns do most of the work.

Expectation must be falsifiable. “It looks bullish” is not an expectation; it is a mood. “The close in five bars is above today’s close” is. “Price stays inside the current twenty-bar range for the next five bars” is. If you cannot tell, five bars from now, whether you were right, rewrite it until you can.

Falsifier must be written before the next bar appears. This is the single most valuable habit in the exercise and the one people skip. It is also the only defence against the thing your memory will otherwise do, which is to reinterpret what you meant in the light of what happened.

One decision point

  1. Step 5 barsStep Forward five times, or Play at speed 0.2 for 25 seconds
  2. Read the panelCopy the six numbers into the row. Do not interpret yet
  3. Classify and commitReading, expectation, falsifier, confidence — written down before the next step
  4. Step againNo going back, no scrolling right
Twelve of these, roughly three minutes each, is the exercise.

Work through decision points 1 to 6 in Pause and Step Forward. Take your time; you are learning where the numbers live.

For points 7 to 12, press Play at speed 0.2 and let it run, pausing only to write. This half is harder and it is meant to be: the difference between your reading with unlimited time and your reading with five seconds a bar is a real and personal quantity, and you want to know what it is before a market shows you.

You will hit bars where the panel says one thing and your eye says another. That is the exercise working. Write the panel’s sentence in the Structure column and your disagreement in the Reading column. Both, separately.

Three specific situations are worth recognising when they arrive.

The label lags a turn. With a twenty-bar lookback, a decisive reversal takes something like twenty bars to show up as a change of sentence. You will see the turn before the definition does. That is not a flaw in the definition — it is the price of having one, and the alternative, a definition short enough to catch every turn, changes its mind constantly and is worthless. Record what you see; do not adjust the parameter mid-exercise.

Expanding and contracting windows. “Higher high with a lower low” and its mirror are the two labels people ignore, and they are often the informative ones. An expanding window means the instrument is making both larger highs and larger lows — a wider distribution of outcomes, not a direction. A contracting one means the opposite. Neither is a signal.

The label is stable and everything else is moving. Structure held, location swung from 15 per cent to 85 per cent, relative volume tripled. Your six fields are not one measurement, and noticing when they disagree is most of what the panel is for.

Add one indicator to the price chart — one, not four. A twenty-period RSI or a fifty-period moving average will do; the choice matters much less than the discipline of only having one.

Watch it across all twelve points and record, in the last column, two things: what it is doing, and whether it changed your reading. The second is the interesting one, and the honest answer will often be no.

Three behaviours to look for, because they are difficult to appreciate from a static chart and obvious in replay:

Lag is a length, not an adjective. A fifty-bar average barely moves while price travels several ATR. Watching that happen bar by bar gives you a physical sense of how much has to change before the average does, which reading about smoothing never does.

The last bar’s value is provisional. If your step interval is finer than your viewing interval, the indicator’s value on the forming bar moves during the bar and settles only at the close. An RSI that touched 71 mid-bar and closed at 68 never crossed 70 as far as any completed-bar rule is concerned. This is exactly the intrabar re-triggering problem Part 25 dealt with in alerts, and here you can watch it happen.

Nothing repaints. The values you saw at point 4 are still there at point 12. If you have used tools elsewhere whose lines move after the fact, replay is the cleanest possible demonstration of the difference.

Press Stop in the Bar Replay window. Do this before anything else — while replay is active, Analysis is truncated too, and half the outcomes you are about to measure will be missing.

You have twelve recorded expectations about the next five bars. The debrief needs to tell you, for each of them, what the next five bars actually did — as a percentage move, a best excursion and a worst excursion, so that “I was right” can be distinguished from “I was right and it went through my stop first”.

Complete runnable AFL

replay-debrief-exploration.afl
// replay-debrief-exploration.afl
// Part 26 - the debrief step for both replay exercises
//
// Run this AFTER you have stopped Bar Replay and written your log sheet. It
// reports, for every bar of the replayed range, what happened over the next
// Horizon bars. You then look up the timestamps you recorded and compare your
// decision with the outcome you could not see at the time.
//
// READ THIS BEFORE COPYING ANYTHING ELSE FROM THIS FILE:
// FwdMove, FwdBest and FwdWorst read FUTURE bars on purpose. They exist to
// measure what already happened, in a debrief, after the fact. They are not
// rules, they cannot be traded, and pasting them into a signal formula
// produces a backtest that looks wonderful and means nothing.
//
// How to run it:
// Press STOP in the Bar Replay window first. While replay is active it
// truncates the Analysis window too, and half your outcomes will be missing.
// Formula Editor -> paste -> name it -> Analysis.
// Apply to: Current symbol. Range: the dates you replayed, or All quotations.
// Press Explore.
//
// Assumptions declared up front:
// - Same symbol, same interval and same database as the replay you just ran.
// - Outcomes are measured from the close of the bar in the row. If you would
// in practice have transacted on the next bar's open, the numbers here are
// optimistic by exactly that gap - Part 27 makes that assumption explicit.
// - No costs, no spread, no slippage are subtracted anywhere in this file.
// It measures price movement, not a result you could have banked.
// - The last Horizon bars of the range have no future to measure and are
// dropped rather than reported as zero.
Horizon = Param( "Outcome horizon (bars)", 20, 1, 500, 1 );
BreakoutLook = Param( "Breakout lookback (bars)", 20, 2, 200, 1 );
EveryBar = ParamToggle( "Report every bar", "Only breakout bars|Every bar", 0 );
// --- The event, defined exactly as the alert harness defines it -------------
// Close crosses above the highest high of the previous BreakoutLook bars.
// Ref( ..., -1 ) shifts the window back one bar so the current bar's own high
// cannot be part of the level it is supposed to be breaking.
PriorHigh = Ref( HHV( High, BreakoutLook ), -1 );
Triggered = Cross( Close, PriorHigh );
// --- What happened next ----------------------------------------------------
// Ref( x, +N ) reads N bars forward. Legitimate here, and only here.
FutureClose = Ref( Close, Horizon );
FutureBest = Ref( HHV( High, Horizon ), Horizon ); // highest high of bars +1..+Horizon
FutureWorst = Ref( LLV( Low, Horizon ), Horizon ); // lowest low of bars +1..+Horizon
Measurable = ! IsNull( FutureClose ) AND Close > 0;
FwdMove = IIf( Measurable, 100 * ( FutureClose - Close ) / Close, Null );
FwdBest = IIf( Measurable, 100 * ( FutureBest - Close ) / Close, Null );
FwdWorst = IIf( Measurable, 100 * ( FutureWorst - Close ) / Close, Null );
// --- The context the decision log showed you at the time --------------------
TrueRange = ATR( 14 );
MoveInAtr = IIf( TrueRange > 0 AND Measurable,
( FutureClose - Close ) / TrueRange, Null );
Filter = Status( "barinrange" ) AND Measurable AND ( EveryBar OR Triggered );
AddColumn( DateTime(), "Bar", formatDateTime );
AddColumn( Close, "Close", 1.4 );
AddColumn( Triggered, "Breakout bar (1/0)", 1.0 );
AddColumn( FwdMove, "Move over next N (%)", 1.2 );
AddColumn( FwdBest, "Best over next N (%)", 1.2 );
AddColumn( FwdWorst, "Worst over next N (%)", 1.2 );
AddColumn( MoveInAtr, "Move in ATR units", 1.2 );
// Mean and count across the reported rows. The mean of a handful of rows from
// one session of one symbol is a description of that session, not an estimate
// of anything. Read it as a tally, and note the count next to it.
AddSummaryRows( 2 | 16, 1.2 );

Download replay-debrief-exploration.afl73 lines

The file has two halves, and the boundary between them is the most important thing in it.

The first half defines the event exactly as the alert lab defines it, so the same rows can be used in both exercises: a close crossing above the highest high of the previous BreakoutLook bars, with Ref( ..., -1 ) shifting the window back one bar so that the current bar’s own high cannot be part of the level it is breaking.

The second half reads the future on purpose. Ref( Close, Horizon ) with a positive shift is the look-ahead that every other formula in this course is careful to avoid. Here it is correct, because the question is “what happened after that bar”, asked afterwards. Ref( HHV( High, Horizon ), Horizon ) gives the highest high of the Horizon bars following the row’s bar, and the LLV version gives the lowest low; together they bracket the path, not just the endpoint.

Measurable drops the last Horizon bars of the data, which have no future to report, so they are absent from the output rather than present as zeros. Filter combines Status("barinrange") — the analysis range you selected — with the event test, so you can either see every bar of your replayed window or only the breakout bars.

  • Ref( array, +n ) — reads n bars into the future. Legitimate in post-hoc measurement and nowhere else.
  • Status( "barinrange" ) — true for bars inside the Analysis window’s selected date range.
  • AddColumn( array, name, format ) — one exploration column. formatDateTime renders a DateTime value using your regional settings.
  • AddSummaryRows( flags, format ) — appends summary rows. Flag 2 is the average, 16 the count; they are summed, so 2 | 16 gives both.

Set Apply to: Current symbol, set the Analysis range to the dates you replayed, switch Report every bar on, and press Explore. You should get one row per bar of your replay window, with the last Horizon bars missing, and a count row at the bottom that matches the number of bars you stepped through.

Find the twelve timestamps from your log sheet in the Bar column, and copy the Move over next N figure for each into a thirteenth column on your sheet. Set Horizon to 5 first, since that is what your expectations were about.

Pick one row by hand and verify it. Read its date and close, find the bar five bars later on the chart, and compute the percentage move yourself. If the exploration’s figure differs, either the analysis range or the interval does not match what you replayed. This takes a minute and it has caught more errors in this course’s own examples than any other check.

  • The output stops early, or half the rows have blank outcomes. Bar Replay is still active. Press Stop and explore again.
  • No rows at all. Report every bar is off and no breakout occurred in the window, or the analysis range does not overlap your replay range.
  • The dates are right but the prices are not. The Analysis window is set to a different interval from the chart you replayed. Intraday and daily bars of the same symbol have different closes and both are correct.
  • The averages look meaningful. They are the average of a dozen rows from one session of one symbol. Read the count row next to them, and treat the mean as a tally.

Add a column that measures the move over a longer horizon as well, so that each decision point carries both a five-bar and a twenty-bar outcome. Where the two disagree — right in five bars, wrong in twenty — you have found a decision whose quality depends entirely on an exit rule you had not thought about.

Answer these in writing, on the same page as the log, before you score anything.

  1. At which decision points did the panel’s structure sentence and your own reading disagree? What did the price do next in those cases, compared with the cases where they agreed?
  2. How many of your twelve expectations were falsifiable as written? Count strictly: if you cannot decide from the data whether it happened, it does not count.
  3. Of the falsifiable ones, how many turned out as expected? Write the fraction, not a percentage — twelve is a small number and a percentage flatters it.
  4. Compare your average confidence with that fraction. If you averaged 4 out of 5 and were right half the time, you are overconfident by a measurable amount, and that is the single most useful thing this exercise can tell you.
  5. Did any of your falsifiers actually occur? If one occurred and you did not notice, why not? If none occurred, were they demanding enough to be real?
  6. Where in the session did you feel most certain? Look up what happened after that point specifically.
  7. What did the indicator add? Name a decision point where it changed your reading, or state plainly that it changed none of them.
  8. In the second half, at speed, what did you stop doing that you had been doing in the first half? That omission is what will go first in a live session.

Score six criteria, 0 to 4 each, for a total out of 24. Note what is not on the list: whether you were right.

Criterion 0 2 4
Completeness Fewer than eight rows filled All twelve rows, some fields blank Twelve rows, every field, including the ones you did not want to write
Definition discipline Structure column is your own words Mixed Panel’s sentence copied exactly every time, with disagreements in the Reading column
Falsifiability Expectations are moods Some are checkable All twelve could be decided from the data, and were
Falsifiers written in advance Left blank Written for some points Written for all twelve, before the next step, and specific enough to be triggered
Calibration Confidence unrelated to outcome Loosely related Average confidence within one point of your success fraction on the 1 to 5 scale
Restraint An expectation on every bar regardless of whether anything was happening Occasional “no view” “No view” recorded where the evidence genuinely did not support one, and confidence of 1 or 2 used honestly

A score below 12 usually means the log was the problem, not the reading — go again on a different session and concentrate on filling the sheet. Between 12 and 18 is a normal first attempt. Above 18 means your process is repeatable, which is the property you actually want, because a repeatable process is one you can test, criticise and improve.

What this exercise did and did not establish

Section titled “What this exercise did and did not establish”

It established things about you and about your formulas: whether your structure definition produces stable labels on this instrument, whether your expectations are falsifiable, whether your confidence tracks your accuracy, and what falls away when you are under time pressure.

It established nothing about the market. One session, one instrument, chosen by you, with no costs, no spread and no execution. Twelve observations cannot distinguish skill from chance, and a session that went well tells you almost nothing that a session that went badly would not have. The point was never the outcome column.

You now have a reproducible way to practise reading a chart: a fixed range, a fixed interval pair, a panel that supplies six defined measurements without offering an opinion, twelve decision points with a written expectation and a written falsifier at each, an exploration that reports what actually happened, eight debrief questions and a score that measures process rather than luck.

The next exercise keeps the same structure and changes what is under test. Instead of your reading, it puts your scanner and your alert formulas in front of a replayed intraday session, and asks whether they do what you believe they do.

Check your understanding

Question 1. Why does the exercise insist you write the falsifier before stepping to the next bar?
Show the answer and why

Answer: Because a falsifier written afterwards is reconstructed from the outcome, which makes it worthless as a test of the reading

Memory rewrites intentions in the light of results, and it does so without any sense of dishonesty. A falsifier is only evidence about your process if it was committed to before the evidence arrived. This is the same reason a hypothesis is written down before a backtest is run.

Question 2. Under replay you read six values off the decision panel. You press Stop and check the same bar on the full chart. Two values differ. What does that mean?
Show the answer and why

Answer: Some calculation in the panel reads bars later than the one being displayed, so everything you recorded is contaminated by hindsight

Replay removes later bars; it does not change the arithmetic on earlier ones. A value that differs before and after can only be one that depended on bars the replay was hiding. That is the definition of look-ahead, and it is why this check comes before the exercise rather than after it.

Question 3. Your structure sentence changes on nearly every bar. What is the appropriate response?
Show the answer and why

Answer: Increase the structure lookback before starting, because a definition that changes constantly cannot be acted on or disagreed with

The lookback is a parameter of your definition, not a property of the instrument. Set it before you begin, so that the exercise measures your reading rather than your willingness to change the rules while the result is unfolding. Changing it during the session is exactly the habit the log sheet exists to expose.

Question 4. You averaged 4.2 confidence across twelve points and were right on five of the nine falsifiable ones. What does the scoring scheme conclude?
Show the answer and why

Answer: That confidence and outcome are out of step, which costs points on calibration regardless of how the readings themselves were reasoned

Calibration is about the relationship between stated confidence and observed frequency, and it is scored separately from whether the readings were sensible. Being right five times out of nine while feeling near-certain is a measurable gap. Twelve points is indeed a small sample for anything about the market — but it is a perfectly adequate sample for something about your own reporting of confidence.

Question 5. Which of these belong in the debrief rather than during the replay? Select all that apply.
Show the answer and why

Answer: Running the debrief exploration, Comparing average confidence with the success fraction, Answering what the indicator added

Everything that requires knowing the outcome belongs after Stop is pressed. The expectation is the one item that must exist before the outcome does, otherwise there is nothing to score. Running the exploration while replay is still active also truncates it, which is a separate and equally good reason to leave it until the end.

Sources for this lesson

7 verified · checked 2026-08-31

  1. 01AmiBroker User's Guide — Bar Replay windowamibroker.com/guide/w_barreplay.html2026-08-31
  2. 02AmiBroker AFL Function Reference — GetPlaybackDateTimeamibroker.com/guide/afl/getplaybackdatetime.html2026-08-31
  3. 03AmiBroker AFL Function Reference — HHVamibroker.com/guide/afl/hhv.html2026-08-31
  4. 04AmiBroker AFL Function Reference — ATRamibroker.com/guide/afl/atr.html2026-08-31
  5. 05AmiBroker AFL Function Reference — WriteIfamibroker.com/guide/afl/writeif.html2026-08-31
  6. 06AmiBroker AFL Function Reference — Statusamibroker.com/guide/afl/status.html2026-08-31
  7. 07AmiBroker AFL Function Reference — AddSummaryRowsamibroker.com/guide/afl/addsummaryrows.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.