Skip to content

Commit

Permalink
DOC: Mention that different lengths of indicators affect results
Browse files Browse the repository at this point in the history
Closes #674
  • Loading branch information
kernc committed Dec 12, 2022
1 parent 3bccbd9 commit d7eaa45
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion backtesting/backtesting.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def I(self, # noqa: E743
name=None, plot=True, overlay=None, color=None, scatter=False,
**kwargs) -> np.ndarray:
"""
Declare indicator. An indicator is just an array of values,
Declare an indicator. An indicator is just an array of values,
but one that is revealed gradually in
`backtesting.backtesting.Strategy.next` much like
`backtesting.backtesting.Strategy.data` is.
Expand Down Expand Up @@ -1173,6 +1173,13 @@ def run(self, **kwargs) -> pd.Series:
_equity_curve Eq...
_trades Size EntryB...
dtype: object
.. warning::
You may obtain different results for different strategy parameters.
E.g. if you use 50- and 200-bar SMA, the trading simulation will
begin on bar 201. The actual length of delay is equal to the lookback
period of the `Strategy.I` indicator which lags the most.
Obviously, this can affect results.
"""
data = _Data(self._data.copy(deep=False))
broker: _Broker = self._broker(data=data)
Expand Down

0 comments on commit d7eaa45

Please sign in to comment.