FAQ4 min read
Current constraints and known limitations in kScript. Many of these will be addressed in future updates as the language continues to evolve.
Syntax Limitations
No Block Comments
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.
Single Quotes Not Allowed
String literals must use double quotes ("). Single quotes (') are not supported and will cause syntax errors.
Solution: Always use double quotes for strings.
Only ‘var’ for Variable Declaration
kScript only supports thevar 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
No Module/Import System
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.No Switch/Case Statement
kScript only supportsif/else conditionals. The switch/case statement is not available.
Solution: Use multiple if-else statements or ternary operators.
No Default Parameters
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 theinput() function for user-configurable defaults.
No Rest/Spread Parameters
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.Limited Data Types
kScript has a restricted set of data types:numberstringbooleantimeseriesarray
Limited Built-in Functions
kScript is still expanding its standard library. Some functions available in other scripting languages may not yet be available. Check the kScript Reference for available functions, or request new features in our Discord community.Data Processing Limitations
Limited Historical Data Access
Historical data access is limited by available data. Very long lookback periods may not have enough data, especially for newer trading pairs or less popular exchanges.No Future Data Access
Scripts cannot access data from future bars (e.g.,ts[-1] is invalid). This prevents look-ahead bias in analysis.
Execution Time Limit
Scripts must complete execution within 500ms (excluding data fetch). This ensures responsive chart rendering and prevents infinite loops. Solutions:- Optimize loops and calculations
- Reduce lookback periods
- Simplify complex logic
No Cross-Bar Variable Persistence
var variables cannot maintain state between bars. Use timeseries for values that need historical access, or static for persistent values.
Workarounds Summary
| Limitation | Workaround |
|---|---|
| No block comments | Use multiple // comments |
| No single quotes | Use double quotes " |
No let/const | Use var |
| No imports | Copy-paste code |
| No switch/case | Use if-else chains |
| No default params | Check for null/0 |
| Limited types | Use available types creatively |