Advanced concepts

Advanced concepts

Tracking Recent Volume

This example shows how to estimate how many contracts have traded within a certain number of seconds in the past. This functionality is achieved using the Stopwatch Block.

In general:

  1. Multiply hour x3600 and minute x60 to calculate the number of seconds.
  2. Use a Value Bucket to Sum up the Volume traded during each second (Hole=Current Second, Value=TradeQty)
  3. Use a Value Accumulator to Sum all Trade Qty
  4. Every second, subtract the volume from X seconds ago

The "Erased Volume" Value Accumulator's formula is the Block Value for the Value Bucket marked "Volume to Erase".