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

Indicator Period Days or Trading Days?

  • Hi,

    Just wanted to clarify a basic one - when you set the period in an indicator (i.e. SMA), is this period equal to trading days (i.e. count of dates in the data feed)... OR... calendar days?

    Eg. bt.indicators.SimpleMovingAverage(d, period=30) for a theoretical ending date of 14 June 2017, will the window start on 15 May 2017, or several days earlier (if using trading days).

    Thank you!

  • My understanding is most of the time parameters like period apply to data points, so that would imply trading days, or points in your data feed (in short, the first thing in your question). backtrader is not aware of time frames, just data points.

  • administrators

    So it is, or else working in different timeframes wouldn't be feasible. Furthermore it would seem pointless to define a period of 30 and get a different number of items in the calculation.

    This is, on the other hand, nothing specific to this library.

  • Cool thanks guys