For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See:

Period params in indicators

  • If i use an indicator like :

    btind.AverageTrueRange(self.datas[i], period = 14)


     btind.SMA(Close, period = 50)

    Assuming each period is 1 day, is the current day ever included in the period? It would make sense to me that its not including the day the indicator is being called on since then the data cant be used for predictions but i wanted to be sure. If not, how do I know which indicators include the current day and which dont?

  • administrators

    Indicators are designed to know nothing about datetime. The period they operate is measured in price bars (groups of OHLC price components)

    This in turn allows to create indicators on indicators.

    You may of course design a custom indicators which require the source data to carry a datetime payload.

    The period starts counting at the current bar and goes backwards (it cannot obviously go forward)