Range Volatility Adaptive Candles in OsEngine

Range Volatility Adaptive Candles in OsEngine

In this article, we will discuss the modification of Range candles, specifically designed for algorithmic traders, to test this method of collecting candles on any historical depth.

Basic "Range" candles, unlike time-based candles formed on a certain time interval, are based on price changes.

Range Volatility Adaptive candles automatically adjust to the volatility of the previous N days, adapting the candle dimension to the current context of the instrument, and provide equivalent strength signals throughout the history, whether from 10 years ago or 5 years ago.

1. The Meaning of Range Volatility Adaptive Candles.

Volatility-adjusted Range candles were specifically designed for algorithmic traders to test their ideas painlessly on deep history, applying the core concept of Range candles.

When volatility increases for the instrument, the candle size increases.

When volatility decreases for the instrument, the candle size decreases.

 

2. Calculation of Range Volatility Adaptive Candles.

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

1. Choose the type of candle – RangeVolatilityAdaptive.

2. Value type – the type of minimum candle size. Options include percentages and absolute values.

3. Min movement – the minimum candle size in units specified in the previous parameter. Until the end of the first day, the value set by the user is used, after which it is calculated automatically.

4. Adaptive days look back – the number of previous days over which the average intraday volatility will be taken for further calculations.

5. Vertical segments of volatility – the number of segments into which we will initially divide the average intraday volatility. This greatly influences how many candles will be within the next day. The larger this value, the more candles there will be.

6. Min move volatility mult – a multiplier for the base candle size relative to the volatility segment.

Process of Adaptation in Pictures.

Stage 1. Calculate the average volatility over the previous N (Adaptive days look back) days:

At the end of this stage, we have the average movement over the past N days in absolute terms or percentages.

Stage 2. Break down the volatility into segments as specified in the Vertical segments of volatility parameter:

At the end of this stage, we have divided the average volatility into parts. In this case, into 100. Ideally, we would like to break it down into the number of candles we want to see, but unfortunately, that doesn't work due to a significant degree of uncertainty. Therefore, we divide it into a conditional number of candles.

Stage 3. Calculate the new base candle size and new retracement for candle closure:

At this stage, we have calculated new values for the parameters. We can continue building candles.

You can see the adaptation of candles in the source code here:

 

3. How to Trade with Range Volatility Adaptive Candles?

The uniqueness of these candles lies in the closure after a certain movement, tied to volatility.

Based on this, they can be applied in impulse trend trading. If several one-directional candles close in a very short period, an explosive acceleration occurs.

 

4. How to Launch Range Volatility 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:

Choose any instrument from the list, in our case, it will be “Sber”:

1. Choose the type of candle – RangeVolatilityAdaptive.

2. Value type – the type of minimum candle size. Options include percentages and absolute values.

3. Min movement – the minimum candle size in units specified in the previous parameter. Until the end of the first day, the value set by the user is used, after which it is calculated automatically.

4. Adaptive days look back – the number of previous days over which the average intraday volatility will be taken for further calculations.

5. Vertical Segments of Volatility – the number of segments into which we will initially divide the average intraday volatility. This significantly influences how many candles will be within the next day. The larger this value, the more candles there will be.

6. Min Move Volatility Mult – a multiplier for the base candle size relative to the volatility segment.

After the settings, we see a chart with candles:

IMPORTANT!!!

Do not forget that the chart can adjust adequately to the market and the number of candles you set only after accumulating at least one day's worth of transaction tape history. The adaptation itself 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 the candles in OsEngine is openly 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!

OsEngine Support