An example of creating a script in TSLab

Please note! In the TSLab program, you can connect both historical data and real trading data provided by your broker. In the current example, a data provider using a text file with quotes created in the article An example of connecting text quotes was selected.

Launch the TSLab application. In the main menu of the program, select Lab - Scripts.

In the window that opens, click the Create new script button. Enter a name for the new script, for example, "First". Click OK to continue.

Script editing

Open the created script to edit it. Double click on the created script.

Visual Script Editor

The window of the Visual Script Editor will be opened in the Workspace.

When creating a new script, blocks are moved to the workspace by default:

Traded instrument

(Source1)

Traded data source.

Volume

(Volume1)

Volume of concluded contracts – the number of transactions with futures contracts or options completed during a certain period of time.

Closing

(Closing1)

Bar closing price.

Chart panel

(Main)

Creates a chart panel.

Script properties

Right-click on the workspace of the First* window. In the context menu that opens, select Properties.

Script Properties – "Script"

In the Laboratory Properties window that opens, in the Script section, you need to uncheck the "Use initial date" item

Script Properties – "Sources"

In the Sources section (1), you need to select an instrument. Click on the "Instrument:" field (2). In the Select Instrument window that opens, select a data provider (in our example, Text (3)) and specify the required instrument (4) (in our example, quotes from the text file 1.rand.quote.step = 0.01_1m are used). Click OK to confirm.

Close the Laboratory Properties window by clicking on the OK button.

Executing the Script

Pay attention to the tab with the logo of the chart. After you select a tool on this tab, the construction of the chart will begin. While loading and processing data from the file, this tab will say Loading.

After the data downloading is completed, the name of the tab will change to the name of the selected tool. In our example, the name of the tab switches to 1.rand.quote.step = 0.01_1m

After the data downloading is completed, click on the Save and Run button located in the upper right corner of the First* window.

Script Results

The script will be compiled and switched to the tab with the chart. Thus, the first script is created and is ready for developing a trading system.

This script has a very simple algorithm - displaying an instrument on a chart.

If you put the mouse cursor on the vertical or horizontal axis and turn the mouse wheel, you can zoom out or zoom in.

Last updated