Syntax Limitations

Current restrictions in kScript syntax and expression support.

kScript currently only supports single-line comments using //. Multi-line block comments with /* */ are not yet supported.

✓ Workaround
Use multiple single-line comments for longer explanations

String literals must use double quotes ("). Single quotes (') are not supported and will cause syntax errors.

✓ Solution
Always use double quotes for strings and basically everything

Function calls must use either all keyword arguments or all positional arguments. Mixing both styles in the same function call is not supported and will cause errors.

✓ Solution
Choose one style and use it consistently throughout the function call

kScript only supports the var keyword for variable declarations. Modern JavaScript keywords like let and const are not supported.

✓ Solution
Use var for all variable declarations, timeseries for time series data sources

Feature Limitations

Language features that are currently not available or have restrictions.

kScript does not support importing code from other files. All code must be written in a single file.

✓ Workaround
Copy-paste shared functions or use string concatenation for reusable code

kScript only supports if/else conditionals. The switch/case statement is not available.

✓ Solution
Use multiple if-else statements or ternary operators

Function parameters cannot have default values. All parameters must be provided when calling the function.

✓ Workaround
Use null checking and assign defaults in the function body, or use the input() function for user-configurable defaults

Functions must have a fixed number of parameters. Variable-length argument lists (rest parameters) are not supported.

✓ Workaround
Use arrays to pass multiple values, or define separate functions for different parameter counts

kScript has a restricted set of data types compared to general-purpose programming languages. Supported types include numbers, strings, booleans, and timeseries.

ℹ️ Supported Types
number, string, boolean, timeseries, array (v2.0)

kScript is still expanding its standard library. Some functions available in other scripting languages may not yet be available.

📖 Resources
Check the kScript Reference for available functions, or request new features in #kscript-floor

Data Processing Limitations

Constraints when working with historical and timeseries data.

Historical data availability depends on the data source. Accessing data too far back may return NaN or undefined values.

✓ Best Practice
Always check for NaN values and validate barIndex before accessing historical data
📖
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