# Signal Algorithm

The Signal algorithm places orders on the exchange based on trading signals received from Telegram channels. MoonTrader's built-in Telegram bot monitors the specified channels and automatically places an order when a signal arrives — using the parameters from that signal: entry price, Take Profit, and Stop Loss.

The algorithm does not analyze the market on its own — it relies entirely on external signals. You decide which channels to trust and how to parse their messages; the algorithm handles execution.

***

### How the Algorithm Works

#### How It Works

1. **Receiving a signal**

   BotClient connects to your Telegram account and monitors the selected channels. When a new message appears in a channel, the bot parses it according to the configured parsing rules and passes the signal to the algorithm.
2. **Latency check**

   The algorithm checks how fresh the signal is. If more time has passed since publication than the value set in Max Signal Latency — the order is not placed. The same check applies to exchange data latency.
3. **Placing an order**

   If all checks pass, the algorithm places an order using the direction, type, size, and price from the signal and algorithm settings.
4. **Position management**

   Once the order is filled, Take Profit and Stop Loss are activated. Priority logic:

   | In signal     | In algorithm  | Result                          |
   | ------------- | ------------- | ------------------------------- |
   | TP/SL present | No TP/SL      | TP/SL are not placed            |
   | No TP/SL      | TP/SL present | TP/SL from algorithm are placed |
   | TP/SL present | TP/SL present | TP/SL from signal are placed    |

***

### Setup: Configuring BotClient

Before running the algorithm, you need to connect your Telegram account in BotClient and select the channels to monitor.

#### Step 1. Connect your Telegram account

1. Open BotClient and go to **Profile → Telegram Profile**.
2. Click **Login**.
3. Enter your phone number.
4. Enter the code from Telegram.
5. Enter your password if two-factor authentication is enabled.

Once authorized, the **Profile → Telegram Profile** section will show the `AUTHENTICATED` status, account name, and phone number.

#### Step 2. Select channels to monitor

1. Go to **Algorithms → Signals → Channels**.
2. Select the channels whose signals you want to process.
3. Click **Execute**.

#### Step 3. Configure parsing rules (optional)

Individual parsing rules can be set for each channel: **Algorithms → Signals → Channel Settings**.

| Field                  | Description                                | Example            |
| ---------------------- | ------------------------------------------ | ------------------ |
| Words to ignore        | Words that cause the message to be ignored | `SCAM, CALLED`     |
| Words to buy           | Words indicating a buy signal              | `BUY, LONG`        |
| Words to sell          | Words indicating a sell signal             | `SELL, SHORT`      |
| Words to spot market   | Words identifying spot market              | `SPOT`             |
| Words to USDT-M market | Words identifying futures market           | `FUTURES, USDT-M`  |
| Words to COIN-M market | Words identifying COIN-M market            | `DELIVERY, COIN-M` |

After setup, BotClient will monitor the selected channels and automatically forward signals to all connected cores.

#### Signal format

By default, BotClient recognizes signals in the following format:

```
Binance
USDT-M
sell galausdt
tp 3%
sl 4%
```

The exchange and market type lines determine where the order is placed. Direction, pair, Take Profit, and Stop Loss are taken directly from the signal text.

> ⚠️ Other signal formats are not currently supported.

> For full BotClient installation and feature details, see the [BotClient](/en-moontrader-docs/tips-and-recommendations/bot-client-managing-moontrader-via-telegram.md) section.

***

### Algorithm Settings

#### Algorithm Parameters

#### Channels

Enter the names of the Telegram channels from which the algorithm will receive signals.

A single Signal algorithm can listen to multiple channels at the same time. For different strategies, it is convenient to create separate algorithms with different channel sets.

> ⚠️ A channel must be added and activated in BotClient — otherwise no signals from it will be received.

#### Max Signal Latency

The maximum time in seconds the algorithm will wait for a signal. If the signal is not received within this period — it is ignored.

#### Do Not Trigger If Active

When enabled, the algorithm does not process a new signal while an active order from the previous signal is still open. The next signal will only be accepted after the previous order is cancelled.

***

> If the algorithm is set to Buy but the signal arrives with direction Sell — the order will not be placed.

***

### Contact and Support

If you have questions about configuring the algorithm or would like to suggest improvements, please reach out to [support](https://t.me/moontrader_support_en).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://guide.moontrader.com/en-moontrader-docs/trading/trading-algorithms/signal-algorithm.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
