Quick Start

Let’s see a simple example. We create a Moving Average Crossovers robot in this Quick Start tutorial.

If you haven’t already, install Trading SM as explained in the Install article.

In Trading SM, we can build robots with a pre-created template. The template contains many features already added to the robot. In this tutorial, we create a trading robot using this template. If you want to learn how to create a trading robot from scratch, then you should read the Getting Started tutorial.

Open Trading SM and go to File -> New with template.

Now, we add the conditions to open buy and sell positions.

After that, we assign those conditions to the corresponding Long and Short rules. Rules are group of conditions. This rules are associated with trading actions, like buy and sell.

Finally, we save the trading robot.

The trading robot is ready, but first we have to compile the trading robot as explained in the following article: Generate Expert Advisor.

Is Valid Price

The answer is true when the variable used in the question has some valid value. Otherwise, it is false.

Data

Value (required) 

The variable name. If not provided, the answer is false. 

Trading Volume

The answer is a number containing a trading volume based on the data applied to the question. 

Data

Stop Loss Distance (required) 

The distance at which you are planning to set the stop loss. 

If not provided, the trading volume is not calculated. 

Amount Risked (required) 

The money you accept to lose if the trade is closed at stop loss. 

If not provided, the trading volume is not calculated. 

Symbol (optional) 

The symbol of the trade. 

If not provided, the chart symbol would be used. 

Total Orders Open

The answer is the number of orders currently open by the trading account. 

Data 

Order Type (optional) 

You select the order type when you want the number of orders open corresponding to a specific type. 

If no type is selected, all types would be considered. 

Symbol (optional)

You specify the orders symbol when you want the number of orders open corresponding to a specific symbol.

If not provided, all symbols would be considered. 

Magic Number (optional)

You specify the orders magic number when you want the number of orders open corresponding to a specific magic number.

If not provided, all magic numbers would be considered.

Comment (optional)

You specify the orders comment when you want the number of orders open corresponding to a specific comment.

If not provided, all comments would be considered. 

 

Stop Loss Distance

The answer is the maximum stop loss distance you may use in a new trade based on the data applied to the question. 

Data

Volume (required)

The trading volume you are planning to set. 

If not provided, the stop loss distance is not calculated. 

Amount Risked (required) 

The money you accept to lose if the trade is closed at stop loss. 

If not provided, the stop loss distance is not calculated. 

Symbol (optional) 

The symbol of the trade. 

If not provided, the chart symbol would be used.

 

Order Closed Losing

The answer is true when a new losing trade has closed. Otherwise, the answer is false. 

Very helpful when the trader wants to react after a losing trade. 

Data 

Order Type (required) 

The type of order from what you want to know if some just closes losing. 

Symbol (optional)

You specify the symbol when you only want to consider a specific symbol.

If not provided, all symbols would be considered. 

Magic Number (optional)

You specify the magic number when you only want to consider a specific magic number.

If not provided, all magic numbers would be considered.

Comment (optional)

You specify the comment when you only want to consider a specific comment.

If not provided, all comments would be considered. 

 

Order Closed

The answer is true when a new trade has closed. Otherwise, the answer is false. 

Very helpful when the trader wants to react after a trade closes. 

Data 

Order Type (required) 

The answer will be true if the type of the order that just closes matches the type selected in this field. 

Symbol (optional)

The answer will be true if the symbol of the order that just closes matches the symbol specified in this field. 

You specify the symbol when you only want to consider a specific symbol.

If not provided, all symbols would be considered. So, the answer would be true when any trade that just closes matches the rest fields restrictions. 

Magic Number (optional)

The answer will be true if the magic number of the order that just closes matches the magic number specified in this field. 

You specify the magic number when you only want to consider a specific magic number.

If not provided, all magic numbers would be considered.

Comment (optional)

The answer will be true if the comment of the order that just closes matches the comment specified in this field. 

You specify the comment when you only want to consider a specific comment.

If not provided, all comments would be considered. 

 

Martingale Size

The Martingale Size answers the trading volume relying on the martin-gale mechanics. 

Data

Type (required) 

There are two options: multiplication or addition. This way we determine how the trading volume is increased.

Value (required) 

The number by which the volume of the last closed trade will be multiplied or added. 

Symbol (optional) 

Here, we specify the symbol in which the last closed trade will be searched. So, if the last closed trade in this symbol is a losing one, the new trading volume will be calculated based on the two previous settings. 

If you leave this setting empty, the chart symbol in which the Expert Advisor runs will be used. 

Magic Number (optional) 

In case we also want to filter by magic number, we provide the number here. This way the last closed trade of the symbol previously specified that also has this magic number will be used to calculate the trading volume. 

Leave it empty and it will use the last trade no matter what magic number has. 

Comment (optional)

Same logic as Magic Number. When we want to filter by comment. 

Limit (optional)

In case you want to limit the number of times the trading volume is increased.  

If you leave this field empty, trading volume will increase infinitely while losing trades occur consecutively. 

Default Size (required) 

You need to provide the default trading volume we get from this question when the last trade is a winning one or the limit has been passed. 

You shouldn’t leave this setting empty. Otherwise, no trading volume will be provided to the trading action and thus the trading action will fail.

Market Info

The answer is some symbol information. 

Data

Symbol 

The symbol from what you want the information. 

Information type 

A choice box from where you select the information you want. 

Line Price

The answer is the price of a line drawn on the chart. 

Data

Name (required) 

The name of the line. 

Bar (required) 

Horizontal lines have the same price at each bar but the price of trend lines differs at each bar. Here, you specify the bar from what you need to know the line price.