code: def next(self):
      if self.orderid:
          return  # if an order is active, no new orders are allowed
  
      if self.p.printout:
          print("Self  len:", len(self))
          print("Data0 len:", len(self.data0))
          print("Data1 len:", len(self.data1))
          print(
              "Data0 len == Data1 len:",
              len(self.data0) == len(self.data1),
          )
  
          print("Data0 dt:", self.data0.datetime.datetime())
          print("Data1 dt:", self.data1.datetime.datetime())
  
      print("status is", self.status)
      print("zscore is", self.zscore[0])
  
      # Step 2: Check conditions for SHORT & place the order
      # Checking the condition for SHORT
      if (self.zscore[0] > self.upper_limit) and (self.status != 1):
          # Calculating the number of shares for each stock
          value = 0.5 * self.portfolio_value  # Divide the cash equally
          x = int(
              value / (self.data0.close)
          )  # Find the number of shares for Stock1
          y = int(
              value / (self.data1.close)
          )  # Find the number of shares for Stock2
          print("x + self.qty1 is", x + self.qty1)
          print("y + self.qty2 is", y + self.qty2)
  
          # Placing the order
          self.log(
              "SELL CREATE %s, price = %.2f, qty = %d"
              % ("PEP", self.data0.close[0], x + self.qty1)
          )
          self.sell(
              data=self.data0, size=(x + self.qty1)
          )  # Place an order for buying y + qty2 shares
          self.log(
              "BUY CREATE %s, price = %.2f, qty = %d"
              % ("KO", self.data1.close[0], y + self.qty2)
          )
          self.buy(
              data=self.data1, size=(y + self.qty2)
          )  # Place an order for selling x + qty1 shares
  
          # Updating the counters with new value
          self.qty1 = (
              x  # The new open position quantity for Stock1 is x shares
          )
          self.qty2 = (
              y  # The new open position quantity for Stock2 is y shares
          )
  
          self.status = 1  # The current status is "short the spread"
  
          # Step 3: Check conditions for LONG & place the order
          # Checking the condition for LONG
      elif (self.zscore[0] < self.lower_limit) and (self.status != 2):
          # Calculating the number of shares for each stock
          value = 0.5 * self.portfolio_value  # Divide the cash equally
          x = int(
              value / (self.data0.close)
          )  # Find the number of shares for Stock1
          y = int(
              value / (self.data1.close)
          )  # Find the number of shares for Stock2
          print("x + self.qty1 is", x + self.qty1)
          print("y + self.qty2 is", y + self.qty2)
  
          # Place the order
          self.log(
              "BUY CREATE %s, price = %.2f, qty = %d"
              % ("PEP", self.data0.close[0], x + self.qty1)
          )
          self.buy(
              data=self.data0, size=(x + self.qty1)
          )  # Place an order for buying x + qty1 shares
          self.log(
              "SELL CREATE %s, price = %.2f, qty = %d"
              % ("KO", self.data1.close[0], y + self.qty2)
          )
          self.sell(
              data=self.data1, size=(y + self.qty2)
          )  # Place an order for selling y + qty2 shares
  
          # Updating the counters with new value
          self.qty1 = (
              x  # The new open position quantity for Stock1 is x shares
          )
          self.qty2 = (
              y  # The new open position quantity for Stock2 is y shares
          )
          self.status = 2  # The current status is "long the spread"
  
          # Step 4: Check conditions for No Trade
          # If the z-score is within the two bounds, close all
      """
          elif (self.zscore[0] < self.up_medium and self.zscore[0] > self.low_medium):
              self.log('CLOSE LONG %s, price = %.2f' % ("PEP", self.data0.close[0]))
              self.close(self.data0)
              self.log('CLOSE LONG %s, price = %.2f' % ("KO", self.data1.close[0]))
              self.close(self.data1)
          """
  
file_path: backtrader/contrib/samples/pair-trading/pair-trading.py
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import argparse
  import datetime
  import backtrader
  import backtrader.feeds
  import backtrader.indicators
label_desc: Use image node_id 4 for calling the PairTradingStrategy obj's underlying member method code with example usage: obj.next() without return types