Jan
20

Formula 201 – #10 Update Scheme (By Tick vs. On Bar Completion)

All the tutorials so far focus on how to write indicator. However, there are some fundamental options related to indicators that we have to cover now.

(Lawrence – If you are using NeoTicker EOD, you do not need to worry about the issues discussed in this article.)

Issues Related to Real-Time Update

In real-time, data for each symbol is streamed into the charts tick by tick. The data series within the charts are then updated internally tick by tick.

Indicators, however, can choose between two update schemes. First, there is the update on bar completion method. The other method is called update by tick. Each update scheme has its usage and purposes. We will explain each method in detail.

Update On Bar Completion

When an indicator is set to update on bar completion, the indicator is updated only when the last bar of its reference series is completed.

How do we know that it is completed? Thats a very good question. For most bar types, it is the arrival of the first tick for the next bar that identifies the completion.

Update on bar completion is useful when,

1. The indicator does not really provide meaningful information when being updated by tick, or

2. The indicators is very complex and would take up too much computer power if updated by tick.

An example of case 1 is the detection of moving average crossover. Confirmed signal of moving average crossover can only come from completed bars. When the price bar is not completed yet, a crossover signal could be reversed by the time the bar is actually completed.

Update By Tick

When an indicator is set to update by tick, the indicator is updated on every new tick arrival.

But what is a tick? The original definition of tick means a trade that just happened. For most data feeds, this definition is still correct. However, for some data feeds, individual trades are not always sent separately. For these feeds, the update by tick meaning is blurred and less meaningful.

Update by tick is useful when,

1. We wanted to see visually on a chart how the indicator is developing its results in real-time

2. The indicator has a dependency on the data behaviour at intra-tick level

Well known example of case 2 are the Tick Precise indicators. There are also trading systems specifically designed to work on tick level data.

Local Variables Carry Tick Level Memory Effect

Series variables always restore their values to the initial condition when the previous bar was completed, thus allowing consistent calculation results no matter how many updates happened within a bar. Take a look at a simple indicator like simple moving average. No matter the indicator is updated by tick or updated on bar completion, its result is always the same.

That is different comparing to local variables in the formula language. Local variables have a very special property that the values they stored always persist from one update to another.

Thus, if you expect your indicator to be used in update by tick situation, but it is designed for update on bar only, then do not use local variables to store values to be referenced in subsequent updates. Instead, use series variables only for correctness.

An Example Illustrating the Difference

Lets create a 1-minute chart of emini S&P.

I have added 2 FML indicators onto the chart, both using the same formula below,

$a := $a + 1

One of them is set to update on bar completion while the other one is set to update by tick.

When you first add the indicators they will have exactly the same result after initial recalculation because recaculation happens on a bar by bar basis.

Now, if you let the chart update in real-time, or, using the Tick Replay capability of the chart to replay tick data once, the 2 indicators will return significantly different values.

formula201 part10 chart

The FML indicator updated on bar completion is effectively calculating the number of bars in the data series.

The FML indicator updated by tick, however, is calculating the number of ticks in the data series.

Indicators in Quote Formula

When you use an indicator in a Quote window formula column, or in any other context that utilizes quote formulas, these indicators are automatically managed by the Cache Manager. These indicators are always updated by tick. (Lawrence – this statement is correct as of January 12, 2006) Thus, When you design an indicator that will work specifically in the quote window, you must take this property into your consideration.

For example, you are writing an indicator that detects a special price pattern and sends your message to a report window. If you simply detect the setup and output your message to a report window, your indicator will do that on every single tick. There are ways to properly handle this issue, and I will discuss the related programming techniques in the next tutorial.

Tick Precise Indicators

When an indicator is designed to utilize tick level information, we call them Tick Precise indicators. These indicators do not function correctly when you first add them to a chart. The reason is that they requires tick replay to generate the correct historical values.

Summary

As illustrated by the examples in this article, the two update schemes can fundamentally affect how an indicator is updated in real-time (or during tick replay). In general, if your intention is to write a simple indicator, then you should stick with designs that do not utilize tick level memory effect. In case you are designing indicators that will be used in quote formulas, then you have to pay attention to your design so that it can return the proper values as you expected.

Exercise

No exercise for this tutorial.

Answers For Previous Exercise

To figure out the number of times the market gap down by 2 points or more, use the following formula in the FML indicator,

cum (o < c (1) - 2)

Then, to figure out the number of times that after the market gap down by 2 points or more, the number of times the market make a high higher than the previous close, use this formula,

cum (o < c (1) - 2 and h >= c (1))

Discuss this article

One Comment on “Formula 201 – #10 Update Scheme (By Tick vs. On Bar Completion)”

  1. Aram Says:

    Hello Lawrence,

    I am looking at a new development environment for some custom indicators I have made.I use Trade Station but it is very slow and cannot multithread. I gather data from many sysmbols and create a custom indicator that I would like to push back into say a 100 tick AAPL chart or 300 or 500 tick. Would this be possible with NeoTicker?

    Any help would be great .Thanks

Leave a Comment

Blog Developed
By ContentRobot