Blog Forex Data Engineering

Forex Bar Generator: Column Dictionary & Calculations (tick → M1…D1)

Sep 30, 2025 · 5 min read
Forex Bar Generator: Column Dictionary & Calculations (tick → M1…D1)

Summary

Clear, audit-grade documentation for every output column—definitions, units, and formulas—so your downstream research and AI stay reproducible.

Share

YouTube

Quick facts

  • Published: 2025-09-30
  • Category: Forex Data Engineering
  • Reading time: 5 min
  • Words: 888

What exactly does each column mean? This post documents the Bar Generator output schema end-to-end — precise definitions, units, and formulas — so your research, backtests, and AI features remain deterministic and audit-grade.

Sample header (exact columns)

Gmt time,Ask_first,Ask_max,Ask_min,Ask_last,Bid_first,Bid_max,Bid_min,Bid_last,AskVolume_sum,BidVolume_sum,Spread_mean,Spread_max,Mid_first,Mid_last,Tick_count,Vol_imbalance,Gap_flag,Timestamp_ms,VWAP,HL_range,Mid_std,Price_change_cnt,AskVol_pct,BidVol_pct,Return,HL_ratio,Quote_spread_var

Reading basics

  • Timezone: All timestamps are strict UTC. Gmt time is timezone-aware (+00:00).
  • Price units: All prices/spreads are in price units (not pips). Convert to pips via symbol pip size (e.g., EURUSD pip = 1e-4).
  • Volumes: AskVolume_sum / BidVolume_sum aggregate tick volumes (broker/export-specific units).
  • Determinism: Same inputs + same policy ⇒ bit-for-bit identical outputs.

Column dictionary

Column Type Units Definition / Formula Notes
Gmt time datetime (ISO-8601) UTC Bar start timestamp, timezone-aware (e.g., 2015-01-01 22:00:00+00:00). Strict UTC avoids DST drift and keeps merges consistent.
Timestamp_ms int64 ms since epoch (UTC) floor(epoch_ms(Gmt time)). Convenient for joins/indexing in data pipelines.
Ask side OHLC within the bar —
Ask_firstfloatprice First ask quote in the bar. Ask open.
Ask_maxfloatprice Maximum ask quote across ticks in bar. Ask high.
Ask_minfloatprice Minimum ask quote across ticks in bar. Ask low.
Ask_lastfloatprice Last ask quote in the bar. Ask close.
Bid side OHLC within the bar —
Bid_firstfloatprice First bid quote in the bar. Bid open.
Bid_maxfloatprice Maximum bid quote across ticks in bar. Bid high.
Bid_minfloatprice Minimum bid quote across ticks in bar. Bid low.
Bid_lastfloatprice Last bid quote in the bar. Bid close.
Volumes and mix —
AskVolume_sumfloatvolume units \sum AskVolume_i over ticks in bar. Broker/export dependent units.
BidVolume_sumfloatvolume units \sum BidVolume_i over ticks in bar. Broker/export dependent units.
AskVol_pctfloatratio (0–1) AskVolume_sum / (AskVolume_sum + BidVolume_sum) Share of ask volume.
BidVol_pctfloatratio (0–1) BidVolume_sum / (AskVolume_sum + BidVolume_sum) Share of bid volume.
Vol_imbalancefloatvolume units AskVolume_sum − BidVolume_sum Positive = ask-heavy flow; negative = bid-heavy.
— Mid price, spread & variability —
Mid_firstfloatprice (Ask_first + Bid_first) / 2 Mid open.
Mid_lastfloatprice (Ask_last + Bid_last) / 2 Mid close.
Spread_meanfloatprice Mean of (Ask_i − Bid_i) across bar. Convert to pips via pip size.
Spread_maxfloatprice Max of (Ask_i − Bid_i) across bar. Useful for stress screens.
Quote_spread_varfloatprice² Variance of (Ask_i − Bid_i) across bar. Measures intra-bar spread instability.
Mid_stdfloatprice Standard deviation of mid prices within bar. Micro-volatility proxy.
HL_rangefloatprice max(Mid_i) − min(Mid_i) Absolute intra-bar range.
HL_ratiofloatratio HL_range / VWAP Scale-free range; ≈ relative range.
— Trading activity & returns —
Tick_countintcount Number of ticks captured within the bar interval. Zero only if interval is empty and policy allows empty bars.
Price_change_cntintcount Times the mid price changed vs. previous tick inside the bar. Microstructure churn indicator.
VWAPfloatprice \sum(Mid_i × Vol_i) / \sum Vol_i, where Vol_i = AskVol_i + BidVol_i Falls back to simple mean if volume unavailable.
Returnfloatlog-return By default ln(Mid_last / Mid_first). (Close-to-close mode is configurable and documented in the manifest.) Use for bar-level features; deterministic per policy.
— Gaps & data quality flags —
Gap_flagint (0/1)flag 1 if a missing-ticks gap or feed interruption affected the bar; else 0. Exact gap policy is documented in the bar policy doc.

Conversions & examples

  • Spread (pips): Spread_mean / pip_size. For EURUSD (pip = 1e-4), 0.00024 ≈ 2.4 pips.
  • Relative range (%): HL_ratio × 100.
  • Return (bps): Return × 10,000 (approx.).

FAQ

Are spreads stored in pips?

No — spreads are in price units. Convert using the symbol’s pip size (e.g., 1e-4 for EURUSD).

Which return definition do you use?

Default is log return of mid open→close (ln(Mid_last/Mid_first)). Close→close is available as a documented option.

What happens if an interval has no ticks?

Policy can be no bar or empty/marked bar. The chosen rule is explicit and deterministic, and gaps set Gap_flag = 1.

Do you always weight VWAP by volume?

If tick volumes are present, VWAP is volume-weighted; otherwise, it degrades to a simple mid mean — behavior is documented in the manifest.

Try it with your data

Send a sample day of ticks; we’ll return M1–D1 bars + manifest + policy doc, so you can validate definitions and downstream impact.

Learn more about the Bar Generator