Overview

Volume Analysis

Sum bid and ask volumes within specified depth percentages to gauge buying and selling pressure at different price levels.

• Total bid volume • Total ask volume • Depth filtering

Order Size Analysis

Identify maximum and minimum order sizes within the orderbook to spot large players and market microstructure patterns.

• Largest orders • Smallest orders • Size distribution

Market Depth

Analyze orderbook depth and liquidity distribution to understand support/resistance levels and potential price impact.

• Depth percentage • Liquidity zones • Order clustering

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.

📖
Introduction
Overview of kScript language
🔍
Overview
Complete technical documentation
🚀
Quick Start
Get started with kScript basics
📋
Function Reference
Complete API reference guide
📚
Type System
Understanding kScript data types
General FAQ
Frequently asked questions about kScript
Best Practices
Guidelines for writing efficient kScript code
⚠️
Limitations
Known constraints and workarounds
🆕
Updates
v1 vs v2 differences and improvements
🔧
Core Concepts
Variables, data types & data sources
⚙️
Execution Model
Per-bar execution lifecycle and phases
🏷️
Keyword Arguments
Named parameters for clear function calls
🔗
Field Accessors
Dot notation for timeseries field access
🛠️
User-Defined Functions
Create custom reusable functions
🔗
Script Definition
Defining inputs and metadata
TimeSeries Management
Working with time-aligned data
🎯
Utility Functions
Helper functions and calculations
📈
Moving Averages
SMA, EMA and trend-following indicators
📊
Oscillators
RSI, Stochastic and momentum indicators
📈
Trend Indicators
Trend direction and strength analysis
📉
Volume Indicators
Volume-based analysis tools
📦
Orderbook Functions
Market depth analysis tools
🎨
Plotting & Visualization
Chart rendering and styling
🌈
Color Functions
Color manipulation and styling
📊
Data Subscriptions
Subscribe to OHLCV, trades, and orderbook data
🔄
Loops
For loops and while loops for iteration
🧮
Math Functions
Mathematical functions and constants
🏠
Go Home
Return to main landing page