Review of fields and data of BotTabCluster.

Review of fields and data of BotTabCluster.

The BotTabCluster class, like all tabs in the project, implements the IIBotTab interface. In addition, the class has a number of important properties, fields, and methods. Let's consider the public members of the class.

BotTabCluster - a public constructor. Initializes the initial state of the object.

EventsIsOn - a property that allows turning on/off all event streams.

TabName - a public property of type string. The unique name of the tab.

TabNum - a public property of type int. The index of the tab in the list of all tabs belonging to the robot.

NameStrategy - a property that returns the name of the robot in which the tab was created.

LineStep - a property that provides access to the value that sets the size of each section of the cluster graph, measured by the instrument price.

ChartType - a property of type ClusterType. Sets the type of sections used for drawing the cluster graph. The following values are possible:

1. SummVolume - the width of the line corresponds to the total volume of buys and sells.

2. BuyVolume - only buy volumes are used for drawing the line.

3. SellVolume - only sell volumes are used for drawing the line.

4. DeltaVolume - the difference between buys and sells is used for drawing the line. CandleConnector - a field containing a reference to a ConnectorCandles object, which is a data provider for the tab.

Delete - a method that prepares the tab for deletion, sending a command to delete the settings files to the internal components.

Clear - a method. Clears the data structures stored in the current tab.

ShowDialog - a method that opens the cluster graph settings window.

ShowCandlesDialog - a method that opens the data stream settings window.

StopPaint - a method that stops the process of drawing data associated with the current tab.

StartPaint - a method that starts the process of drawing data associated with the current tab.

LastTimeCandleUpdate - a public auto-property of type DateTime. Returns the time of the last graph update.

It is worth noting and considering separately the class members used in trading robots.

public List<HorizontalVolumeCluster> VolumeClusters

A list of all clusters belonging to the tab. For example, a method that returns the total volume of all purchases may look like this:

public HorizontalVolumeCluster MaxSummVolumeCluster

The cluster to which the section with the maximum total volume of buys and sells among all clusters in the tab belongs.

In the example, a long position is opened if the instrument's price exceeds the upper value of the cluster with the maximum traded volume.

public HorizontalVolumeCluster MinSummVolumeCluster

The cluster to which the section with the minimum total volume of buys and sells among all clusters in the tab belongs.

public HorizontalVolumeCluster MaxBuyVolumeCluster

The cluster to which the section with the maximum buy volume among all clusters in the tab belongs.

The method opens a long position if the price exceeds the average price of the cluster with the maximum buy volume.

public HorizontalVolumeCluster MinBuyVolumeCluster

The cluster to which the section with the minimum buy volume among all clusters in the tab belongs.

public HorizontalVolumeCluster MaxSellVolumeCluster

The cluster to which the section with the maximum sell volume among all clusters in the tab belongs.

public HorizontalVolumeCluster MinSellVolumeCluster

The cluster to which the section with the minimum sell volume among all clusters in the tab belongs.

public HorizontalVolumeCluster MaxDeltaVolumeCluster

The cluster to which the section with the maximum delta among all clusters in the tab belongs.

public HorizontalVolumeCluster MinDeltaVolumeCluster

The cluster to which the section with the minimum delta among all clusters in the tab belongs. 

The previous properties return specific types of clusters selected from the entire available list, but such information becomes outdated over time. What does a robot trading within a day care about a cluster to which the section with the maximum volume belongs, which formed a month ago? The next two methods solve this problem. They help to find the relevant cluster within the specified range.

public HorizontalVolumeCluster FindMaxVolumeCluster(int startIndex, int endIndex, ClusterType typeCluster)

The method finds clusters to which the section with the maximum volume of the specified type belongs. It takes the following arguments:

1. startIndex - the index from which to start the search;

2. endIndex - the index at which to end the search;

3. typeCluster - the type of cluster to find;

For example, the robot identifies clusters with the maximum buy volume and maximum sell volume over the last 10 candles, and when the price crosses these values, it opens corresponding positions.

public HorizontalVolumeCluster FindMinVolumeCluster(int startIndex, int endIndex, ClusterType typeCluster)

Similar to the previous method, it searches for clusters of the specified type with the minimum volume.

We will consider events in the next article.

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