code: def get_stop_price_trigger(action, stopPrice, useAdjustedValues, bar):
      ret = None
      open_ = bar.getOpen(useAdjustedValues)
      high = bar.getHigh(useAdjustedValues)
      low = bar.getLow(useAdjustedValues)
  
      # If the bar is above the stop price, use the open price.
      # If the bar includes the stop price, use the open price or the stop price. Whichever is better.
      if action in [
          broker.Order.Action.BUY,
          broker.Order.Action.BUY_TO_COVER,
      ]:
          if low > stopPrice:
              ret = open_
          elif stopPrice <= high:
              if (
                  open_ > stopPrice
              ):  # The stop price was penetrated on open.
                  ret = open_
              else:
                  ret = stopPrice
      # If the bar is below the stop price, use the open price.
      # If the bar includes the stop price, use the open price or the stop price. Whichever is better.
      elif action in [
          broker.Order.Action.SELL,
          broker.Order.Action.SELL_SHORT,
      ]:
          if high < stopPrice:
              ret = open_
          elif stopPrice >= low:
              if (
                  open_ < stopPrice
              ):  # The stop price was penetrated on open.
                  ret = open_
              else:
                  ret = stopPrice
      else:  # Unknown action
          assert False
  
      return ret
  
imports: import abc
  import six
  from pyalgotrade import broker
  import pyalgotrade.bar
  from .None import slippage
label_desc: Use image node_id 2 for calling a global function with example usage: get_stop_price_trigger(action, stopPrice, useAdjustedValues, bar) and returns: ret