Initial Balance Trading Levels

Discussion in 'Events' started by TT News, Nov 18, 2014.

  1. TT News

    TT News

    The following article originally appeared on TT's Trade Talk blog on November 17, 2014.
    Click to view more posts on Trade Talk.


    Initial Balance Trading Levels
    by Chris Figy, Product Manager

    With the release of X_TRADER® 7.17.40, TT introduced a new feature in ADL® named TT Analytics. This feature uses a single block that brings a historical data solution to ADL along with a suite of technical indicators. It provides almost every value found in an X_STUDY® chart to your server-side algo. In this blog post, I will introduce the block while demonstrating how to find some important trading reference points.

    The TT Analytics Block can be found under Misc. Blocks on the left side of the ADL Designer Window. You simply drag this block onto the canvas and double click it to expose the properties page. If you're an X_STUDY user, the properties page will look familiar to you. Here you can add technical indicators and expose bar values such as open, high, low and close.

    [​IMG]
    Figure 1: TT Analytics in ADL.
    Figure 1 above shows the block with open, high, low, close and VWAP for the current daily bar of the December ES market. It also shows the Bollinger Bands technical indicator added to the block.

    Next, you add an Instrument block to the TT Analytics Block from within the properties page and define the type of bar data you want returned. Once this is complete, you can go in either of two different directions: you can add a technical indicator to the block or expose more bar data.

    Adding technical indicators is pretty straightforward unless you’re completely new to them, so I’ll skip that and focus on getting more bar data from the block. Exposing more historical data is done by using the one technical indicator found in ADL which is not in X_STUDY, the Previous Property indicator. This indicator will add additional output values of older data points to the block. Be sure to set the ExposeOutputValues property to “true” or output values will not display on the block.

    Now that we have moved through the block setup process, let’s get our reference points. Figure 1 exposes the current day’s values, but some might argue that yesterday’s values are equally as important. So let’s address that first.

    Since the Previous Property indicator only exposes the value you have selected, you will need four TT Analytics Blocks on the canvas to expose the previous day’s open, high, low and close. This is fine and fits the “keep the blocks simple” model of ADL; you can build complex group blocks. Once you like your solution, I highly recommend grouping these blocks into a Library Block you can use again and again. This is demonstrated in Figure 2 below with a Library Block labeled Bar Values.

    [​IMG]
    Figure 2: This adds the user-created Library Block exposing
    today’s and the last three days’ open, high, low and close values.

    Now let’s explore inside the Bar Values Library Block. Looking at Figure 3 below, you can see there are four blocks, each with the previous property applied three times. Now we not only have today’s open, high, low and close, we also have values from the last three days.


    [​IMG]
    Figure 3: Looks inside the Bar
    Values Library Block in Figure 2.

    While creating this, you can create one TT Analytics Block with its output connectors and then simply copy and paste to speed up your algo development. Then open the new pasted block and change the drop-down to the new desired value (e.g., from open to high) and change the name of your output connectors. In minutes, you will have more data points than you know what to do with.

    Now I’ll demonstrate the more complicated task of finding the initial balance range for the ES December market. The initial balance range is the opening hour of trading.

    By opening hour, I’m referring to the opening hour of the pit session, or what TT calls the primary session. For ES, this is 8:30 to 9:30 am CT. The initial balance is used to create upper and lower reference levels for the remainder of the day. I’ve seen many different calculations and will demonstrate a common one here.

    Let’s begin building these important reference data points. To find the opening hour range, set the bar type to 60 minutes and the session to Primary. Since I know there are only seven hours in the primary session for ES, I’ll only need the last seven hourly highs and lows. So this requires two TT Analytics Blocks--one for the highs and one for the lows. Each block will expose the current high or low and then add the previous property indicator six times.

    This Library Block will then need to generate an integer that is the count of bars back from now to find the desired initial balance hour. Figure 4 below shows how to do this using the Clock Block and a few basic blocks.

    [​IMG]
    Figure 4: Calculate how many bars
    back to go to find the initial balance hour.

    Now several If-Then-Else Blocks are used to find when the generated value equals the desired value. This gets a little messy, but it is still manageable. Again, I suggest you create one Number Block, Equal Block and If-Then-Else Block and copy-paste for rapid development.

    That’s it. We have found the bar that is the initial balance bar and use the bar’s high and low. See Figure 5 below for the high value of initial balance.

    [​IMG]
    Figure 5: The initial balance high value is determined.

    The initial balance high is then grouped and copied so the Library Block will contain two additional group blocks in it--one for the high and one for the low. The rest of the Library Block in Figure 6 below is fairly straightforward. It will take the initial balance range and add it to the high and subtract it from the low. It will also take half the range and do the same. You can go crazy here and add several other values, like two times the range.

    [​IMG]
    Figure 6: With the initial balance high and low, we
    can calculate its range and the important trading
    reference points for the rest of the day.

    Figure 7 below shows the ADL Designer Canvas with both Library Blocks created in the blog.

    [​IMG]
    Figure 7: ADL Designer Canvas with trading reference levels.

    You can find this algo on the ADL sample code section of our User Forum under Blog on Initial Balance Levels.

    The customers I've talked with are excited about the historical data solution provided by TT Analytics, and I am, too. I hope you are equally excited, and that you find this new block a useful addition to ADL.