class_docstr: A simple helper strategy that operates on position entry/exit signals.
  This makes the backtest of the strategy simulate a [vectorized backtest].
  See [tutorials] for usage examples.
  
  [vectorized backtest]: https://www.google.com/search?q=vectorized+backtest
  [tutorials]: index.html#tutorials
  
  To use this helper strategy, subclass it, override its
  `backtesting.backtesting.Strategy.init` method,
  and set the signal vector by calling
  `backtesting.lib.SignalStrategy.set_signal` method from within it.
  
      class ExampleStrategy(SignalStrategy):
          def init(self):
              super().init()
              self.set_signal(sma1 > sma2, sma1 < sma2)
  
  Remember to call `super().init()` and `super().next()` in your
  overridden methods.
docstr: Set entry/exit signal vectors (arrays).
  
  A long entry signal is considered present wherever `entry_size`
  is greater than zero, and a short signal wherever `entry_size`
  is less than zero, following `backtesting.backtesting.Order.size` semantics.
  
  If `exit_portion` is provided, a nonzero value closes portion the position
  (see `backtesting.backtesting.Trade.close()`) in the respective direction
  (positive values close long trades, negative short).
  
  If `plot` is `True`, the signal entry/exit indicators are plotted when
  `backtesting.backtesting.Backtest.plot` is called.
docstr_tok: ["Set","entry\/exit","signal","vectors","(","arrays",")",".","A","long","entry","signal","is","considered","present","wherever","`","entry_size","`","is","greater","than","zero",",","and","a","short","signal","wherever","`","entry_size","`","is","less","than","zero",",","following","`","backtesting.backtesting.Order.size","`","semantics",".","If","`","exit_portion","`","is","provided",",","a","nonzero","value","closes","portion","the","position","(","see","`","backtesting.backtesting.Trade.close","(",")","`",")","in","the","respective","direction","(","positive","values","close","long","trades",",","negative","short",")",".","If","`","plot","`","is","`","True","`",",","the","signal","entry\/exit","indicators","are","plotted","when","`","backtesting.backtesting.Backtest.plot","`","is","called","."]
code: def set_signal(
      self,
      entry_size: Sequence[float],
      exit_portion: Optional[Sequence[float]] = None,
      *,
      plot: bool = True,
  ):
      """
      Set entry/exit signal vectors (arrays).
  
      A long entry signal is considered present wherever `entry_size`
      is greater than zero, and a short signal wherever `entry_size`
      is less than zero, following `backtesting.backtesting.Order.size` semantics.
  
      If `exit_portion` is provided, a nonzero value closes portion the position
      (see `backtesting.backtesting.Trade.close()`) in the respective direction
      (positive values close long trades, negative short).
  
      If `plot` is `True`, the signal entry/exit indicators are plotted when
      `backtesting.backtesting.Backtest.plot` is called.
      """
      self.__entry_signal = self.I(  # type: ignore
          lambda: pd.Series(entry_size, dtype=float).replace(0, np.nan),
          name="entry size",
          plot=plot,
          overlay=False,
          scatter=True,
          color="black",
      )
  
      if exit_portion is not None:
          self.__exit_signal = self.I(  # type: ignore
              lambda: pd.Series(exit_portion, dtype=float).replace(
                  0, np.nan
              ),
              name="exit portion",
              plot=plot,
              overlay=False,
              scatter=True,
              color="black",
          )
  
imports: from collections import OrderedDict
  from inspect import currentframe
  from itertools import compress
  from numbers import Number
  from typing import Callable, Optional, Sequence, Union
  import numpy
  import pandas
  from ._plotting import plot_heatmaps
  from ._stats import compute_stats
  from ._util import _Array, _as_str
  from .backtesting import Strategy
label_desc: Use image node_id 1 for calling the SignalStrategy obj's underlying member method code with example usage: obj.set_signal(entry_size, exit_portion) without return types