Aug
29

## Formula 101 – #5 Using Data Series

All the tutorials so far concentrate on the utilization of quote fields. From this tutorial onward, the focus will shift to the display and analysis of data series. The ability to embed data series in quote formulas sets apart NeoTicker quote formula from the rest of the applications available today. By mastering the use of data series within quote formulas, you will be able to summarize more information than you can ever imagine.

What is Data Series?

Data series are not just a single value displayed on your quote window like a quote field. Data series are much more than that. Data series in quote formula provide a way for you to analyze data similar to what you can do within a chart, without the burden of showing the details of everything within a chart. In other words, data series in quote formula let you pick out information you deem important in a chart and present that in the quote window in a very compact way.

Data Series Functions

To access the data series of any symbol, we need data series functions. These functions show you the specific field of a data series.

Here is the list of data series functions in their generalized form,

Open (BarsAgo, SeriesDescriptor)
High (BarsAgo, SeriesDescriptor)
Low (BarsAgo, SeriesDescriptor)
Close (BarsAgo, SeriesDescriptor)
Volume (BarsAgo, SeriesDescriptor)
OpenInterest (BarsAgo, SeriesDescriptor)
Date (BarsAgo, SeriesDescriptor)
Time (BarsAgo, SeriesDescriptor)
DateTime (BarsAgo, SeriesDescriptor)

The first few ones look very familiar, aren’t they?

Yes, some of the data series functions are sharing the same name as the quote fields. That does not mean that they are interchangable. Instead, the syntax of the quote formula is clearly separating the two. For example, when you refer to the quote field open, you never provide it with a parameter list; on the other hand, for the data series function open, it is always followed with a parameter list.

SeriesDescriptor Parameter

We’ll discuss the SeriesDescriptor parameter first. This parameter tells NeoTicker what type of data series you are interested in.

For example, to access a 5-minute data series, the SeriesDescriptor is M5.

To access a 15-minute data series, the SeriesDescriptor is M15.

You can tell NeoTicker that you are interested in other type of data series, the following is a list of the possible choices,

Tn – n-tick series
Sn – n-second series
Mn – n-minute series
Hn – n-hour series
Dn – n-day series
Wn – n-week series

So, if you are interested in looking at a 15-second bar series, then you can access the series by writing the SeriesDescriptor S15.

BarsAgo Parameter

BarsAgo simply means number of bars ago from the last bar in the series.

If you want to look at the last bar of the series, you can write 0 as the BarsAgo parameter.

If you are interested in the second last bar in the series, you can write 1 as the BarsAgo parameter.

Thus, if you want to get the previous low price of a 15-minute data series, then you can write the following expression in your formula,

Low (1, M15)

If you are interested in checking out the high of the current 30-minute bar to see if it is higher than the previous one, you will write this,

High (0, M30) > High (1, M30)

Optional BarsAgo Parameter

There is a special case that you can omit the bars ago parameter when you write a quote formula. Thats when the bars ago parameter is 0. NeoTicker can recognize such special syntax and assume the default value for the bars ago parameter is 0.

Here is an example,

Close (M5) > Close (1, M5)

is a short form for

Close (0, M5) > Close (1, M5)

The reason why NeoTicker support such shorthand is obvious – it is so common that users are accessing the current value of the data series, typing in the extra bars ago parameter in the formula is both cumbersome and less readable.

Short Forms of the Data Series Functions

Since there is short form for the BarsAgo parameter, it is not surprising that NeoTicker also supports short form of the data series functions, because they are so common in quote formulas.

Here are the short forms,

O () can be used interchangably with Open ()
H () can be used interchangably with High ()
L () can be used interchangably with Low ()
C () can be used interchangably with Close ()
V () can be used interchangably with Volume ()
T () can be used interchangably with Tick ()

So the following comparison in quote formula,

High (1, M5) > High (0, M5) and Low (1, M5) < Low (0, M5)

can be written as,

H (1, M5) > H (M5) and L (1, M5) < L (M5)

For both cases they detect for the same price formation - the current bar is forming an inside bar pattern.

Using the Indicator Wizard

All the syntax and details we talked above are pretty tedious. And it takes time to remember them such that you can type them out as if you are writing in your native language.

On the other hand, if you cannot remember the syntax and the details, NeoTicker has an Indicator Wizard that can help you construct formulas without knowing the exact syntax.

When you are entering a formula for a formula column, notice that there is a button Indicator Wizard. Press the button, the Indicator Wizard will show and then you can specify your data series easily.

Here is how the Indicator Wizard looks like,

All the data series functions are listed in the indicator group Quotes. In case your current indicator group is not Quotes, don't panic. Just press the down arrow button next to show all. A list of all available indicator groups will popup, just choose Quotes will do.

Indicator Wizard is a great tool whenever we need some help related to the syntax or in case we forget what parameters does a particular indicator requires. It works like a dictionary, or, a reference tool, that help us get the proper syntax into our formula.

Quote Window Data Setting

One topic we have to cover is data setting. For now, we'll focus on its basic relationship to quote formula's data series.

Data setting is really data series setting. It provides all the details necessary to define the data series. For example, if we are trying to examine the bars of a 5-minute data series, then NeoTicker needs to know whether you are talking about 24-hour based 5-minute bars, or, maybe just the bars within regular trading hours. For all the quote formulas used within a quote window, they are bounded by the general data setting in the quote window setup.

As you can see from the screenshot, data setting has quite a number of settings. Luckily, you can use one of the predefined time frames, so that you do not need to adjust the settings manually.

Example - Recognize CandleStick White Hammer

We are going to highlight the symbols that have a white hammer in its previous 15-minute bar.

In case you do not know what a white hammer is - it is a candlestick chart pattern. A hammer is a candlestick with open and close prices both higher than the midpoint of the bar. A white candle has its close price greater than open price. A white hammer is a combination of these two conditions.

The formula is not complex,

close (1, M15) > open (1, M15)
and close (1, M15) > (high (1, M15) + low (1, M15)) / 2
and open (1, M15) > (high (1, M15) + low (1, M15)) / 2

By translating what I said in the previous paragraph, you will get the formula above. Since the whole formula is a boolean expression, the result is either 1 or 0, depending on the symbol in question whether it meets the criteria.

Here is a screenshot of the formula,

Remember that the Column Setup window is resizable – if you need more window space to type your formula, expand the window! Thats what I did when I need to take this screenshot because the formula is longer than the default window size.

Now, we define the color rules in the column setup window,

Here is how it looks like in real-time with our quote window highlighting the white hammer condition automatically,

Summary

Data series access is the foundation for various price patterns and indicator patterns recognition. You will be able to use it effectively once you get enough practice.

Exercise

1. What is the formula for the condition that we just make a new high in the previous 5-minute bar comparing to previous trading day?

2. What is the formula for the condition that we just made 3 consecutive higher close in 10-minute bar?

3. What is the formula for the condition that we just crossed the previous day close in 15-minute bar?

1. The formula is pretty long,

choose (
Open > PrevClose and Last > PrevClose * 1.01, 2,
Open < PrevClose and Last < PrevClose and Last > PrevClose * 0.995, 1,
0)

Then in the color rules setting, you can use >= 2 for green, >= 1 for yellow, and default using black.

2. Another very long formula,

choose (
High - Last < (High - Low) * 0.05, 2, Last - Low < (High - Low) * 0.05, 1, 0)

Then in the color rules setting, you can use >= 2 for green, >= 1 for red, and default using black.