An agent is a trading script instance linked to your accounts.
The number of agents created on the basis of one script is unlimited.
The "Autotrading Control Center" window displays the general status of agents, settings, current trading results and tools for starting and stopping agents.
If there are several instruments in the script, only one instrument is displayed in the "Ticker" column, according to the first source in the script (the Source block that was added to the editor first).
You can open this window from the Main Menu | Trading | Autotrading Control Center .
You can apply filters in the table of the Autotrading Control Center window.
To open the context menu, right-click on the workspace of the "Autotrading Control Center" window.
"Autotrading Control Center" window properties can be opened from the context menu of the window or using the "Properties" button located in the right corner of the window title bar.
You can create a new agent by clicking on the "Add agent" button.
Clicking on the button will open the window for creating and configuring the agent. Two tabs will be available: Common and Trade
In the Common menu, you can select the required script from the list to connect to the agent, specify the source of trade data, and also specify the limit management type.
After creating an agent, you can open this menu by clicking on the list icon in the Agent column
The agent Trade settings, as well as the common settings, are available when creating a new agent, the Trade settings window can also be opened by clicking on the gear icon in the Agent column.
Check out the full description of trading settings in the articles:
Agent Trade Settings - Agent Execution
Agent Trading Settings - Placing Orders
Agent Trade Settings - Events
Opens a Сhart in a separate window with the same instrument and with the same Period as in the agent.
Shows the Agent chart, Log, Results, Trades, Parameters and Income tabs.
This tab displays the agent's schedule and control panel (if it exists).
Shows the results of the agent. This tab becomes available after starting the agent.
The tab is designed to work with the saved values and results of optimization parameters.
Table of results of the optimization parameters.
The tab shows a table of trades.
Trades statuses:
Green - normal state of agent operation;
Yellow - there are not submitted/placed orders;
Red - there are mistakes in order execution.
Tab showing agent event log.
Tab showing agent income.
If the "Wait for exit" parameter is activated, then the volume of the position closing is added in the amount of the number of candles specified in the parameter. Then the position is closed by the market in the amount of candles specified in the "Automated closing (bars)" parameter.
The number of bars in "Automated closing (bars)" must be more than in the "Wait for exit" parameter. If the value in the "Automated closing (bars)" parameter is less than or equal to "Wait for exit", then the automated closing will not work.
If the "Wait for entry" parameter is activated, then the volume of the position is added in the amount of the number of candles specified in the parameter. Then the market position is added in the amount of the number of candles specified in the "Automated opening (bars)" parameter.
The number of bars in "Automated opening (bars)" must be more than in "Wait for entry". If the value in the "Automated opening (bars)" parameter is less than or equal to "Wait for entry", then the automated opening will not work.
Virtual positions are taken into account in agent management.
Agent management has its own statistics, and there is a possibility of error in it. This is due to the orders for which no response from the broker was received and to the calculation algorithm described below.
It is not yet clear how to eliminate errors. There were suggestions that it is worth removing this information altogether. Modification of the window is required. At the moment, all instruments within one agent are not taken into account and are not shown.
Now in agent management, statistics are calculated as follows: The script breaks all trades into pairs, if there is no pair, then the trades are thrown away. For example, you have 2 lots in a long position, but if you look at the "Trades" table in the agent, then there is no such trade(s). I.e, the script does not actually maintain the position.
In agent management, the generalized position for the script is shown. That is, pressing the "Forget errors" button, skipping an entry, skipping an exit, or automated opening / closing can throw a trade without a pair from statistics.
Agent management statistics do not affect the agent's operation, no special actions are required.
You cannot clear the agent management statistics, you can only start an agent with a new trade name.
Therefore, the statistics of agent management cannot be trusted yet.
An indication of the amount of funds available for trading for an agent.
Slippage %
Percentage of permissible slippage.
Slippage
Absolute value of permissible slippage.
Positions (lots)
The number of lots operated by a certain instrument that is traded within a certain script.
Long positions (lots)
The number (in lots equivalent) of long positions currently being managed by the agent.
Short positions (lots)
The number (in lots equivalent) of short positions currently being managed by the agent.
Positions (Money)
The volume of funds operated by a certain instrument that is traded within a certain script.
NP/L
Unrealized profit / loss.
P/L
Profit / loss.
P/L (day)
Daily profit / loss.
Assessed price
Average price of deals of the current open position by instrument.
Balance price
The price assigned to the stocks for accounting purposes.
Current
The current price of the instrument, broadcast by the broker.
Status
The state of the trading session by instrument.
Commission
Commission paid on the aggregate of transactions made by the agent within the instrument.
State
The current state of the agent (Started / Stopped), toggled by pressing the button
Recovery Factor.
Entry signal.
Entry bar
Entry bar.
Entry date
Entry date.
Entry time
Entry time.
Entry price
Entry price.
Entry commission
Entry commission.
Exit execution
Exit signal
Exit signal.
Exit bar
Exit bar.
Exit date
Exit date.
Exit time
Exit time.
Exit price
Exit price.
Exit commission
Exit commission.
Average entry price
Average entry price.
P/L
Profit / loss per trade.
Fixed P/L
Fixed profit / loss.
Open P/L
Open profit / loss.
Duration (bars)
The number of bars between entry and exit.
Profit / bar
Profit / loss per bar.
Total Profit / Loss
Current profit / loss per position.
% of change
Percentage change in profit / loss per trade.
MAE
Maximum adverse excursion.
MAE %
Maximum adverse excursion in %.
MFE
Maximum favorable excursion.
MFE %
Maximum favorable excursion in %.
Command
Description
Add agent
Opens the window for creating and configuring an agent.
Delete agent
Removes an agent from the list. If the agent is active and has open positions, deleting the agent is impossible.
Forget errors
The agent stops broadcasting messages about currently existing errors. Read the article Forget Current Trading Mistakes
Stop all agents
Stops all agents.
Edit script
Opens the script on the basis of which the selected agent was created, in the editor. Saving the edited script will restart this agent.
Command
Description
Properties
Opens the properties of the “Autotrading Control Center” window.
Show on (sheet)
Moves the "Autotrading Control Center" window to one of the existing sheets.
Clone the window
Duplicates the "Autotrading Control" Centerwindow
Property
Description
Use alternating row colors
Highlighting every second line with an alternate color.
Background row color
Background color of table rows.
Font settings
The type and size of font.
Window caption in floating mode
Shows / Hides the window caption in floating mode (when the selected window is not tied to the main program window).
Columns caption
Shows / Hides the column captions.
Property
Description
Ticker
Short name of the instrument. The field displaying the ticker contains the "Show Chart" button in the form of a chart.
Agent
The name of the agent. If the agent has a trade name, it is displayed in brackets. In the field displaying the name of the agent, there are buttons "Agent" (monitor), "General settings" (list) and "Trade settings" (gear).
Connected
Indication of connection to a trade server.
Active
Trade availability indication (trading account is active).
Account
Broker account name.
Column
Description
Script
Selecting a script from the list to create an agent.
Trading name (Optional field)
You can give an additional name to the agent for the convenience of tracking processes. This field is optional.
Limit management type
Selecting a way to manage the funds available to the agent. Possible values: "Managed by agent", "In money equivalent", "In lots", "% of portfolio". Calculating the number of lots in an order:
- In lots. The value in the "Volume of limit" field is multiplied by the value in the Position opening block;
- Managed by agent. Число в блоке открытия позиции является количество лотов в заявке. The "Volume of limit" field is ignored;
- In money equivalent. The value in the "Volume of limit" field is divided by the current instrument price and multiplied by the value in the Position opening block;
- % of portfolio. The number in the "Volume of limit" field is multiplied by the amount of money in the account and divided by the current price of the instrument and multiplied by the value in the Position opening block;
- Maximum % of portfolio. When placing an order, the amount of free money is determined, and the order is placed without exceeding this amount. (I.e. if there is not enough free money in the portfolio, then securities for a smaller amount will be bought.)
Volume of limit
The value of the funds limit set in accordance with the method of determining the limit in the "Limit management type" field.
Sources
Opens the instrument selection window.
"Parameters" tab fields
Description
Name
The name of the parameter set.
Date and Time
Date and time of saving the parameter set.
Ticker
Instruments ticker.
Note
A comment to a parameter set.
Profit Factor
Profit Factor.
"Parameters" tab fields
Description
Optimization Parameters
Blocks list.
Parameter name
Optimization parameter name.
Value
Parameter value.
"Parameters" tab fields
Description
Load
Loads previously saved parameters.
New folder
Creates a new folder in the directory/catalog.
Delete
Deletes a parameter set or a folder.
Import
Import of parameter sets previously saved in the script after optimization.
Export
Export of parameter sets previously saved in the script after optimization..
Columns
Description
Position
Position
Symbol
Stock’s name.
Lots
Number of lots in a trade.
Change / Maximum lots
The number of lots by which the position has changed.
Execution
Volume of limit
Recovery Factor
Entry signal
You can create a new agent by clicking on the "Add agent" button in the Autotrading Control Center window. You can access the Autotrading Control Center window by selecting the tab of the main menu Trade -> Autotrading Control Center
To open the window for creating and configuring an agent, click the Add agent button. You will have access to two tabs: Common and Trade
Open the Trade tab.
After the agent is created, you can access the Trade settings by clicking on the gear icon in the Agent column
After the agent is created, you can access the Trade settings by clicking on the gear icon in the Agent column
Q:
There are 2 lots in a limit order for position closing. At the first recalculation, only 1 lot was closed. If there is a signal, will the order for the other 1 lot remain or be re-placed?
A:
The order will remain at the same price as long as the Wait for exit parameter works.
To implement re-placement of a limit order to close a position, you can use the Quantity and Updatable value blocks, together with the "Ignore exit signal not on latest bar" setting.
If the Automated closing parameter is set, the remaining position will be closed automatically according to the market.
If the Wait for exit parameter is less than the Automated closing parameter, the rest of the position will be closed as soon as the Wait for exit parameter stops. The same applies to the "Partial opening" of lots per position, in accordance with the names of the settings. To open a position, the "Keep virtual position active. Maximum bars" setting should be enabled.
Q:
Neither the Wait for entry parameter nor the Automated opening parameter is set, and the "Keep virtual position active. Maximum bars" parameter is set to 0. A limit order for 10 lots was placed, and 5 was executed. A signal for 1 bar appeared. How will the program behave?
A:
The program will remove the remaining lots and without any messages will operate with 5 lots. The algorithm will continue to execute with the open number of lots.
Q:
What if my entry point has gone beyond history? The history of the last two days is loading, but the login was 4 days ago. How will the script or agent behave in this case? Will this deal be closed in terms described in the script or will the calculation be carried out incorrectly?
A:
If there is no entry bar, then the data of this bar is accordingly unknown. It is necessary to set such a number of bars so that the last entry to the position is always visible in the history.
The calculation MAY be carried out incorrectly.
Q:
The script makes several consecutive entries, some of which go beyond the history. In this case, how will the positions that have gone beyond history be closed?
A:
MAY close incorrectly. Signals can be triggered that would not have been triggered if the entire history had been loaded. More depends on the settings and on the calculated values that calculate the exit from the position. For example, if the "Ignore positions outside history" parameter is enabled in the trade settings.
Recommendation: Place such a number of bars so that not closed position entries are on their own bars and do not move to the first bar of the loaded history.
Settings
Description
Convert by market to limit orders
A market order is created not at the current price, but at the bar opening price (as in calculations) +/- slippage if the "Interval + trade" parameter is selected. If the "Interval" recalculation mode is selected, then the closing price of the last bar is used.
Incorrect stop order is being converted to by market order
Conditional position close orders with a price below the market are placed as market orders. If a message appears:
"A conditional order may not be triggered by the signal '{0}', since the current price in the market is {1} (While the price in the condition is equal to {2})! Thus, the order is placed as a market order, not as a conditional one.
Open by limit orders
To open a position, the program creates limit orders without slippage.
Slippage in price steps
The volume of slippage in steps of the instrument price that will be submitted to the order created by the agent. An order of the "By market" type does not take into account the slippage settings and is executed at the first offered price. Attention! The slippage settings are cumulative.
Slippage in %
The volume of slippage as a percentage that will be submitted to the order created by the agent.
Slippage - works only for conditional orders. For other order types, slippage is not required. In trade settings, slippage is set for the entire script, both slippages are summed up. If you set slippage both in percentage and in price steps, both slippages are summed up. This slippage has a lower priority than slippage, which is set directly in the block of entry and/or exit from the position (set in absolute values). If 5 points are set in a certain entry block, and 1% is set in the total slippage, then 5 points will be set for orders of this entry block, and 1% will be set for the rest of the script.
Take-profit without slippage - by default, the "Take-profit" block places a conditional order. This flag changes the order type to "Limit". It should be remembered that for those data providers that have "Use related orders" the flag turns them off. And between stop and profit, at each recalculation, the program will select only one order, the price of which is currently closer to the current price.
Open by limit orders - Flag used specifically for "If greater than / if less than" entry blocks. By default, these blocks are used for placing conditional orders. If the flag is on, the order type is changed to "Limit". We advise you to use "Open by limit orders" for real trading.
Convert by market to limit orders - The flag is specially created for the "By market" blocks, it changes the order type from "By market" to "Limit", rather "Conditionally Limit". The order will be placed at the closing price of the previous bar, taking into account slippage. The flag affects all agent signals, including Automated open, Automated close, and signals in the command manager.
Attention. If recalculation is set to "Interval + trade", then the order will be placed at the Open price of the current bar. Do not use “Convert by market to limit orders” with Smartcom Data provider. This provider does not have such an option, orders will be placed at incorrect prices.
Incorrect stop order is being converted to by market order. Works for position close conditional orders. Places market orders instead of limit orders. It also works for "Take-profit without slippage", since first it is checked that the price is bad, only after that the "Take-profit without slippage" flag works.
Explanation on the example of a stop loss order:
Stop loss is a conditional order. When the price touches the price specified in the condition, it is converted into a limit order at the price specified in the condition "+ - slippage". Since the stop loss changes stepwise, with the next recalculation, the price in the condition may turn out to be much lower than the market immediately upon the opening of the bar. This is the “Incorrect stop order”. That is, you have a long position, and now the price is 100, and you submit an order to close if it is less than 120. Or you have a short position, the price is 100, and you want to close the position if the price is more than 80. Such an order will not be executed until the price will not return to the price specified in the condition"+ - slippage". If the option "Incorrect stop order is being converted to by market order" is enabled, then a market order will be placed instead of a limit order. For the stop-loss short position, a buy market order will be placed, and for a stop-loss long position, a sell market order will be placed. Consequently, trades will be executed at the best buy and sell prices that will be in the order queue at the time of recalculation. As a rule, this mechanism works automatically for most brokers, but some brokers (for example, Finam) do not support it, in this case it is recommended to set the flag.

Take-profit without slippage
Take-profit order is created not conditional, but limit (but without slippage).
Order expiration, Days
Allows transferring the expiration time in days to the broker in a conditional order. By default, the program places conditional orders for two days. Recommended for use when working with large timeframes. (Does not apply to cryptocurrency markets)

The Agent trading settings, as well as the Common settings, are available when creating a new agent. In addition, the Trading settings window can be opened by clicking on the gear icon in the Agent column.
Events are understood as operations of a broker or exchange with an order (during the execution of a transaction) or general events related to the program.
When one of the events occurs, a Single agent recalculation is executed. In the editor, you can use the Additional "Event" block. At this recalculation, if an event has occurred, the block will return True, which can be used in the algorithm. If there are many events in one agent at once, a single recalculation is performed. A lot at once - write a hardcode for 5ms. That is, if several events occurred within 5ms, the recalculation call will be single.
Сигнал на закрытие позиции исполнен. Портфельный номер открытия позиции имеет исполненный портфельный номер закрытия позиции.
Trading is started
The status came from the exchange that the trades were opened. Most often, the program uses the first market trade. The start of trading is determined by the first quote of the current day, since it is almost always faster than the trading status sent by the exchange for the instrument.
Trading is stopped
The status came from the exchange that the trading was stopped.
Bar closed, not trades
The bar was closed by server time, but there are no new deals
Pretrade limitation
One of the Risk Management filters was triggered. (Trade - Risk Management)
Event name
Description
Order rejected
Broker (or exchange) rejected the order
Order filled
There have been transactions in the market that satisfy the entire volume requested in the order
Order canceled
While recalculating the agent, the script calculated that there was no signal, so the request must be canceled. The program issues a command to the broker. This event is the result of the "Order canceled" response from the broker.
Order quantity changed
In the Agent, during the main recalculation, the script calculated the change in the number of lots, which differs from the previous one.
Position opened
The signal is executed, the program received the numbers: Transaction, Order, Trades. All numbers are linked to the agent's signal through the portfolio number.
Position closed
The Agent trading settings, as well as the Common settings, are available when creating a new agent. In addition, the Trading settings window can be opened by clicking on the gear icon in the Agent column.
Settings
Send position entry/exit order immediately - runs auto trading. If the flags are not set, signals will be sent only to the Command Manager for manual execution.
Automated opening/closing - automatic execution by market, if the order was not executed within the specified amount of bars in the "Wait for entry / exit" parameter (activated when the price is touched) or if there was a failure in the Internet connection. Actually, you can set a value greater than 2 or 3, the main thing is that it should not be more than the number of bars loaded into the script. You can view it in the "Log" window of the agent or script. When compiling or recalculating, the number of bars is written.
Blocks “By market at fixed price” for auto opening - blocks the “By market at fixed price” for auto opening flag and applies to the Command Manager.
Blocks “By market at fixed price” for auto closing - blocks the “By market at fixed price” for auto closing flag and applies to the Command Manager.
Ignore positions outside history - When trading in the absence of a loaded history, orders are drawn on the first bar of the agent. The flag prohibits drawing of these trades. Adjust the script properties so that at least the agent sees the last entry and exit of the position. If the agent does not "look through" the history of its trades to place new orders (for example, it does not calculate the average entry price of all trades), then the flag can be set. If you need a history, then it is better to load more of it, while limiting it in the script properties by the Maximum bars parameter.
Inform about missed entries - if the flag is on, then if the signal to enter the position is missed, an alert will be sent in messages or by mail (if the notification manager is configured).
Do not entry position if there’s missed exit - the flag prohibits the opening of new positions if the signal to exit the position was missed.
Do not notify about recalculation - the flag prohibits the output of information to messages and mail when the agent is recalculated. As a rule, it is used for very fast scripts, where the non-execution of orders is due to the liquidity in the market. This is a very important flag for the support team. If you set it, then the agent's recalculations are not written to the log. By setting this flag, you understand that it is pointless to analyze the orders of an agent who puts out hundreds of them a day. It will calculate by itself which of the orders have worked and which have not, and will place the missing. Keep virtual position active. Maximum bars - Adjusts the number of bars during which the last calculated signal in history is valid. For example, if you set 10, and the last signal was 11 bars ago, the signal will disappear from the chart and from the Command Manager (even if the entry is skipped), and the agent will start calculating a new signal.
Ignore exit signal not on latest bar - the flag acts similarly to the "Keep virtual position active. Maximum bars" setting, but only works for exiting a position and only for one bar. That is, by setting this flag, it is expected that the agent will place each order to exit a position by only one bar. On the next bar, if the signal from the script continues, the order will continue to stand. If the price in the order changes, the order will change. But as soon as the signal for placing in the agent disappears, the order will be canceled, even if it was active ("Active" - it means that the market price touched the order, but there was not enough liquidity for execution). As a rule, the flag is used for scripts that expose only take-profits to the exit, but it can also be used for other purposes, the main thing is to understand the mechanism. That is, with this flag, there can be no question of any Automated closing or Wait for entry/exit.
Wait for entry/exit - works only with conditional and limit orders. Turns on if the current price touched the order price, but was not executed. The amount of bars during which the order will continue to stand in the order queue. After the expiration of the amount of bars, the order will be canceled. This parameter must be configured together with the “Automated opening/closing” parameter. If “Automated opening/closing” is greater than “Wait for entry / exit”, then after canceling an unexecuted order, a replacement order will be sent "by market". If "Automated opening/closing" is less than "Wait for entry/exit", then the order will be canceled and the agent will start calculating the next signal. The flag also applies to orders that are subject to the "By market at fixed price" flag.
Add order commission - whether to take into account the commission coming from the broker (not all brokers send commission in transactions). Not all instruments can be recalculated (for example, for the MOEX futures market, the lot size is always 1), so the commission can be greatly overestimated in relation to the income chart. When you see that the commission is too high, do not check the box, this will exclude the commission from the calculation of income. Whether the commission comes from the broker in transactions can be seen in the table "Your transactions".

Description
Send position entry order immediately
A parameter that determines the ability to automatically enter a position without manual confirmation. The entry command will be executed only if the entry signal was generated on the latest closed bar.
Send position exit order immediately
A parameter that determines the ability to automatically exit a position without manual confirmation. The exit command can be executed in two ways, depending on the Automated closing setting. If the Automated closing parameter is equal to zero, the command will be executed with the formation of a price by the last closed bar, otherwise the command will be executed by the market in accordance with the Automated closing settings.
Automated opening (bars)
The number of bars during which the missed entry will be performed automatically by the market if the "Send position entry order immediately" parameter is enabled. Next, a message will be displayed about the missed entry and the need for manual intervention.
Blocks “By market at fixed price” for auto opening
Blocks the "by market" option with a fixed price for auto opening.
Automated closing (bars)
The number of bars during which the missed exit will be closed automatically by the market if the "Send position exit order immediately" parameter is enabled. Next, if the set number of bars is not enough, a message will be displayed about the missed exit and the need for manual intervention.
Attention! Automated closing applies to every order that makes any position change.
Blocks “By market at fixed price” for auto closing
Blocks the "by market" option with a fixed price for auto closing.
Ignore positions outside history
Ignores (disregards) positions that were closed outside the requested historical data.
Inform about missed entries
Notifies about missed position entries.
Do not entry position if there’s missed exit
Does not open new positions if there is a "position exit missed" error.
Do not notify about recalculation
Does not notify about script recalculation.
Keep virtual position active. Maximum bars
Determines how long to inform about a missed position before it disappears (If set to 0 - an infinite amount of time, any other positive value is equal to the number of bars).
Ignore exit signal not on latest bar
Ignores an exit position signal created by an agent not on the latest (current) bar.
Wait for exit
The number of candles during which the program will wait for the execution of the exit position limit order. Then the application will be canceled. The setting works for an active order (the instrument price touched the order price, but was not executed due to lack of liquidity)
Wait for entry
The number of bars during which the program will wait for the execution of the enter position limit order. Then the application will be canceled. The setting works for an active order (the instrument price touched the order price, but was not executed due to lack of liquidity)
Add order commission
Take into account the commission of orders in the calculation of profit. If the broker sends a commission on transactions, then the commission will be taken into account in the agent's trading results.











