Loading...
Loading...
Loading...
Loading...
Loading...
License servers are used to verify the authenticity of the license key:
Key verification occurs every time you connect to the data provider
Check the server numbers with the broker, by default in the program, the current broker's server is specified in the data provider settings. However, there are times when the server is already out of date.
The TSLab development team strongly recommends configuring the antivirus in such a way that there is no interception and scanning of the Internet stream. Interception can lead to slowdowns. On the trading machine, it is better to disable all Internet connections and create exceptions for the broker's and TSLab's servers.
Configure the antivirus firewall and firewall according to the creator's documentation.
For normal operation of data providers, including text sources, install all current Windows updates available in your region. All current Windows regional settings must fully correspond to the country of the physical location of the computer on which TSLab is installed.
The absence of some updates, for example, related to regions and times, can lead to serious errors and problems when trading.
In general, the connection of the program to the servers of the exchange or broker is carried out as follows:
Get a login and password to the server from a broker or create an API key in your personal account on the website of the cryptocurrency exchange.
Purchase a license for the selected data provider in your TSLab personal account. After paying for the selected connector (in some cases, the connectors are free), a letter with a license key will be sent to the mail indicated during registration. Also, data on the purchased connector can be obtained in the Personal Account in the Contracts section.
Launch TSLab program. Open the Data Provider window:
Method # 1: In the Main menu, select Data -> Data Providers. Click Add and select Online Data
Method # 2: In the Main menu, select Data -> Add online data provider
Note You can also load Historical data into the program. You can read more about working with Historical data in the section Historical data
Select your data provider from the list and give it a name under which it will be saved in your list of providers.
Configure your data provider according to the information received from your provider / broker and click Next
In the Data Providers window, select the saved data provider and click the Key button. Enter the key created in your TSLab personal account (TSLab Personal Account - Contracts), click the OK button
After the key is entered, you will be able to access the button to launch the data provider in the Operation column. Click the button to establish a connection.
The program will inform you about the connection status in the Data Providers window:
red color of the button means an error in establishing connection,
yellow color means that the connection is in progress,
green color means that connections have been established and you can carry out trading operations.
Check the box in the Status bar column to activate the slider button in the Status bar. The color of the slider button in the Status bar also informs you about the connection status.
Using the Schedule manager menu, you can configure the automatic start of the data provider on the day and time you specify.
Note. To start the data provider automatically, the TSLab application must be running
To configure the automatic start of the provider, click on the button with three dots in the Schedule manager column.
In the Edit Schedule window that opens, fill in the data for the provider's automatic launch schedule. Click on the OK button
To start the created schedule, in the Providers window, move the Schedule manager slider to the extreme right position. In this case, manual control of the launch of the data provider will be blocked.
Go to the main page of the TSLab website: https://www.tslab.pro and click on the "Cabinet" button in the upper right corner of the page.
Fill in your registration details.
Note! The password must contain at least one uppercase letter. The password must be at least 8 and no more than 32 characters long.
After filling in the registration data, click on the "Register" button
After clicking on the "Register" button, you will be redirected to the page for confirming your credentials.
A confirmation email will be sent to the mail specified when registering your account. Open the letter you received from TSLab and follow the link in the text of the letter.
If you have not received a confirmation email:
make sure that the domain name is not on the blocked list
the domain name exists and the site is working.
After the account is confirmed, the "PROFILE" page can be closed. Click on the "Save" button to finish
Log in to your user account by selecting the "Cabinet" item in the upper right corner of the main page of the TSLab website. In the page that opens, enter the email address and password specified during registration. To enter, click "Next".
In the user’s personal account, select the Shop menu item. A list of available data providers will open on the site page.
Please note! Each broker has different tariff lines.
In the list of data providers, select your broker. To continue, click on the Details green button in front of the chosen tariff.
The page that opens will provide a detailed description of the data provider to be created. Pay attention to the type of license chosen and its compatibility with the markets.
In field # 1, you need to enter your public API key (created in your personal account on the cryptocurrency exchange website) or your login on the classic exchange (Interactive Brokers, Rithmic)
Specify the Maximum Size of Open Positions (for cryptocurrency exchanges). You can read more about Maximum Size of Open Positions by clicking on the question mark
Select the expiration date for the data provider to be created. To change the license validity period, move the slider to the desired side. If you subscribe for several months, you can get an additional discount on the cost of the data provider.
The total amount of the discount will be indicated in field 4
Confirm your acceptance of the User Agreement
Click on the Purchase button to proceed to payment
You can get all the necessary information about the created data provider on the Contracts page. This page displays all user-created data providers. Also, the connection data will be sent to your email address specified when registering your account.
For detailed information on the created data provider, click on the button with three dots.
In the window that opens, you can get information about the validity period of the created data provider, as well as the license key, which will need to be entered in the TSLab program when setting up the data provider of trade data.
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.
Open the created script to edit it. Double click on the created script.
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.
Right-click on the workspace of the First* window. In the context menu that opens, select Properties.
In the Laboratory Properties window that opens, in the Script section, you need to uncheck the "Use initial date" item
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.
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.
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.
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.
In the given example, we will consider the process of creating the "Moving averages crossover" trading strategy algorithm. At the intersection of the two averages from below, we enter a long position,
In the previous article (An example of creating a script in TSLab) a script called First was created. We will use this script to create a new algorithm.
Open the First script by double-clicking the left mouse button or by clicking the Edit button in the panel with buttons. Go to the Editor (Script) tab.
In the Toolbar window, set the mouse pointer in the search field. Enter the SMA abbreviation. After that, the SMA indicator will be displayed below the search bar.
Select the SMA indicator and while holding the left mouse button drag it to the Editor.
Block: SMA
Simple (arithmetic) moving average. It is calculated by adding the incoming values, for example, instrument's closing prices total amount for a certain period divided by the length of the period.
Connect the SMA block to the Closing blocks and to the Main chart. To connect the blocks you need:
Set the mouse pointer in the on the block's input/output icon.
Hold the left mouse button.While holding the left mouse button, stretch the connecting line to another block with which you need to establish a connection.
For your convenience, you can change the color and thickness of the lines displayed on the chart. To do this, you need to click on the line connecting the SMA block to the Main chart block.
After selecting the connecting line, the Properties menu will be available to you. As an example, we will change the thickness and color of the line.
Save and run the script.
After the script is compiled, the results will be displayed on the chart.
According to the terms of the strategy, the SMA is taken from the bar's closing, however, the SMA can be taken from any point of the bar: Maximum, Minimum, Opening or from any other significant values in the algorithm.
For your convenience, all tabs can be moved relative to each other. Left-click on a tab shortcut and then drag it down. In the center of the page will appear a choice of places where the tab can be attached. If you have several monitors, tabs can be moved to other monitors. Then place the Editor tab to the right of the Graphics.
To implement our strategy, we need to add another SMA indicator to the script. Connect the SMA block to the Closing block and to the Main chart. Since SMAs currently have the same period, they merge into a single line on the chart.
Assign the name SMAFast to one of the averages. Display the average values on the Control pane block and then configure it.
Block: Control Pane
A panel on which you can add control elements that control the optimization parameters of blocks.
Let's configure the SMA and SMAFast blocks. To do this, double-click on the Control Panel block.
For SMA and SMAFast blocks, it is necessary to enable the Recalculate option (activates the script recalculation function with each change of parameters).
For SMA and SMAFast blocks, you have to set the type of control. Select the option Numeric up/down.
As an example, in the SMA indicator, set the values:
Current value = 200
Step = 1
Set the SMAFast indicator values:
Current value = 50
Step = 1
Save the settings by clicking the OK button. Save and run the script.
Let's add blocks to the script editor:
Block: Cross over
The function determines the moments when the second input (signal) crosses the reference line (first input) from top to bottom. The top link = what we cross. The second link of the block = using what we cross.
Block: Cross under
The function determines the moments when the second input (signal) crosses the reference line (first input) from the bottom up. The top link = what we cross. The second link of the block = using what we cross.
Block: Position opening By market
Opening a position at the first prices offered on the market. In calculations on the history, the opening price of the next bar is used. The first link from the Market Position Opening block is always connected to the Source, as there can be many sources in the Editor. If you move the mouse cursor over the links in the Block, each input is signed, so, in the editor, you can always determine which type of data the Block needs for calculation.
Block: Position close By market
Closing a position at the first prices offered on the market. In calculations on the history, the opening price of the bar following the signal is used.
Connect the blocks:
the outputs of the SMA and SMAFast blocks with the inputs of the Cross under and Cross over blocks
the input of the Position opening By market block with the output of the Source1 block
the input of the Position opening By market block with the output of the Cross under block
the output of the Market Position Opening block with the input of the Position close By market block
the input of the Position close By market block with the output of the Cross over block
You can configure the useful information displaying on the chart. To do this, click on the Menu button located in the upper left corner. As an example, turn off the name of the Instrument (menu item: ticker).
Let's optimize the created script. Since the volume is constant in the data formed by a random variable, the Volume block can be deleted so that it does not interfere with the chart.
Then you need to open the Optimization tab. Set the Maximum and the Minimum period for the SMA and SMAFast blocks. Choose a step for changing the period values equal to 10. The goal of optimization is to select the best indicators, best indicators' configurations and the best algorithm on a loaded data sample.
In the lower left corner of the Optimization window, set the maximum number of passes for calculations. To launch, click on the Start button.
After the optimization process is completed, you can see the results on the Optimization Results tab.
Sort the results by the Net Profit/Loss column. The row with the highest value in this column can bring the greatest profit. In order to write to the script the values obtained during optimization, double-click on the top line. The optimization process is complete.
The described example can be downloaded in the ready-made form and loaded into the program:
Save the file to your computer. Open the program. Select Lab - Scripts - Download from file. Then specify the location of the downloaded file.