Skip to content

Commit

Permalink
DOC: Further warning that indicator lengths can affect results
Browse files Browse the repository at this point in the history
Refs: d7eaa45

Fixes #1184
  • Loading branch information
kernc committed Jan 28, 2025
1 parent d1d26f7 commit 44fcb02
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions backtesting/backtesting.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,13 @@ def I(self, # noqa: E743
def init():
self.sma = self.I(ta.SMA, self.data.Close, self.n_sma)
.. warning::
Rolling indicators may front-pad warm-up values with NaNs.
In this case, the **backtest will only begin on the first bar when
all declared indicators have non-NaN values** (e.g. bar 201 for a
strategy that uses a 200-bar MA).
This can affect results.
"""
def _format_name(name: str) -> str:
return name.format(*map(_as_str, args),
Expand Down

0 comments on commit 44fcb02

Please sign in to comment.