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:
- Multiply hour x3600 and minute x60 to calculate the number of seconds.
- Use a Value Bucket to Sum up the Volume traded during each second (Hole=Current Second, Value=TradeQty)
- Use a Value Accumulator to Sum all Trade Qty
- 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".