Overview of the main blocks of BotTabSimple.

Overview of the main blocks of BotTabSimple.

Despite its name, BotTabSimple is one of the largest and most complex objects in the project. The class code comprises about five thousand lines. The functionality of the simple tab can be roughly divided into several blocks:

1. Implementation of the IIBotTab interface.

2. Interaction with the master of graphic data representation.

3. Interaction with the connector.

4. Management of the position log.

5. Emulation and management of stop losses and take profits.

6. Working with the position maintenance module.

Implementation of the IIBotTab interface.

The IIBotTab interface mandates each tab to implement certain functionality that allows the program to uniformly manage all tabs. The interface typically defines common states and behavior for all tabs.

Interaction with the master of graphic data representation.

One of the important responsibilities of the tab is to interact with an instance of the ChartCandleMaster class. This object's main responsibility is to manage the drawing of data series in the graphical interface of the program, such as candles, indicators, and trades on the chart. BotTabSimple acts as an intermediary between the trading algorithm and the drawing master. This block includes methods for adding/removing indicators from the chart, plotting graphical elements (lines, points) on the chart as well as their removal, focusing on the chart, displaying trades, conditional orders, and lines for stops and profits.

Interaction with the connector.

Without exaggeration, ConnectorCandles is the main object with which the tab interacts, as all communication with the trading platform occurs through it. BotTabSimple processes almost all events from the connector, performs many calculations, and forwards the data further through its own events. In return, the tab processes robot requests and sends orders to the connector.

Management of the position log.

The main logic for processing positions is contained in an instance of the Journal class, which is part of BotTabSimple. After creating a position, the tab places it in the log and sends the order to the connector. As it receives orders from the connector and its own trades, the tab forwards these objects to the log, which, based on them, changes the state of the positions. After that, the log informs the tab about changes in the position state using PositionStateChangeEvent and PositionNetVolumeChangeEvent events.

Emulation and management of stop losses and take profits.

The variety of trading platforms supported by the platform is quite extensive, but not all of them provide the possibility to use conditional orders on the broker's side. BotTabSimple takes on these obligations and provides the ability to use such important entities for traders as stop loss, trailing stop, and take profit. The tab contains a number of methods that allow robots to use this functionality. These include methods such as CloseAtStop, CloseAtTrailingStop, CloseAtProfit, and their overloads.

Working with the position maintenance module.

The position maintenance module is represented by an instance of the BotManualControl class. This object allows configuring reactions to specific transaction-related events.

If you have any difficulties or questions, please write to the support chat. Link