Text Link
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.

The "Triggers and Actions" System for Trade Automation

The "Triggers and Actions" system is an innovative solution for automating trading algorithms. It allows for the creation of complex strategies that respond to market events in real time.
Algorithms
Education
Learning
Ana Tischevici
July 16, 2024

Intro

The "Triggers and Actions" system is an innovation of the Moontrader terminal, significantly enhancing the capabilities for automation and flexibility of trading algorithms. This allows traders to create complex, multi-level strategies that respond to various market events and algorithm states in real time, making it a unique implementation.

Why this is important:

  1. Increased Adaptability: The system allows algorithms to dynamically respond to market changes.
  2. Improved Risk Management: Traders can set up automatic actions to protect their positions under certain market conditions.
  3. Enhanced Automation: Complex trading strategies can now be fully automated, reducing the need for constant monitoring.
  4. Flexibility and Customization: A wide range of triggers and actions allows for the creation of unique, personalized trading systems.
  5. Performance Optimization: Automatic execution of actions based on set conditions can improve the overall efficiency of trading strategies.

Whether you are an experienced algorithmic trader or just starting out, the "Triggers and Actions" system provides powerful tools for optimizing your trading strategies.

New algorithm attribute - triggers

The "Triggers and Actions" system is based on the event-reaction paradigm. Different entities can generate triggers (i.e. events) while others could execute actions. Current version is a MVP that implements algorithm triggers and a global subsystem that executes actions.

Most algorithms have triggers attribute. 

Each algorithm type has its own set of trigger types.

An algorithm can generate many types of triggers at once.

A key could be specified for generated triggers.

Trigger types

  • Market watcher signal. Generated when the market watcher algorithm detects a price  fluctuation on a market.
  • Order filled. Generated when the algorithm's order was filled. 
  • Take-Profit filled. Generated when TP order, as a result of the algorithm’s order execution, was filled.
  • Stop-Loss filled. Generated when SL order, as a result of the algorithm’s order execution, was filled.
  • Trade closed. Generated when TPSL was closed and trade is considered closed.

Trigger generation conditions

Some triggers can have generation conditions.

Market watcher signal - trigger

  • Symbols. If empty, any algorithm’s valid symbol can generate the trigger, otherwise only those listed will.
  • Signal type. Only triggers for selected type will be generated.

Triggers & Actions panel

A new panel was added for global triggers & actions management. This panel has two tabs: Actions, Triggers.

Trigger tab

This tab will contain dynamic information on currently active triggers and their source (i.e what entity might generate it)

Action tab

This tab is the main place for global actions management. Use it to run, stop, create new and edit actions.

Action configurations

  • An action configuration consists of 3 parts: general information, triggers it reacts to (conditions) and actual actions it executes. 
  • Action configuration can have many triggers specified. At least one of these triggers is necessary to execute actions.
  • Action configuration can have many actions to be executed. All specified actions will be executed on any valid generated trigger.
  • Each selected trigger has additional filter conditions. Only those that pass filtering conditions will be taken into consideration.
  • Each action type has additional settings to be executed with.

Conditions (triggers)

Order filled - trigger

  • Trigger keys. Specify one or multiple comma separated keys, to filter triggers generated by different subsystems. If left empty, it will react to all triggers of this type with an empty key field.

Take-profit filled - trigger

  • Trigger keys. Specify one or multiple comma separated keys, to filter triggers generated by different subsystems. If left empty, it will react to all triggers of this type with an empty key field.

Stop-loss filled - trigger

  • Trigger keys. Specify one or multiple comma separated keys, to filter triggers generated by different subsystems. If left empty, it will react to all triggers of this type with an empty key field.

Trade closed - trigger

  • Trigger keys. Specify one or multiple comma separated keys, to filter triggers generated by different subsystems. If left empty, it will react to all triggers of this type with an empty key field.

Market watcher signal - trigger

  • Trigger keys. Specify one or multiple comma separated keys, to filter triggers generated by different subsystems. If left empty, it will react to all triggers of this type with an empty key field.
  • Delta. Only triggers with delta within specified range will be taken into consideration.
  • Signal Type. Specifies what trigger’s signal type to be taken into consideration.
  • Symbol Source. Use Whitelist options if only triggers for specific symbols are required. Otherwise use Any option.
  • Symbols. A list of symbols used for the whitelist option from Source Symbol field.

Action types

Start Algorithm - action

A simple action that starts an algorithm.

  • Algorithm. Specifies an algorithm this action should start.

Start Algorithm Clone - action

This action will make a temporary clone of an algorithm and run it for specific symbols and for a certain period of time. After time passes the cloned algorithm will be stopped and removed from any list.

  • Algorithm. Source algorithm that will be cloned.
  • Symbol source. Trigger symbol option will use the symbol that is specified by trigger. Use the Whitelist option to ignore trigger’s information and use symbols specified in the Symbols field instead.
  • Symbols. A list of symbols used for the Whitelist option from the Symbol Source field.
  • Lifetime. Period of time cloned algorithm should run.

Stop Algorithm - action

A simple action that stops an algorithm or all currently running algorithms.

  • Stop type. All running algorithms option will stop all algorithms, otherwise the specified algorithm only.
  • Algorithm. Selected algorithm to be stopped for Stop type: Algorithm option.

Panic Sell - action

Calls panic sell for all TPSL algorithms that meet the criteria.

  • Symbol source. Trigger symbol option will use the symbol that is specified by trigger. Use the Whitelist option to ignore trigger’s information and use symbols specified in the Symbols field. 
  • Symbols. A list of symbols used for the Whitelist option from the Symbol Source field.

Pause Algorithm - action

Pauses an algorithm (or a sub-algorithm, for group algorithms) for a specified period of time.

  • Algorithm. The algorithm the pause action should be executed on.
  • Pause type. Trigger symbol option uses the information specified by the trigger and pauses the algorithm only for that symbol. Whitelist option will use symbols specified in Symbols field and pause algorithm only for them (useful for group algorithms). Algorithm option will pause the entire algorithm.
  • Symbols. A list of symbols used for the Whitelist option from the Symbol Source field.
  • Pause duration. Period of time algorithm should pause.

Triggers and Actions examples

1 Example (market watcher signal + start algorithm)

Situation : For example, the user wants to run the algorithm after receiving a signal from market watcher in any of the desired directions along the specified delta, which will serve as a trigger to start the action. if the trigger is executed, the action will take effect (for example, start or cloning the algorithm), so that the user can work on the active trade pair. To reproduce this situation, use the template below

1. Create an action  in (Triggers and Actions) tab

2. After click on (Create action ) the user need to do next steps:

  •  Add Action name (for any choice)
  •  Select any Trigger Type (in our example -> Market watcher signal)
  •  Select any Trigger key which we will use in algorithm  (in our example ->1)
  •  Select any delta which will  be used for the trigger (in our example ->0.1)
  •  Select  signal type (in our example ->any)
  •  Select symbol source (in our example ->any)
  •  Select Symbols (in our example ->any)
  •  Select Action type (in our example Start algorithm)
  •  Select Algorithm (in our example ton_buy )
  •  Press save and run the algorithm

3. Create market watcher algorithm

  •  In Quote Assets/ Whitelist paste any symbol/s (in our example -> TONUSDT)
  •  Choose Bid Delta/Ask Delta (in our example ->0.01)
  •  Add the same key as in the panel Triggers And Action (in our example ->1)
  •  Add any symbols (in our example -> TONUSDT)
  •  Add signal type ((in our example ->Any)
  •  Save and Run the markets watcher

4. Create any algorithm  (in our example -> shot group)

  •  Add any Symbol (in our example -> TONUSDT)
  •  Press save the algorithm

5. Run the Markets watcher algorithm

2 Example

Situation: Consider a scenario where a trader wants to run a clone of an algorithm on a particular trading pair immediately after an order fills on the same pair within a different algorithm.

1. Set the trigger in the algorithm:

  • introduce the key (e.g. ShotTrig)
  • choose  the Trigger type (Order Filled) associated with this key ;



2. Create an action:

  • Name the action;
  • Add the condition (Take Profit filled) ;
  • Introduce the key (ShotTrig) ;
  • Set the clone's lifetime  (00:05:00);
  • Select the symbol source (Trigger symbol).


3. Expected behavior:

  • When an order from the algorithm trigger is filled, a clone of the algorithm "1" will start on the same pair.
  • When using the Whitelist  as a symbol source ,the clone will start with all the pairs indicated.

 

3 Example

Situation: For example, a user wants to place an order when a coin pump is happening and to take only 1 Profit-filled (trigger), then STOP the algorithm (action), before the coin goes down, for such a strategy user can use the setup below.

Action(Take-profit-filled+Trigger type(Take-profit-filled)+Action type(Stop Algorithm)

1. Create Algorithm and Set up Trigger key + Trigger type

2. Create an action

  • Set up the name.
  • Add condition, select Trigger type and Trigger key like in the Algorithm.
  • Add action Stop Algorithm and the name of the Algorithm that you want to stop.

 

4 Example

Action(Stop-loss filled)+Trigger type(Stop-Loss filled) + Action type(Panic Sell)
Situation : For example, a user has many positions open and one of them (BTCUSDT was filled with stop-loss), which will work as a trigger, then an action Panic sell may work for all other positions to minimize risks.  To reproduce this situation, use the template below.

1. First, we need to set the trigger type.

  • We create the algorithm and add a trigger.
  • We give a name to the key. (Stop_loss_filled)
  • From the drop-down menu, we choose the desired trigger (Stop Loss filled)


 2. We navigate to triggers and actions:

  •  Choose "Create action."
  • Under the "When" category:
  • Select the trigger type (Stop Loss filled) and the key (Stop_loss_filled) to establish the link between the algorithm and the action.
  • Under the "Do" category:
  • Choose the action type (Panic Sell) and already the symbol source:
  • For trigger symbol: for symbols executed in the algorithm.
  • For whitelist: waits until orders from the whitelist are executed.

5 Example (trade closed + pause algorithm)

Situation : For example, the user wants to suspend the algorithm after each closed transaction for an certain period of time. The trigger will be trade closed, and the action will be to pause the algorithm.This setting will allow you to avoid possible disadvantages and high volatility of the trading pair. To reproduce this situation, use the template below

1. Create an action  in (Triggers and Actions) tab


2. After click on (Create action ) the user need to do next steps:

  •  Add Action name (for any choice)
  •  Select any Trigger Type (in our example -> Trade closed)
  •  Select any Trigger key which we will use in algorithm  (in our example ->1)
  •  Select Action type (in our example pause -> algorithm)
  •  Select Pause type (in our example -> Algorithm )
  •  Select Algorithm (in our example ton_buy )
  •  Select Pause duration (in our example -> 30 min )
  •  Press save and run.

3. Create shot group algorithm

  •  In Quote Assets/ Whitelist paste any symbol/s (in our example -> TONUSDT)
  •  Add the same key as in the panel Triggers And Action (in our example ->1)
  •  Add Trigger (in our example -> trade closed)
  •  Save and Run the algorithm.

Check us out on

To learn more

The latest news, technology and resources from our team.
Watchdog
Guide
Manual

Quick Guide to Watchdog

Learn how to set up Watchdog - a system that automatically closes trading positions and cancels orders if your trading core fails. Step-by-step guide for local and VPS setup.
Dec 10, 2024
Guide
Manual
Moontrader

🚀 Quick Step-by-Step guide to run the Moontrader terminal!

Ready to charge your trading game? Follow these steps to get your terminal up and running in
trading
software
features

Moontrader features to simplify your trading

We're starting a series of articles dedicated to Moontrader's most useful features! Our goal is to help you discover the full potential of the terminal and make your trading experience as effective as possible.
Nov 28, 2024
Watchdog
Guide
Manual

Quick Guide to Watchdog

Learn how to set up Watchdog - a system that automatically closes trading positions and cancels orders if your trading core fails. Step-by-step guide for local and VPS setup.
Dec 10, 2024
Guide
Manual
Moontrader

🚀 Quick Step-by-Step guide to run the Moontrader terminal!

Ready to charge your trading game? Follow these steps to get your terminal up and running in
trading
software
features

Moontrader features to simplify your trading

We're starting a series of articles dedicated to Moontrader's most useful features! Our goal is to help you discover the full potential of the terminal and make your trading experience as effective as possible.
Nov 28, 2024
HFT
trading
software

High-Frequency Trading Software: Moontrader Terminal 

Explore high-frequency trading in cryptocurrency markets with Moontrader Terminal. Learn about advanced algorithmic strategies, risk management tools, and the impact of HFT on digital asset trading. Discover how Moontrader is reshaping crypto trading for professionals.
Oct 21, 2024

© 2024 MTSS Development OU, Estonia. All rights reserved.

Disclaimer: Moontrader is not a regulated entity. Trading involves substantial risks, and past performance is not indicative of future results. The profits shown in product screenshots are for illustrative purposes and may be exaggerated. Only engage in trading if you possess sufficient knowledge. Under no circumstances shall Moontrader accept any liability to any person or entity for (a) any loss or damage, in whole or in part, caused by, arising out of, or in connection with transactions involving our software or (b) any direct, indirect, special, consequential, or incidental damages. By using Moontrader's services, you acknowledge and accept the inherent risks involved in trading and agree to hold Moontrader harmless from any liabilities or losses incurred. It is essential to review and understand our Terms of Service and Risk Disclosure Policy before using our software or engaging in any trading activities. Please consult legal and financial professionals for personalized advice based on your specific circumstances.
All trademarks and copyrights belong to their respective owners. MoonTrader ecosystem is a registered trademark of MTSS Development OU, Estonia.

Terms of Use

Privacy Policy