code: def rsi(
      close,
      length=None,
      scalar=None,
      talib=None,
      drift=None,
      offset=None,
      **kwargs,
  ):
      """Indicator: Relative Strength Index (RSI)"""
      # Validate arguments
      length = int(length) if length and length > 0 else 14
      scalar = float(scalar) if scalar else 100
      close = verify_series(close, length)
      drift = get_drift(drift)
      offset = get_offset(offset)
      mode_tal = bool(talib) if isinstance(talib, bool) else True
  
      if close is None:
          return
  
      # Calculate Result
      if Imports["talib"] and mode_tal:
          from talib import RSI
  
          rsi = RSI(close, length)
      else:
          negative = close.diff(drift)
          positive = negative.copy()
  
          positive[
              positive < 0
          ] = 0  # Make negatives 0 for the postive series
          negative[
              negative > 0
          ] = 0  # Make postives 0 for the negative series
  
          positive_avg = rma(positive, length=length)
          negative_avg = rma(negative, length=length)
  
          rsi = (
              scalar
              * positive_avg
              / (positive_avg + negative_avg.abs())
          )
  
      # Offset
      if offset != 0:
          rsi = rsi.shift(offset)
  
      # Handle fills
      if "fillna" in kwargs:
          rsi.fillna(kwargs["fillna"], inplace=True)
      if "fill_method" in kwargs:
          rsi.fillna(method=kwargs["fill_method"], inplace=True)
  
      # Name and Categorize it
      rsi.name = f"RSI_{length}"
      rsi.category = "momentum"
  
      signal_indicators = kwargs.pop("signal_indicators", False)
      if signal_indicators:
          signalsdf = concat(
              [
                  DataFrame({rsi.name: rsi}),
                  signals(
                      indicator=rsi,
                      xa=kwargs.pop("xa", 80),
                      xb=kwargs.pop("xb", 20),
                      xserie=kwargs.pop("xserie", None),
                      xserie_a=kwargs.pop("xserie_a", None),
                      xserie_b=kwargs.pop("xserie_b", None),
                      cross_values=kwargs.pop("cross_values", False),
                      cross_series=kwargs.pop("cross_series", True),
                      offset=offset,
                  ),
              ],
              axis=1,
          )
  
          return signalsdf
      else:
          return rsi
  
imports: from pandas import DataFrame, concat
  from pandas_ta import Imports
  from pandas_ta.overlap import rma
  from pandas_ta.utils import get_drift, get_offset, verify_series, signals
label_desc: Use image node_id 1 for calling a global function with example usage: rsi(close, length, scalar, talib, drift, offset) and returns: signalsdf, rsi