Orderbook Functions
Functions for working with orderbook data to analyze market depth, liquidity distribution, and order flow patterns. These functions help identify support/resistance levels and market sentiment through bid/ask analysis.
Overview
Volume Analysis
Sum bid and ask volumes within specified depth percentages to gauge buying and selling pressure at different price levels.
Order Size Analysis
Identify maximum and minimum order sizes within the orderbook to spot large players and market microstructure patterns.
Market Depth
Analyze orderbook depth and liquidity distribution to understand support/resistance levels and potential price impact.
Functions Reference
sumBids - calculate total bid volume within depth
sumBids(source: TimeSeries, depthPct?: number = 10): number
Parameters:
- source (TimeSeries) - Source orderbook data series
- depthPct (number) - Depth percentage (default: 10)
Returns:
number (total bid volume within depth)
Code Example:
sumAsks - calculate total ask volume within depth
sumAsks(source: TimeSeries, depthPct?: number = 10): number
Parameters:
- source (TimeSeries) - Source orderbook data series
- depthPct (number) - Depth percentage (default: 10)
Returns:
number (total ask volume within depth)
Code Example:
maxBidAmount - find largest bid order within depth
maxBidAmount(source: TimeSeries, depthPct?: number = 10): number
Parameters:
- source (TimeSeries) - Source orderbook data series
- depthPct (number) - Depth percentage (default: 10)
Returns:
number (largest bid order size within depth)
Code Example:
maxAskAmount - find largest ask order within depth
maxAskAmount(source: TimeSeries, depthPct?: number = 10): number
Parameters:
- source (TimeSeries) - Source orderbook data series
- depthPct (number) - Depth percentage (default: 10)
Returns:
number (largest ask order size within depth)
Code Example:
minBidAmount - find smallest bid order within depth
minBidAmount(source: TimeSeries, depthPct?: number = 10): number
Parameters:
- source (TimeSeries) - Source orderbook data series
- depthPct (number) - Depth percentage (default: 10)
Returns:
number (smallest bid order size within depth)
Code Example:
minAskAmount - find smallest ask order within depth
minAskAmount(source: TimeSeries, depthPct?: number = 10): number
Parameters:
- source (TimeSeries) - Source orderbook data series
- depthPct (number) - Depth percentage (default: 10)
Returns:
number (smallest ask order size within depth)
Code Example:
Best Practices
Depth Analysis
Use smaller depth percentages (1-5%) to focus on top-of-book activity, larger percentages (10-20%) for overall market depth analysis.
Volume Imbalance
Significant bid/ask volume imbalances often precede price movements. High bid volume suggests upward pressure, high ask volume suggests downward pressure.
Large Order Impact
Monitor maximum order sizes for signs of institutional activity. Sudden appearance of large orders can indicate significant market events.