Tick Adaptive candles in OsEngine.

Tick Adaptive candles in OsEngine.

Tick Adaptive candles are a special modification of Tick candles for algo traders. They are designed to adequately reflect market dynamics both from last week and 10 years ago. By adapting, the candles provide equivalent significance signals based on current market activity.

Tick candles (tick candles) are a tool for visualizing and analyzing market data used in technical analysis of financial markets. Unlike traditional time-based candles, each tick candle is formed not after a fixed period but after a certain number of trades have been completed.

 

1. History of Tick Adaptive candles.

Basic Tick candles started to be widely used in the 1990s when computers became more powerful and traders had access to real-time trade data.

Tick Adaptive candles were created in an attempt to adapt this wonderful mechanism so that traders wouldn't need to stop trading once a week in the tester to manually adjust the number of trades closing the candles. After all, the activity on Sberbank stocks in 2010 is completely different from that in 2024, and testing algorithms on basic Tick candles can be very reckless, whereas on Tick Adaptive candles, it's highly recommended!

 

2. Calculation of Tick Adaptive candles.

In the settings of these candles, there are several variables. Let's take a look at them:

1. Check the box "Save trades to candles"; otherwise, without this, adaptation will only work for 2 days back.

2. Select the type of candle – TickAdaptive.

3. Trades count in candle – the number of trades (from the pool of non-personalized trades) after which the candle closes.

4. Candles count in day – how many candles within a day the algorithm should adjust the candles for.

5. Adaptive days look back – the number of previous days over which the intraday number of trades will be averaged for the adaptation algorithm.

The overall idea of operation is simple:

1. During the first day of operation, the candle assembler uses the settings for closing candles specified by the user in the parameter Trades count in candle. As soon as the specified number of trades accumulates within the candle, it closes. This results in the usual OHLCV with time regulated by the number of trades.

2. When the first trade from the new day arrives, the algorithm transitions to the volume adaptation module within the candles.

3. The average number of trades for the past N days is taken and divided by the number of candles set by the user in Candles count in day. The resulting value becomes the new number of trades for closing the candle, which is recorded in the parameter Trades count in candle.

You can view the adaptation process in the source code series here:

 

3. How to trade using Tick Adaptive candles?

It is primarily assumed to look for volume spikes in the candles. In the case of their appearance, it can be stated that there are very large volume trades, i.e., so-called "Whales" or even "Puppet Masters." Just like in this chart:

This way, one can identify anomalous volume deviations over a certain number of trades and trade from it. In this case, some very large participant began to throw huge orders into the market, clearly expecting a quick rise. And indeed, it happened...

 

4. How to launch Tick Adaptive candles in Os Engine.

Open the main menu in Os Engine and go to "Bot Station Light."

Connect to the "ALOR" connector or any other:

Next, create a trading robot; in this case, it will be Bollinger Revers:

Now go to the data stream connection menu for the robot:

Select any instrument from the list; in our case, it will be "Sber":

1. Check the box "Save trades to candles"; otherwise, without this, adaptation will only work for 2 days back.  

2. Select the type of candle – TickAdaptive.

3. Trades count in candle – the number of trades (from the pool of non-personalized trades) after which the candle closes.

4. Candles count in day – the number of candles within a day the algorithm should adjust the candles for.

5. Adaptive days look back – the number of previous days over which the intraday number of trades will be averaged for the adaptation algorithm.

After the settings, we see a chart with "TickAdaptive" candles:

IMPORTANT!!!

Do not forget that for the chart to adequately adjust to the market and the number of candles you set, it must accumulate at least one day of trade history; the adaptation will occur during the first trade at the opening of the second day.

 

5. Where to find the source code for candle assembly in OsEngine.

The source code for candles in OsEngine is publicly available on the GitHub platform.

After downloading OsEngine to your PC, you can find the source files within the project here:

Good luck with your algorithms!

Support for OsEngine