Feb
23

Formula 201 – #13 Meta Style

In writing indicators, there is a special technique called Meta Style that change the way how an indicator is displayed based on the number of plots it has. It is a very useful technique in providing display styles that are not possible with traditional lines and histograms.

What is Meta Style?

When designing an indicator, sometimes we wish to display the information in a special way to make more sense out of the data. For example, many traders prefer to show volume in histogram as oppose to using connected lines.

There are many different meta styles and the meta styles that you can apply depend on the number of plots in your indicators .

When your indicator has 2 plots, then you can choose to show that normally as 2 separate lines, or, you can show that in HighLow meta style which is effectively a bar with no open or close markers. You can also choose to show that in Region meta style that paint the area covered between the 2 lines.

When your indicator has more than 2 plots, you will have more meta styles to choose from. One of the more well known meta styles is OHLC that works with indicators having 4 plots or more. This particular meta style will use the first 4 plots of the indicator as a virtual data series and display those data as a bar series with open, high, low, and close. The sub series indicator is set to use OHLC meta style as the default.

An Example – TP Bid Ask Trade Vol N Min Max

When using the indicator TP Bid Ask Trade Vol N indicator, we can set it to show the net volume based on the last N ticks. That being said, we can only see the reading of the indicator based on the last tick on each bar. For example, if we are charting 1-minute series, then even though this indicator produced results for every tick, we can only see the final reading at the closing of each 1-minute bar.

Ever wonder how the indicator values changed within each bar? The example indicator I am showing here will track the changes and give you the maximum and minimum values within each bar.

I am calling this indicator TP Bid Ask Trade Vol N Min Max.

Indicator Specification

Take a look at the Indicator Specification.

formula201 part13 indicator setup

Notice the Style is set to HighLow. This meta style will show a vertical bar using the first plot as the high and second plot as the low.

Since we are going to plot the minimum and maximum values of the TP indicator, using the traditional lines will make the display way too clutter. HighLow meta style is perfect for our display requirement.

The Script

Here is the code.

formula201 part13 script

The key techniques (detecting bar change and assigning local variables to series variables) in the formulas above are already discussed in the previous tutorial, #12 Writing Tick Precise Indicator.

The technique used to store the minimum and maximum values is a form of recursion where the previously stored values of the local variables are reused in their own calculations. Recursion was discussed in the tutorial, #6 Local Variables and Recursion.

How It Looks Like

Here is a chart of 1-minute Emini S&P after Tick Replay is applied.

formula201 part13 chart

As a comparison, I have put the original TP Bid Ask Trade Vol N indicator in the middle pane.

Both indicators are using the same set of parameters – 1000, N Tick, No Break.

Notice that the major extremes are not reflected by the original indicator due to the fact that it is just the final reading for the bars we are looking at.

On the other hand, the details that we have missed are now restored in our custom indicator.

Summary

The technique I have used here can be applied onto other indicators to obtain their intrabar changes in a similar way. Feel free to try it out.

Complete Indicator

TP Bid Ask Trade Vol N Min Max.

Discussion

Leave a Comment

Blog Developed
By ContentRobot