Matana Labs

No look-ahead

A rule in Matana Labs sees only what was known at the end of the current second: the second’s price and bars that have already closed. Its market orders fill at that second’s price and its resting orders from the next second. A test that changes the future of the data checks this on every build.

What a rule sees at a given second

ValueWhat it is at second t
priceThe price of second t, known when that second ends
An indicator or bar on intraday bars (1m, 5m, 1h…)The last bar that closed before second t; the bar still forming is never read
Daily bars (close[1d], SMA(…)[1d])Yesterday’s bar: today’s daily bar is not used until tomorrow
Weekly barsThe last week that has ended
Day values (day.high, day.low)Up to and including second t
Yesterday (day.prev_close…)The previous session
Bars back (close[5m]~2)Counted back from the last closed bar; offsets cannot point forward

A bar is closed from the first second after its last second. A 5-minute bar from 10:00 to 10:05 is first read in the second that ends at 10:05:01. Indicators on intraday bars continue across days, so an indicator at the open uses yesterday’s bars, never later ones.

When orders fill

Formulas and your own indicators

The formula language refuses a shift into the future: shift(close, -3) is an error, not a value. Window lengths and other parameters must be numbers; a series in that place would be read at the day’s last bar, so it is refused too.

The test that checks it

Two copies of the same data are built, identical except that one day’s prices from 13:00 on are raised by 3% and its volumes doubled. Several strategies run on both: crossovers on 5-minute bars, a Donchian breakout on 15-minute bars, RSI(2), a rule on daily bars with a trailing stop, and limit orders with a lifetime and a stop and target. Every fill before 13:00 of that day, and on every earlier day, must be identical on both copies; after 13:00 they must differ, which shows the test can fail. It runs with the engine’s other checks on every change (tools/check_method.py).

The engine validation adds a second, independent view: a reference backtester written separately, which only ever reads closed bars, gives the same trades as the engine.

Updated 2026-11-24. Describes the product as it is today; numbers are read from the code when the site is built. Educational content, not financial advice.