An example of connecting text quotes
Last updated
Last updated
Please note! The article provides an example of connecting quotes created using a random number generator. Using this instruction, you can connect text data with quotes obtained from other sources.
You can download the text quotes used in this example. To do this, follow the link: Text quotes
As an example, we will be using quotes with a price step of 0.01. Double click on the line below.
On the page that opens, ready-made text files are laid out. In the scan folder, you can see screenshots of the obtained charts for each text file.
Download the 1.rand.quote.step = 0.01_1m.txt.zip file (the first in the list of files). Go to the directory with the downloaded file. Unzip the 1.rand.quote.step = 0.01_1m.txt.zip file.
For your convenience, we recommend downloading text quotes to the directory C:\ProgramData\TSLab\TSLab 2.1\Providers\Text, since when creating a text data provider, the TSLab program accesses this directory by default.
Open the TSLab program. In the main menu, select Data - Data Providers.
In the Providers window that opens, click on the Add button.
In the Add Data Provider window that opens, select Offline Data. Click on the Next button.
In the next step, you need to specify the name of the data provider to be created, and its type. You can specify any name. For current example, we will use the name TextData.
In the Data Provider Type list, select Text Files. To continue, click on the Next button.
At this stage, you need to specify the directory in which the text file with quotes is located.
Please note! The previously downloaded file must be unzipped.
By default, text files are stored in the C:\ProgramData\TSLab\TSLab 2.1\Providers\Text directory. To specify a new directory, click on the (...) button in the Folder line.
The historical data provider will see all the files of the proper format located in the folder.
Next, you need to set the settings for the data from the text file.
To correctly display the data from the 1.rand.quote.step = 0.01_1m.txt file, you need to set the following parameters:
Number of characters sets the number of decimal places. For the selected example, set the value to 2.
The price step is determined automatically if the step is less than one. If a file with Step = 0.01 is selected, and in the settings it will be indicated that that the number of characters = 1, then the program will take Step = 0.1 in its calculations.
After completing the configuration of the Data Provider, click Next. In the Providers window, a new text quotes provider (TextData) will be added.
Let's consider one of the options for connecting a textual data provider to a script and displaying it on a chart. You can read more about creating scripts in TSLab in the article An example of creating a script in TSLab
In the main menu of the program, select View -> Chart. The Empty Chart window will open. It is necessary to select the instrument that will be displayed on the chart.
Right-click on the graph workspace. A context menu will open. Select the Properties menu item.
In the Properties:Chart window, on the Sources tab, specify the data source for the Chart. Click on the Instrument field. In the Select Instrument selection window that opens, select the previously created provider Text and a file with quotes.
Click the Chart tab. Disable the Use initial date. Click on the OK button to complete the configuration.
Important! If you do not disable Use initial date option, the text data will not be displayed on the chart!
After completing the Chart setup, the data will be loaded and processed from the text file.