code: def parse_args(pargs=None):
      parser = argparse.ArgumentParser(
          formatter_class=argparse.ArgumentDefaultsHelpFormatter,
          description="Sample for Signal concepts",
      )
  
      parser.add_argument(
          "--data",
          required=False,
          default="../../datas/2005-2006-day-001.txt",
          help="Specific data to be read in",
      )
  
      parser.add_argument(
          "--fromdate",
          required=False,
          default=None,
          help="Starting date in YYYY-MM-DD format",
      )
  
      parser.add_argument(
          "--todate",
          required=False,
          default=None,
          help="Ending date in YYYY-MM-DD format",
      )
  
      parser.add_argument(
          "--cash",
          required=False,
          action="store",
          type=float,
          default=50000,
          help=("Cash to start with"),
      )
  
      parser.add_argument(
          "--smaperiod",
          required=False,
          action="store",
          type=int,
          default=30,
          help=("Period for the moving average"),
      )
  
      parser.add_argument(
          "--exitperiod",
          required=False,
          action="store",
          type=int,
          default=5,
          help=("Period for the exit control SMA"),
      )
  
      parser.add_argument(
          "--signal",
          required=False,
          action="store",
          default=MAINSIGNALS.keys()[0],
          choices=MAINSIGNALS,
          help=("Signal type to use for the main signal"),
      )
  
      parser.add_argument(
          "--exitsignal",
          required=False,
          action="store",
          default=None,
          choices=EXITSIGNALS,
          help=("Signal type to use for the exit signal"),
      )
  
      # Plot options
      parser.add_argument(
          "--plot",
          "-p",
          nargs="?",
          required=False,
          metavar="kwargs",
          const=True,
          help=(
              "Plot the read data applying any kwargs passed\n"
              "\n"
              "For example:\n"
              "\n"
              '  --plot style="candle" (to plot candles)\n'
          ),
      )
  
      if pargs is not None:
          return parser.parse_args(pargs)
  
      return parser.parse_args()
  
file_path: backtrader/samples/signals-strategy/signals-strategy.py
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import argparse
  import collections
  import datetime
  import backtrader
label_desc: Use image node_id 2 for calling a global function with example usage: parse_args(pargs) and returns: parser, parser