What Matters: A signal calculated from a candle’s close must be available before the assumed execution price can be used. Moving execution one bar later can change a result even when the signal and data stay fixed. DN’s authored example changes from +55.90 to −84.08 after fees. This is a timing sensitivity, not a measured strategy failure or proof of future profitability.
Two backtests can use the same prices and the same indicator yet answer different questions. One treats a close-derived decision as executable at that same close. Another waits for a later price. The difference is not merely a plotting preference: it changes what information was available before the trade.
A one-bar delay is useful because it makes that dependency visible. It is not a universal model of realistic execution. The next opening price, next closing price, next trade and a delayed market-order fill are different observations. This article chooses the following close explicitly and keeps the remaining assumptions simple.
The primary-source timing rule
DN Evidence Block — checked 28 November 2026; author: Heath Muchena. DN reviewed vectorbt’s portfolio documentation and ran an independently authored fixed-quantity calculation. No vectorbt installation, historical market series or strategy search was involved. The prices and signal locations were created for this explanation.
The Portfolio.from_signals documentation cautions that close-generated signals should be shifted forward and, more generally, that the execution price should come after the signal. That is an information-ordering requirement. It does not claim that every delay is exactly one candle or that every shifted price is executable for every order.
The tool below follows the spirit of a controlled comparison while remaining independent of vectorbt. It does not import library code or claim to reproduce all portfolio-engine rules. One buy and one sale are enough to expose the timing relationship without adding cash allocation, order priority or multiple interacting signals.
Fix the data and the signal schedule
Use seven fictional closes, indexed from zero: 100, 99.5, 106, 108, 105.5, 98 and 101. An authored entry signal occurs at index 1 and an authored exit signal at index 4. Both scenarios trade ten base units and charge 20 basis points on each executed notional. No claim is made that a real indicator produced these signals.
| Index | Close | Role in the example |
|---|---|---|
| 0 | 100 | Earlier observation |
| 1 | 99.5 | Entry signal at this close |
| 2 | 106 | Following close for delayed entry |
| 3 | 108 | Intermediate observation |
| 4 | 105.5 | Exit signal at this close |
| 5 | 98 | Following close for delayed exit |
| 6 | 101 | Later observation |
The same-close reference buys at 99.5 and sells at 105.5. Its gross result is ten multiplied by six, or 60. The entry and exit notionals sum to 2,050. Fees at 0.2% total 4.10, leaving +55.90. The reference is an explicit assumption, not evidence that the closing price was available after the decision.
Change only the execution lookup
The following-close scenario uses indices 2 and 5 while preserving the original signal locations. It buys at 106 and sells at 98. Gross P&L is −80. Executed notional totals 2,040, so fees are 4.08 and net P&L is −84.08. The gap between the scenarios is −139.98.
| Scenario | Buy price | Sell price | Gross result | Fees | Net |
|---|---|---|---|---|---|
| Same-close reference | 99.5 | 105.5 | +60 | 4.10 | +55.90 |
| Following-close execution | 106 | 98 | −80 | 4.08 | −84.08 |
Both fee calculations use the same rate, but their cash amounts differ because the execution notionals differ. Holding the fee amount fixed instead would introduce another modelling choice. The independent ledger keeps that distinction visible rather than attributing the entire net change to a single generic slippage number.
The result does not establish that delayed execution always performs worse. Another authored path could favour the later prices. Its purpose is to demonstrate that timing can be decisive and that a source-data match does not imply an equivalent experiment.
Use the delay explorer
The entry and exit indices identify decisions, not orders already executed. The calculator requires an observation after each one and rejects an exit before the entry. It does not wrap the last signal back to the start of the array or quietly drop a missing delayed exit. That would manufacture a complete trade from an incomplete horizon.
Change the fee rate to zero to isolate the gross price effect, or change quantity while keeping prices fixed to inspect scaling. Keep those variations labelled. Changing both the signal schedule and execution rule at once would stop this from being a clean timing comparison.
Why next close is not next open
A close is an endpoint of an interval. The following close occurs after another whole interval has elapsed. The next open may be much earlier, depending on the data and market session. A model that waits for the following close has a different exposure path from one that acts at the next opening observation.
Our input file contains closes only, so the tool cannot infer opening prices. Interpolating an opening price from adjacent closes would add a new assumption, not recover missing information. If the intended study concerns next-open execution, use a dataset and rule that explicitly supply it.
Nor does one bar imply a fixed real-time delay across datasets. A one-minute bar, an hourly bar and a daily session represent different intervals. A report should preserve the bar definition, time zone, session treatment and the timestamp convention used for each observation.
Availability has more than one clock
For a close-derived rule, distinguish the end of the market interval, receipt of the data, completion of the calculation, order submission and potential execution. Those times can differ even when a table has only one timestamp column. The experiment should identify which event that column represents.
A saved historical value may also be revised later. Correctly delaying the signal does not establish that the input was available in its current form at the original decision time. Timing of execution and timing of information availability are related controls, but one does not substitute for the other.
Similarly, shifting the final signal array cannot repair an indicator that used future rows while it was calculated. A controlled study needs both causal feature construction and a valid execution sequence. The small tool checks neither a real indicator implementation nor a provider’s publication history.
A comparison protocol that preserves the question
| Element | Control |
|---|---|
| Input data | Same identified observations and units |
| Signal locations | Same decisions before applying execution offsets |
| Quantity and fee rule | Same policy, with cash costs recalculated at each execution price |
| Execution mapping | Explicit same-close, next-close or other defined lookup |
| Unavailable exit | Report incomplete horizon rather than invent a closing fill |
| Outputs | Prices, gross P&L, fees and net result separately |
For a multi-trade strategy, timing can also affect capital availability and subsequent order size. A later exit may overlap the next entry. A real engine may resolve simultaneous signals differently. Those feedbacks require an actual configured rerun; they are not present in this isolated fixed-quantity trade.
Do not select the delay after seeing the winner
A researcher who tries many offsets and reports only the most attractive one has changed a timing audit into a search. Preserve the planned comparison and all tested variants. The goal is to establish which execution assumption the result depends on, not to discover another favourable way to draw the same historical curve.
The authored seven-price example was designed to make the dependence obvious. Its striking sign reversal is not a statistical estimate. It has no sample of independent trades, confidence interval or inference about a market. A reader can reproduce every number without mistaking the demonstration for evidence of a profitable or unprofitable strategy.
Describe the holding period accurately
The reference owns the position after index 1 and exits at index 4; the delayed version enters after index 2 and exits at index 5. Both span three index intervals, but they are exposed to different price changes. Equal holding-period length therefore does not establish equivalent market exposure. The rise into the later entry and the decline into the later exit are excluded and included differently by construction.
Keep the unit of delay in the result label. A statement that performance changed “with realistic latency” would be unsupported here because no measured order-transmission or matching delay was supplied. “Following-close sensitivity with fixed authored signals” describes exactly what was calculated. A future study could add observed timestamps and execution records, but those would be new evidence with their own completeness requirements.
Methodology and practical next steps
DN reran six checks covering +55.90, −84.08, their −139.98 difference, a zero-quantity boundary and invalid price/index inputs. No seed is needed because the experiment has no randomness. Full fills, fixed quantity and a constant fee rate are assumptions; liquidity, funding, gaps and account constraints are outside scope.
Use the Trading Tool Lab to keep the input and result together. A Research Desk comparison can then ask the more specific question: which price was available after this decision, and what evidence supports using it?
Download the dated source and scenario record (JSON) · Download the reproducible calculation pack (ZIP).
Frequently asked questions
Does a one-bar delay always reduce returns?
No. It can help or hurt on a particular price path. This authored example demonstrates dependence, not an average effect.
Is the delayed price the next open?
No. This tool explicitly uses the following close and does not contain opening prices.
Does shifting a signal fix all look-ahead bias?
No. Future information inside feature construction or revised inputs needs separate investigation.
Was vectorbt run?
No. Its documentation informed the timing question; the calculation is independently authored.
Primary sources and evidence
- vectorbt portfolio timing guidance. Close-generated signal shifting and requirement to use a price after the signal. Checked 2026-11-28.
Editorial disclosure: This research explains documented capabilities and original worked examples. Inclusion does not imply endorsement, a commercial relationship or verified trading performance. No placement in this article was purchased.
Corrections and updates: Send source-backed corrections to press@decentralised.news. This 2027 edition was checked on 28 November 2026; documentation, permissions and product availability can change.




