Skip to content

Commit 44fcb02

Browse files
committed
DOC: Further warning that indicator lengths can affect results
Refs: d7eaa45 Fixes #1184
1 parent d1d26f7 commit 44fcb02

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

backtesting/backtesting.py

+7
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,13 @@ def I(self, # noqa: E743
119119
120120
def init():
121121
self.sma = self.I(ta.SMA, self.data.Close, self.n_sma)
122+
123+
.. warning::
124+
Rolling indicators may front-pad warm-up values with NaNs.
125+
In this case, the **backtest will only begin on the first bar when
126+
all declared indicators have non-NaN values** (e.g. bar 201 for a
127+
strategy that uses a 200-bar MA).
128+
This can affect results.
122129
"""
123130
def _format_name(name: str) -> str:
124131
return name.format(*map(_as_str, args),

0 commit comments

Comments
 (0)