Features of working with the Chart in TSLab

Using cached data for charting

All data used for charting is downloaded from the broker's server and stored on your computer in the cache.

The cache is used to build different charts in order to reduce the amount of downloaded data and speed up the charting process.

If there is no connection to the server, then the available information from the cache will be used to plot the graph.

Saving data on the computer, caching, occurs at intervals of 1, 5, 15, 30 and 60 minutes. If a different interval size is used, caching with an interval of one minute is used.

Please note! If the chart is built with the display of information in real time, then the last right candle (Ghost Bar) shows information on the current time period and changes in accordance with price changes in the market.

Non-standard timeframe

All non-standard timeframes are counted from 0 hours of 0 year.

Features of historical data on broker servers

Attention! It is not recommended to use a tick chart for developing and testing trading systems. Do this if you understand how the mechanisms of the exchange and programs work, what kind of work is being done over time in ticks. In other cases, it is not recommended. The recommended minimum period for working with charts is 1 second.

The broker's server stores a limited amount of information. If the server does not support seconds, then the program builds seconds from ticks (usually one session).

As a rule, standard timeframes (intervals) are available on the broker's server: 1 tick, 5 sec, 15 sec, 30 sec, 1 min, 5 min, 15 min, 30 min, 1 hour, 1 day.

TSLab does not complete these intervals offline (does not compress). For example, if you have a history with an interval of 1 minute, and you are not connected to a broker, then you will not be able to build an interval of 15 minutes using the script properties.

At the same time, you can build 14 minutes (a schedule that is not available on the broker's server).

If there are gaps in the data, then downloading seconds and ticks, as a rule, works only within the current session. In Main menu open View - Chart, then in context menu select Properties - Select Instrument in Sources tab - Select Reload date in Chart tab. Select Timeframe in the Toolbar of the Chart window. Right-click on the chart to reload the data in the context menu.

This is the mechanism of working with the data provider. If you have an accumulated cache of tick data, but there are no minutes, then 60 seconds of data in offline mode will be more than minutes, because minutes are the standard on the server, and seconds are not. The "Cached Data" provider is available in the program. It is available in Historical Data providers. This data provider can read tick caches. Make your own tool through it. With this tool, it will be possible to build any timeframe from tick data.

The work of the charting mechanism in TSLab

Attention! It is not recommended to use a tick chart for the development and testing of trading systems. Do this if you understand how the mechanisms of the exchange and the program work, what work is being done over time in ticks.

When working on cryptocurrency exchanges, the MINIMUM period for the development of algorithms based on the chart of the instrument is 1 second. Provided that the machine with the program is in the same shelf with the exchange or next to the exchange. This implies working only with limit orders. And select based on the liquidity of the instrument. If you do not have the opportunity to put your server in the same server room with the exchange, then it is not recommended to consider algorithms for less than 1 minute.

Initial values

To get a previously uncalled tool on the chart, the program must be connected to the server or an offline data provider must be created. When the instrument is called to the chart (View - Chart) or in the script lab (Lab - Scripts), ready candles available on the broker's (exchange's) server for the specified period are downloaded in the properties of the chart or in the properties of the script lab.

If the instrument has already been called before, and there was a Date from restriction, and you need deeper data, then historical data must be requested from the server by clicking the "Reload data" button from the chart context menu, before removing the Date from restriction and selecting the Reload date.

Reload date - the date from which the data from the server needs to be reloaded.

Data with bars, when disconnected from the data provider, is saved to the hard disk in "bin.gz" files in the "DataProviderNameCache" folder. The folder is on the same level as the logs folder. Tools - Caches folder (does not apply to offline provider).

Trades by instrument

When the program is connected to the server and there are trades, the program receives deals from the market.

The data is received in one of the following cases:

  • An agent with this instrument is running;

  • A script lab with this instrument has been opened and the "Update in real time" option is enabled in the script properties;

  • The instruments are displayed in the table View - Quotes;

  • Transactions are requested in the table View - All Trades.

In the agent mode, an agent is calculated on the basis of these trades, and bars are built from these trades. When disconnected from the RAM data provider, this data is written to "bin.gz" files in the SupplierNameCacheTrade folder.

If you turn off the program from the Windows Task Manager, the data may not be written to the hard drive, or register with an error. In this case, the next time you connect to the broker, the chart may stop updating.

Then you should delete the bin.gz file for the last day, with the program turned off (a very rare situation, even in those cases when the lights turned off and the computer stopped working abruptly). Trades contain much more data than downloaded bars. For example, only with transactions you can use cluster analysis and horizontal volumes.

If the lab is not updated in real time or the agent is not updated, but only ready-made bars arrive at the end of the timeframe, then the deals are not coming or the "Update in real time" flag in the script properties is not enabled. In the laboratory, there may also be a limiting option Date to.

If transactions do not come with an active connection and there are trades on the market, this is a reason to contact the broker's support service or our support service.

When the connection is started, the current deals on instruments for the current trading day are re-requested. On the MOEX exchange, the day starts at 19:00 and ends at 19:00. It is during this period that transactions are available on the exchange.

The Chart in the context menu (by right mouse button) has the "Reload data" function and in the properties the "Reload date" setting (does not apply to offline data providers):

  • Set "Use reload date" if necessary.

  • Right-click on the chart - Reload data.

  • When the flag "Use reload date" is turned off, the entire cache accumulated during operation will be erased and the data that is on the server will be downloaded. "Use reload date" sets the date for the "Reload Data" button in the chart's context menu. When requested, all accumulated cache starting from the specified date in the "Use reload date" and up to the current date will be erased from the hard disk, and the history from the server will be requested. Thus, in order for the missing date to be downloaded, it is necessary that this date falls within the range of the set "Use reload date" date.

Therefore, if you are not sure what you are doing or do not know what bar history is on the server, then it is better to copy the data from the cache folder and the cachetrade folder, and, if necessary, return the files to the program to these folders after experiments.

Actually, if you take such files somewhere (from a friend), then putting them in a folder, provided that there is such an instrument in the list of instruments of the supplier, the program will see these files (after restarting the program).

Behavior of the "Reload data" option.

On the chart, right-click - Reload Data. The behavior may differ depending on the server you are working with.

The "Use Reload Date" setting allows you to clearly define how much of the last days you need to download. Works from the specified date, until the current date. Thus, when reloading data, the cache accumulated over past dates is not erased. For some data providers that have good history servers, the setting can be neglected, used as a data download accelerator.

For these servers, you can ignore the setting:

  • Netinvestor(with QuikDDE connections)

  • IQFeed

  • Deribit for perpetual futures only

Neglect carefully (something may not be):

  • Transaq

  • Alor

Everyone else is very careful!

The script properties also have this setting. When the Internet connection is restored, the entire script will be reloaded from the set date, and not from the very first tick in the instrument's cache data.

Tick chart with multiple instruments

Chart 5 ticks. In the video, you can see how a bar appears on the upper chart, and changes after a while. What happened. All tick charts, except for 1 tick, cannot be time aligned. Bars can come inside already closed on the second instrument. After closing the bar of a liquid instrument, a tick of a less illiquid instrument may come to the past, which is seen in the film above.

This does not apply to full-fledged bars, for example 1 second.

Last updated