Tick Rate Indicator
( Standard and OOEL Versions )
Ticks is a reserved word that represents the combined number of UpTicks and Downticks. defined as the total of UpTicks and DownTicks. However, its definition can be altered by the chart settings as described in the TS Help file for reserved word Ticks:
Fig. 1. EasyLanguage Reserved Words Related to Ticks, Volume & Open Interest
TickRate is the number of "ticks" per second. The indicator TickRate and TickRate.OOEL allow the user to display the TickRate in ticks per second or to use a multiplier to display the number of ticks in some other time period, such as 1 minute (by using a multiplier of 60).
The two screen shots below, are demonstrating the use of both indicators showing TickRate as the number of ticks per minute.
During Market Hours
After Market Hours
Fig. 2. Standard EL and OOEL Versions of TickRate Indicators Configured to Show Average Ticks Per Minute
Period (sec) indicates the number of seconds used to calculate the average number of ticks. Mult (sec) indicates the multiplier applied to the ticks per second output. In this case, multiplying ticks per second by 60 yields the ticks per minute. Calc (sec) indicates the interval in seconds with which TickRate is updated.
The differences between TickRate and TickRate.OOEL, as configured above, are attributed to the fact that TickRate recalculates the TickRate each time a new tick is received, and TickRate.OOEL updates the TickRate every second (Calc = 1).
Uses of the TickRate Indicator
- Assessing current relative liquidity of futures contracts that trade day and night.
- Assessing current intraday liquidity of all stocks and futures contracts, as these vary substantially during the open session.
For example, the volume or ticks of the opening and closing 30 minutes of the session is typically about 4 times greater than the volume or ticks trading during the midday "lunch" break. Using TickRate, a trader can quickly determine if midday liquidity is adequate for an anticipated trade.
- Changes in the TickRate in response to news events will be visible to the trader sooner than waiiting for the volume bar to print on minute bar charts.
Standard EasyLanguage Coding
The time interval between each tick is calculated, and added to an elapsed time variable. This elapsed time variable is used to determine which element of a circular array the ticks will be added to. When the array is full, it will start refreshing old tick totals with new totals in a circular fashion. The circular array will be used to keep the total number of ticks in the last Length seconds. From this circular array, the average ticks per second is calculated. This result can be multiplied by a constant, Mult, to express the results in ticks per minute (Mult = 60), ticks per hour (Mult = 3600), etc.
Object Oriented Easy Language Coding
The Timer object is used to generate a signal to execute code every second. This signal increments the index of the circular array by 1 every second. The total ticks collected during the 1 second interval is then stored in CountArray[Index]. This circular array covers a time period of Length seconds. The total ticks collected over Length seconds is averaged to produce a ticks per second value. This result can be multiplied by constant Mult to express the results in ticks per minute, ticks per hour, etc.
The OOEL version is much more efficient than the standard EL coding because the timer generates a signal once each second. This eliminates the need to use more CPU intensive timers such as ELTicToc to calculate the interval between each tick. Instead, the OOEL version simply calculates a running total number of ticks that occured in the most recent second. When the timer fires once every second, this running total is placed in the appropriate circular array element and then reset to zero so it can start accumulating the number of ticks for the next second.
To compare the relative efficiency of the code, we have standard EL code that executes every tick such as:
being replaced by OOEL code that executes every tick:
and OOEL code that executes only once per second:
The OOEL version is much more efficient because it:
Eliminates CPU intensive timing calculations by replacing these with a Timer object event triggered once per second.
- Executes only two lines of trivial calculations with each tick compared to the than the more CPU intensive timing calculations of the standard code which calls function ELTicToc.
- Plots output only once every CalcSec, rather than each tick. (I use a CalcSec value of 3 to 5 seconds, since it is not necessary to know the relative tick rate more frequently than that.)
Initial posted version: 03/13/2011
Latest Update: 03/13/2011
*.ELD files are compiled for TS 9.0
All ELD and code text files packaged here:
Users of earlier versions of Tradestation may compile the code
from the text files included in the above *.zip file.
The code may be visualized here:
Indicator TickRate (Standard EL)
Indicator TickRate.OOEL (Object oriented EL)