traders_copilot_mzza_25.indicators

Functions

calculate_sma(data[, window, fillna])

Calculate the Simple Moving Average (SMA) for the given data.

calculate_rsi(data[, window, fillna])

Calculate the Relative Strength Index (RSI) measuring the speed and change of price movements.

Module Contents

traders_copilot_mzza_25.indicators.calculate_sma(data, window=50, fillna=False)[source]

Calculate the Simple Moving Average (SMA) for the given data.

Parameters:
  • data (pandas.DataFrame) – DataFrame containing stock price data with a ‘Close’ column.

  • window (int, optional) – The number of periods to calculate the SMA (default is 50).

  • fillna (bool, optional) – Whether to fill NaN values (default is False).

Returns:

DataFrame with an additional column for the SMA.

Return type:

pandas.DataFrame

Examples

>>> data = pd.DataFrame({'Close': [100, 102, 104, 106, 108]})
>>> result = calculate_sma(data, window=3)
>>> print(result['SMA_3'])
traders_copilot_mzza_25.indicators.calculate_rsi(data, window=14, fillna=False)[source]

Calculate the Relative Strength Index (RSI) measuring the speed and change of price movements.

Parameters:
  • data (pandas.DataFrame) – DataFrame containing stock price data with a ‘Close’ column.

  • window (int, optional) – Number of periods for RSI calculation (default is 14).

  • fillna (bool, optional) – Whether to fill NaN values (default is False).

Returns:

DataFrame with an additional column for RSI.

Return type:

pandas.DataFrame

Examples

>>> data = pd.DataFrame({'Close': [100, 102, 104, 106, 108]})
>>> result = calculate_rsi(data, window=3)
>>> print(result['RSI'])