code: def init(self):
      # In init() and in next() it is important to call the
      # super method to properly initialize the parent classes
      super().init()
  
      # Precompute the two moving averages
      sma1 = self.I(SMA, self.data.Close, self.n1)
      sma2 = self.I(SMA, self.data.Close, self.n2)
  
      # Where sma1 crosses sma2 upwards. Diff gives us [-1,0, *1*]
      signal = (pd.Series(sma1) > sma2).astype(int).diff().fillna(0)
      signal = signal.replace(-1, 0)  # Upwards/long only
  
      # Use 95% of available liquidity (at the time) on each order.
      # (Leaving a value of 1. would instead buy a single share.)
      entry_size = signal * 0.95
  
      # Set order entry sizes using the method provided by
      # `SignalStrategy`. See the docs.
      self.set_signal(entry_size=entry_size)
  
      # Set trailing stop-loss to 2x ATR using
      # the method provided by `TrailingStrategy`
      self.set_trailing_sl(2)
  
file_path: backtesting.py/doc/examples/Strategies Library.py
imports: from backtesting.test import SMA
  import pandas
  from backtesting.lib import SignalStrategy, TrailingStrategy
  from backtesting import Backtest
  from backtesting.test import GOOG
label_desc: Use image node_id 1 for calling the SmaCross obj's underlying member method code with example usage: obj.init() without return types