> For the complete documentation index, see [llms.txt](https://quantitative-algorithms-by-max-h.gitbook.io/predator-trading-system/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://quantitative-algorithms-by-max-h.gitbook.io/predator-trading-system/overview/predator-script-documentation/predator-script/commands/built-in-indicators.md).

# Built-In Indicators

#### Moving Average (SMA)

* **Description:** Calculates the Simple Moving Average (SMA) over a specified period.
* **Parameters:**
  * `period (int)`: The number of periods over which to calculate the average.
  * `start (str)`: The start date for the calculation.
  * `end (str)`: The end date for the calculation.

**Example Usage:**

```python
sma_command = SMACommand(start="2023-01-01", end="2023-06-30", period=14)
sma_result = sma_command.execute(data_provider)
```

***

####

#### Relative Strength Index (RSI)

* **Description:** Calculates the Relative Strength Index (RSI), a momentum oscillator that measures the speed and change of price movements.
* **Parameters:**
  * `period (int)`: The number of periods over which to calculate the RSI. Default is 14.
  * `start (str)`: The start date for the calculation.
  * `end (str)`: The end date for the calculation.

**Example Usage:**

```python
rsi_command = RSICommand(start="2023-01-01", end="2023-06-30", period=14)
rsi_result = rsi_command.execute(data_provider)
```

***

####

#### Moving Average Convergence Divergence (MACD)

* **Description:** Calculates the Moving Average Convergence Divergence (MACD), a trend-following momentum indicator that shows the relationship between two moving averages of a security’s price.
* **Parameters:**
  * `fast_period (int)`: The short period for the fast-moving average. Default is 12.
  * `slow_period (int)`: The long period for the slow-moving average. Default is 26.
  * `signal_period (int)`: The period for the signal line (usually 9). Default is 9.
  * `start (str)`: The start date for the calculation.
  * `end (str)`: The end date for the calculation.

**Example Usage:**

```python
macd_command = MACDCommand(start="2023-01-01", end="2023-06-30", fast_period=12, slow_period=26, signal_period=9)
macd_result = macd_command.execute(data_provider)
```

***

####

#### Bollinger Bands

* **Description:** Calculates Bollinger Bands, which are a type of statistical chart characterizing the prices and volatility over time, using a formulaic method.
* **Parameters:**
  * `period (int)`: The number of periods over which to calculate the moving average. Default is 20.
  * `std_dev (float)`: The number of standard deviations to use for the bands. Default is 2.
  * `start (str)`: The start date for the calculation.
  * `end (str)`: The end date for the calculation.

**Example Usage:**

```python
bollinger_command = BollingerBandsCommand(start="2023-01-01", end="2023-06-30", period=20, std_dev=2)
sma, upper_band, lower_band = bollinger_command.execute(data_provider)
```

***

####

#### Exponential Moving Average (EMA)

* **Description:** Calculates the Exponential Moving Average (EMA), a type of moving average that places greater weight and significance on the most recent data points.
* **Parameters:**
  * `period (int)`: The number of periods over which to calculate the average. Default is 14.
  * `start (str)`: The start date for the calculation.
  * `end (str)`: The end date for the calculation.

**Example Usage:**

```python
ema_command = EMACommand(start="2023-01-01", end="2023-06-30", period=14)
ema_result = ema_command.execute(data_provider)
```

***

####

#### Average True Range (ATR)

* **Description:** Calculates the Average True Range (ATR), a measure of market volatility.
* **Parameters:**
  * `period (int)`: The number of periods over which to calculate the ATR. Default is 14.
  * `start (str)`: The start date for the calculation.
  * `end (str)`: The end date for the calculation.

**Example Usage:**

```python
atr_command = ATRCommand(start="2023-01-01", end="2023-06-30", period=14)
atr_result = atr_command.execute(data_provider)
```

***

####

#### Volume Weighted Average Price (VWAP)

* **Description:** Calculates the Volume Weighted Average Price (VWAP), a trading benchmark used by traders that gives the average price a security has traded at throughout the day, based on both volume and price.
* **Parameters:**
  * `start (str)`: The start date for the calculation.
  * `end (str)`: The end date for the calculation.

**Example Usage:**

```python
vwap_command = VWAPCommand(start="2023-01-01", end="2023-06-30")
vwap_result = vwap_command.execute(data_provider)
```
