class_docstr: This strategy is capable of:
  
    - Going Long with a Moving Average upwards CrossOver
  
    - Going Long again with a MACD upwards CrossOver
  
    - Closing the aforementioned longs with the corresponding downwards
      crossovers
class_docstr_tok: ["This","strategy","is","capable","of",":","-","Going","Long","with","a","Moving","Average","upwards","CrossOver","-","Going","Long","again","with","a","MACD","upwards","CrossOver","-","Closing","the","aforementioned","longs","with","the","corresponding","downwards","crossovers"]
code: def next(self):
      tfields = [
          self.p.myname,
          len(self),
          self.data.datetime.date(),
          self.getposition(self.data0).size,
      ]
      if len(self.datas) > 1:
          tfields.append(self.getposition(self.data1).size)
  
      print(",".join(str(x) for x in tfields))
  
      buysize = self.p.stake // 2  # let each signal buy half
      if self.macdsig[0] > 0.0:
          self.buy(data=self.dtarget, size=buysize)
  
      if self.smasig[0] > 0.0:
          self.buy(data=self.dtarget, size=buysize)
  
      size = self.getposition(self.dtarget).size
  
      # if 2x in the market, let each potential close ... close 1/2
      if size == self.p.stake:
          size //= 2
  
      if self.macdsig[0] < 0.0:
          self.close(data=self.dtarget, size=size)
  
      if self.smasig[0] < 0.0:
          self.close(data=self.dtarget, size=size)
  
file_path: backtrader/samples/multi-copy/multi-copy.py
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import argparse
  import datetime
  import random
  import backtrader
label_desc: Use image node_id 4 for calling the TheStrategy obj's underlying member method code with example usage: obj.next() without return types