class_docstr: This strategy buys/sells upong the close price crossing
  upwards/downwards a Simple Moving Average.
  
  It can be a long-only strategy by setting the param "onlylong" to True
class_docstr_tok: ["This","strategy","buys\/sells","upong","the","close","price","crossing","upwards\/downwards","a","Simple","Moving","Average",".","It","can","be","a","long-only","strategy","by","setting","the","param","``","onlylong","''","to","True"]
code: def next(self):
      if self.orderid:
          return  # if an order is active, no new orders are allowed
  
      if self.signal > 0.0:  # cross upwards
          if self.position:
              self.log("CLOSE SHORT , %.2f" % self.data.close[0])
              self.close()
  
          self.log("BUY CREATE , %.2f" % self.data.close[0])
          self.buy(size=self.p.stake)
  
      elif self.signal < 0.0:
          if self.position:
              self.log("CLOSE LONG , %.2f" % self.data.close[0])
              self.close()
  
          if not self.p.onlylong:
              self.log("SELL CREATE , %.2f" % self.data.close[0])
              self.sell(size=self.p.stake)
  
file_path: backtrader/samples/analyzer-annualreturn/analyzer-annualreturn.py
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import argparse
  import datetime
  import backtrader
  import backtrader.feeds
  import backtrader.indicators
  from backtrader.analyzers import SQN, AnnualReturn, TimeReturn, SharpeRatio, TradeAnalyzer
label_desc: Use image node_id 5 for calling the LongShortStrategy obj's underlying member method code with example usage: obj.next() without return types