TradeViora AcademyLearn. Analyze. Practice. Trade Smarter.
Menu

FREE FINANCIAL EDUCATION

Price-bin origin and tick rounding

Map prices to bins using a declared origin and half-open intervals.

0%

What you will learn

Prerequisites: Exchange tick size, integer arithmetic and bin widths.

Mechanism and decision rules

A binning function needs both width and origin. With origin O and width W, a price P belongs to index floor((P−O)/W) under a left-inclusive/right-exclusive rule. The corresponding interval is[O+iW, O+(i+1)W). ShiftingO can regroup trades even when W remains unchanged. A label should indicate whether it represents a bin’s lower edge, midpoint or another convention.

Where prices lie on a known tick grid, convert them to integer ticks before grouping. Binary floating-point representations can place a value extremely close to a boundary on the wrong side if naive equality tests are used. Off-grid prices need an explicit validation or rounding policy; silently rounding every record can conceal feed or corporate-action problems.

Worked example · synthetic data

Synthetic prices 100.00,100.25,100.50 and 100.75 have volumes 10,20,30 and 40. With origin 100 and width 0.50, bins[100,100.5) and[100.5,101) contain 30 and 70. Shift the origin to 99.75 with the same width: bins[99.75,100.25),[100.25,100.75) and[100.75,101.25) contain 10,50 and 40.

The maximum changes from a 70-unit bin to a 50-unit bin solely because boundaries moved. Total volume stays 100. The exact 100.50 price belongs to the second original bin under the declared half-open rule.

Failure modes and limits

Some instruments change tick size by price band or date. Adjusted historical prices may no longer lie on the original raw tick grid. A bin midpoint is not necessarily a traded price. Compare profiles only after aligning width, origin, label and rounding conventions.

Practice case

Origin is 50, width 0.20 and price 50.40. Find its bin index and interval under the stated rule. With tick 0.05, how many integer ticks wide is each bin?

Reveal the worked answer

The index is floor((50.40−50)/0.20)=2, and the interval is[50.40,50.60). Each bin spans 0.20/0.05=4 ticks. Integer tick coordinates make the exact-boundary assignment explicit.

Check your understanding

What does bin width alone fail to specify?


Explanation

Equal-width histograms can group prices differently when origins differ.

Price 100.50 in[100,100.50) belongs where?


Explanation

The upper endpoint is excluded in the stated convention.

Why use integer ticks for grid-aligned data?


Explanation

Discrete tick coordinates represent exchange increments exactly when the specification is known.

Sources and next steps

The lesson, calculations and synthetic cases are original educational material. References explain underlying contract or chart conventions; none validates the profitability of a trading rule. Actual contract specifications, settlement obligations and charges must be checked before trading.

Explore OHLCV data in the chart lab · Explore volume-at-price and TPO data · Practice library