# Triggers and Actions

The system tracks trading events and automatically executes specified actions when they occur. This allows creating complex trading scenarios with automatic algorithm interaction.

**Principle:** configure conditions (triggers) and actions. Connection is established through a unique key.

**Example:** when Stop Loss triggers on BTCUSDT, automatically start Averages algorithm or stop all algorithms.

***

### Available Conditions (Triggers)

* **Market Watcher Signal** — price or volume change
* **Order Filled** — main order execution
* **Take-Profit Filled** — close with profit
* **Stop-Loss Filled** — close with loss
* **Trade Closed** — close by any method
* **Alert** — configured alert trigger

***

### Available Actions

* **Start Algorithm** — full launch
* **Start Algorithm Clone** — temporary copy launch
* **Stop Algorithm** — complete stop
* **Panic Sell** — close all positions
* **Pause Algorithm** — temporary pause

***

### Setup: Step 1 — Creating Action

#### 1. Open Section

"Triggers and Actions" → "Create Action"

***

#### 2. Action Name

Enter clear name: "Stop on BTC loss", "ETH averaging start".

***

#### 3. Add Conditions

"When" → "Add Condition"

#### Market Watcher Signal

Tracks market changes.

⚠️ Requires running Market Watcher.

**Parameters:**

**Signal Source:**

* Price — tracks price change
* QAV — tracks trading volume

**Delta:** change range in percent for trigger

Example: 2–5% → triggers on 2–5% change

**Signal Type:**

* Fall
* Rise
* All

**Trading Pairs:**

* All from Market Watcher
* Whitelist

***

#### Order Filled

Main algorithm order execution (full or partial).

⚠️ Requires running trading algorithm.

***

#### Take-Profit Filled

Position close by Take Profit.

⚠️ Requires algorithm with enabled Take Profit.

***

#### Stop-Loss Filled

Position close by Stop Loss.

⚠️ Requires algorithm with enabled Stop Loss.

***

#### Trade Closed

Position close by any method (TP, SL, manual).

⚠️ Requires running trading algorithm.

***

#### Alert

Configured alert trigger.

⚠️ Requires created and running alert.

**Parameters:**

**Condition and Direction:** as when creating alerts

**Trading Pairs:**

* All
* Whitelist

***

#### Specify Trigger Key

Enter unique key: "btc\_stop", "eth\_entry", "general\_panic".

⚠️ **Important:** remember the key — you'll need it in source algorithm.

***

#### Multiple Conditions (OR Logic)

You can add multiple conditions with one key. Action executes when **any** condition triggers.

**Example:**

Condition 1: TP filled, key "profit\_exit"

Condition 2: Manual close, key "profit\_exit"

Action executes on TP or manual close.

***

#### 4. Add Actions

"Do" → "Add Action"

#### Start Algorithm

Full launch with all settings.

Select algorithm from list.

**Result:** algorithm starts indefinitely with all settings saved.

**Application:**

* Main algorithm start after analysis
* Activation on specific conditions

***

#### Start Algorithm Clone

Temporary copy (clone) launch.

**Parameters:**

**Algorithm:** what to clone

**Trading Pairs:**

* Pair from trigger — clone only on trigger pair
* Whitelist — clone on specified pairs

⚠️ Source algorithm's market filter is replaced with selected source. Other settings are preserved.

**Lifetime:** clone operation duration in seconds

Example: 3600 = 1 hour

**Clone Limit:** maximum simultaneous clones per pair

Example: limit 1 → if trigger fired twice on BTCUSDT, only 1 clone starts.

**Application:**

* Temporary trading on signal
* Averaging after loss close
* Short-term event reaction

***

#### Stop Algorithm

Complete stop of selected or all algorithms.

**Parameters:**

* Selected algorithm
* All algorithms

⚠️ Stops regardless of trigger pair.

**Application:**

* Emergency stop
* Scheduled termination
* Dependent algorithm stop

***

#### Panic Sell

Close all open positions with market orders.

**Trading Pairs:**

* Pair from trigger
* Whitelist

⚠️ Only **positions** are closed, open orders remain.

**Application:**

* Emergency exit on sharp movement
* Loss lock on critical events
* Close before important news

***

#### Pause Algorithm

Temporary pause.

**Parameters:**

**Algorithm:** what to pause

**Duration:** pause time in seconds

**Pause Type:**

* Pair from trigger — pause only on trigger pair
* Whitelist — pause only on specified pairs
* Algorithm — pause on all algorithm pairs

**Application:**

* Pause during instability
* Cooldown after loss series
* Pause during news

***

#### Multiple Actions (AND Logic)

You can add multiple actions. When trigger fires, **all** actions execute simultaneously.

**Example:**

Action 1: Stop "Shots BTC"

Action 2: Panic sell on BTCUSDT

Action 3: Start "Averaging" clone

On trigger simultaneously: Shots stops, positions close, averaging starts.

***

#### 5. Save and Run

Click "Save and Run".

⚠️ **Important:** only running action works. Saved without running is not active.

Status on "Triggers and Actions" tab → "Actions" section.

***

### Setup: Step 2 — Link with Algorithm

After creating action, link it with signal source algorithm.

#### 1. Open Source Algorithm

Select algorithm (Market Watcher, trading, alert).

***

#### 2. Enable Triggers

In "Triggers" section of settings:

1. Enable "Triggers" checkbox
2. Enter key (exactly as in action)
3. "Add Trigger"
4. Select condition types

⚠️ One key per algorithm, but multiple condition types.

***

#### 3. Select Condition Types

Specify which events send signal:

* Order filled
* Take-Profit filled
* Stop-Loss filled
* Trade closed
* Market watcher signal
* Alert

**Example:**

In action two conditions with key "risk\_control":

* Order filled
* Stop-Loss filled

In algorithm key "risk\_control" and selected:

* Stop-Loss filled

**Result:** triggers only on SL. Not on order.

***

#### Trigger Rule

For trigger to fire needs **both matches**:

1. ✅ Key in action = key in algorithm
2. ✅ Condition type in action = type in algorithm

If doesn't match — won't trigger.

***

### Monitoring

After launch, all active triggers on "Triggers and Actions" tab → "Triggers" section.

**Information:**

* Trigger key
* Condition type
* Source algorithm
* Status

***

### Usage Examples

#### Example 1: Stop on Drawdown

**Task:** stop everything on SL on BTCUSDT.

**Action:**

Name: "Emergency stop on BTC loss"

Condition: Stop-Loss filled, key "emergency\_stop"

Action: Stop all algorithms

**Source Algorithm:**

Any trading on BTCUSDT

Triggers: key "emergency\_stop", type Stop-Loss filled

***

#### Example 2: Averaging After Loss

**Task:** start averaging on same pair after SL.

**Action:**

Name: "Averaging after stop"

Condition: Stop-Loss filled, key "averaging\_trigger"

Action:

* Type: Algorithm clone
* Algorithm: "Averages Averaging"
* Pairs: Pair from trigger
* Time: 3600 sec (1 hour)
* Limit: 1

**Source Algorithm:**

Main trading

Triggers: key "averaging\_trigger", type Stop-Loss filled

***

#### Example 3: Panic on Crash

**Task:** close everything and stop on BTC drop >3%.

**Action:**

Name: "Panic on crash"

Condition:

* Type: Market Watcher signal
* Key: "market\_crash"
* Source: Price
* Delta: 3–10%
* Type: Fall
* Pairs: BTCUSDT

Actions:

1. Panic sell — all pairs
2. Stop all

**Source Algorithm:**

Market Watcher with BTCUSDT

Triggers: key "market\_crash", type Market watcher signal

***

#### Example 4: Strategy Rotation

**Task:** after profit on ETHUSDT start algorithm on BTCUSDT.

**Action:**

Name: "Rotation ETH → BTC"

Condition: Take-Profit filled, key "rotation\_strategy"

Action: Start "Shots BTCUSDT"

**Source Algorithm:**

Any trading on ETHUSDT

Triggers: key "rotation\_strategy", type Take-Profit filled

***

### Tips

#### Best Practices

**Clear keys:** "btc\_stop\_loss" instead of "key1"

**Plan logic:** events → actions → pairs scheme

**Test with minimums:** verify operation with small amounts

**Use clone limits:** always set limit

**Simple actions:** better several simple than one complex

***

#### Common Mistakes

❌ **Different keys**

Action: "stop\_loss"

Algorithm: "stoploss"

Won't trigger → use identical keys

***

❌ **Different types**

Action: Order filled

Algorithm: Take-Profit filled

Won't trigger → select same types

***

❌ **Didn't run action**

Created but didn't click "Run"

Doesn't work → always "Save and run"

***

❌ **Logic confusion**

3 conditions, waiting for all to trigger

Any triggers → conditions "OR", actions "AND"

***

### Support

Questions or suggestions — contact [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/triggers-and-actions.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.
