class_docstr: A strategy with automatic trailing stop-loss, trailing the current
  price at distance of some multiple of average true range (ATR). Call
  `TrailingStrategy.set_trailing_sl()` to set said multiple
  (`6` by default). See [tutorials] for usage examples.
  
  [tutorials]: index.html#tutorials
  
  Remember to call `super().init()` and `super().next()` in your
  overridden methods.
docstr: Set the lookback period for computing ATR. The default value
  of 100 ensures a _stable_ ATR.
docstr_tok: ["Set","the","lookback","period","for","computing","ATR",".","The","default","value","of","100","ensures","a","_stable_","ATR","."]
code: def set_atr_periods(self, periods: int = 100):
      """
      Set the lookback period for computing ATR. The default value
      of 100 ensures a _stable_ ATR.
      """
      hi, lo, c_prev = (
          self.data.High,
          self.data.Low,
          pd.Series(self.data.Close).shift(1),
      )
      tr = np.max(
          [hi - lo, (c_prev - hi).abs(), (c_prev - lo).abs()], axis=0
      )
      atr = pd.Series(tr).rolling(periods).mean().bfill().values
      self.__atr = atr
  
imports: from collections import OrderedDict
  from inspect import currentframe
  from itertools import compress
  from numbers import Number
  from typing import Callable, Optional, Sequence, Union
  import numpy
  import pandas
  from ._plotting import plot_heatmaps
  from ._stats import compute_stats
  from ._util import _Array, _as_str
  from .backtesting import Strategy
label_desc: Use image node_id 2 for calling the TrailingStrategy obj's underlying member method code with example usage: obj.set_atr_periods(periods) without return types