Skip to content

Commit d7eaa45

Browse files
committed
DOC: Mention that different lengths of indicators affect results
Closes #674
1 parent 3bccbd9 commit d7eaa45

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

backtesting/backtesting.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def I(self, # noqa: E743
8080
name=None, plot=True, overlay=None, color=None, scatter=False,
8181
**kwargs) -> np.ndarray:
8282
"""
83-
Declare indicator. An indicator is just an array of values,
83+
Declare an indicator. An indicator is just an array of values,
8484
but one that is revealed gradually in
8585
`backtesting.backtesting.Strategy.next` much like
8686
`backtesting.backtesting.Strategy.data` is.
@@ -1173,6 +1173,13 @@ def run(self, **kwargs) -> pd.Series:
11731173
_equity_curve Eq...
11741174
_trades Size EntryB...
11751175
dtype: object
1176+
1177+
.. warning::
1178+
You may obtain different results for different strategy parameters.
1179+
E.g. if you use 50- and 200-bar SMA, the trading simulation will
1180+
begin on bar 201. The actual length of delay is equal to the lookback
1181+
period of the `Strategy.I` indicator which lags the most.
1182+
Obviously, this can affect results.
11761183
"""
11771184
data = _Data(self._data.copy(deep=False))
11781185
broker: _Broker = self._broker(data=data)

0 commit comments

Comments
 (0)