> For the complete documentation index, see [llms.txt](https://ats-doc.gitbook.io/v1/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ats-doc.gitbook.io/v1/getting-started/sample-trading-configs.md).

# Sample Trading Configs

## Configuring a Strategy

You can configure strategies through our APIs or the simple trading UI. Following diagrams illustrates how to add or edit strategies.

<figure><img src="https://2746252044-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FA2awBtq48tyAooIk6oKT%2Fuploads%2FzvALDBbyHUOmNeboXcDn%2Fimage.png?alt=media&amp;token=0fa6a65e-cf0d-4975-a8db-933f850d3b15" alt="" width="563"><figcaption><p>Trading UI: Adding a trade config</p></figcaption></figure>

<figure><img src="https://2746252044-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FA2awBtq48tyAooIk6oKT%2Fuploads%2FWgTh8mdXSpqkO2XauQaQ%2Fimage.png?alt=media&amp;token=7504466b-8f8c-407a-8b69-902a4eb5ea11" alt="" width="563"><figcaption><p>Trading UI: Editing a trade config</p></figcaption></figure>

Once you choose to add or edit the trading configs, you will get a window where you can configure Exchange Configs, Strategy Configs and Plotting Configs.

<figure><img src="https://2746252044-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FA2awBtq48tyAooIk6oKT%2Fuploads%2FCraLj7pT1CtorcQY6fpr%2Fimage.png?alt=media&amp;token=6d73e9e3-82c8-404c-a55c-b754eb103408" alt="" width="563"><figcaption><p>Trading Config UI</p></figcaption></figure>

***

## Simple Moving Average Strategy

This strategy places buy and sell orders based on a combination of moving average (MA) signals and a secondary confirmation signal using either the Relative Strength Index (RSI) or On-Balance Volume (OBV). It supports trading in both long and short positions, with configurable parameters to suit individual needs.

> **Note**: This implementation is intended as a demonstration and should not be considered a complete or fully optimized trading strategy. It serves to illustrate the combination of moving average signals and secondary indicators for educational and exploratory purposes.

#### Trading Modes:

* The strategy supports trading both long and short positions, determined by the `go_long` and `go_short` parameters. By default, `go_long=True` and `go_short=False`.

#### Signal Generation:

1. **Primary Signal - Moving Average Crossover**:
   * A primary buy signal is generated when the fast (short) MA crosses above the slow (long) MA.
   * A primary sell signal is generated when the fast MA crosses below the slow MA.
2. **Secondary Signal Confirmation**:
   * A secondary confirmation is performed using either the OBV or RSI indicator based on the configuration (`use_obv` parameter).
   * If `use_obv=True`, the OBV indicator is used for confirmation:
     * A buy signal is triggered if the current timestep's OBV change is the maximum within the past `obv_window_length` changes.
     * A sell signal is triggered if the current timestep's OBV change is the minimum within the same window.
   * If `use_obv=False` (default), the RSI indicator is used for confirmation:
     * A buy signal is triggered when RSI > `100 + rsi_d`.
     * A sell signal is triggered when RSI < `rsi_d`.

#### Exit Conditions:

* The exit points for trades are determined by take-profit (TP) and stop-loss (SL) levels, which are calculated as multiples of market volatility. The `tp_multiple` and `sl_multiple` parameters control the magnitude of these levels.

#### Trading Job Config - Back Trading

The back-trading config uses the standard backtrading exchange class to run the trading.

> **Note:** Search for `<<Path to candle data csv file>>` and  replace with `tests/data/BTC_USDT_short.csv` for quick testing.

{% file src="/files/34c9KH8gdwuAJMPRGMhz" %}

#### Trading Job Config - Live Trading

The live trading config is for connecting to Binance Spot APIs.

{% file src="/files/ASraNH6q8n5Htz9nzQrX" %}

#### Plot Config - Back Trading

{% file src="/files/IYt1AYJVHXWw3mHj7cBP" %}

#### Plot Config - Live Trading

{% file src="/files/gijsgDVEctVljRG40r9z" %}

## Simple LSTM Strategy

This strategy places buy and sell orders based on signals generated by an AI model, with additional confirmation from either the Relative Strength Index (RSI) or On-Balance Volume (OBV). The strategy is configurable to trade in both long and short positions.

> **Note**: This implementation is meant for demonstration purposes and should not be considered a fully developed or optimized trading strategy. It is designed to illustrate the use of AI-based signals combined with traditional indicators.

#### Trading Modes:

* The strategy supports trading both long and short positions, which are controlled by the `go_long` and `go_short` parameters. By default, `go_long=True` and `go_short=False`.

#### Signal Generation:

1. **Primary Signal - AI Model Output**:
   * The primary signal is derived from the output of the AI model.
   * If the AI model's output (`ai_val`) is `1`, a buy signal is generated.
   * If the AI model's output (`ai_val`) is `2`, a sell signal is generated.
2. **Secondary Signal Confirmation**:
   * A secondary confirmation is performed using either the OBV or RSI indicator based on the `use_obv` configuration.
   * If `use_obv=True`, the OBV indicator is utilized:
     * A buy signal is confirmed if the current timestep's OBV change is the maximum within the past `obv_window_length` changes.
     * A sell signal is confirmed if the current timestep's OBV change is the minimum within the same window.
   * If `use_obv=False` (default), the RSI indicator is utilized:
     * A buy signal is confirmed when RSI > `100 + rsi_d`.
     * A sell signal is confirmed when RSI < `rsi_d`.

#### Exit Conditions:

* The exit strategy uses take-profit (TP) and stop-loss (SL) levels, which are determined as multiples of market volatility. These are controlled by the `tp_multiple` and `sl_multiple` parameters.

#### Trading Job Config - Back Trading

> **Note:** Search for `<<Path to candle data csv file>>` and  replace with `tests/data/BTC_USDT_short.csv` for quick testing.

{% file src="/files/gGxOTVz4ynGRSoqFz07k" %}

#### Trading Job Config - Live Trading

{% file src="/files/WeToRFOwDbQjnRrdheYM" %}

#### Plot Config - Back Trading

{% file src="/files/eiteXC01enyAoKjpQdEo" %}

#### Plot Config - Live Trading

{% file src="/files/iJLt5YTPHxPPVpmXGk6X" %}
