Skip to main content
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.
// This is a comment
// This is another line of the comment
// Multi-line comments are not supported

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.
// Correct
var symbol = "BTCUSDT";

// Invalid - will cause error
// var symbol = 'BTCUSDT';

Only ‘var’ for Variable Declaration

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.
// Correct
var period = 14;
timeseries data = ohlcv(...);

// Invalid
// let period = 14;
// const period = 14;

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 supports if/else conditionals. The switch/case statement is not available. Solution: Use multiple if-else statements or ternary operators.
// Use if-else instead of switch
if (value == 1) {
  result = "one";
} else if (value == 2) {
  result = "two";
} else {
  result = "other";
}

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 the input() function for user-configurable defaults.
func myFunction(value, period) {
  var actualPeriod = period == 0 ? 14 : period;  // Default to 14
  // ...
}

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:
  • number
  • string
  • boolean
  • timeseries
  • array

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

LimitationWorkaround
No block commentsUse multiple // comments
No single quotesUse double quotes "
No let/constUse var
No importsCopy-paste code
No switch/caseUse if-else chains
No default paramsCheck for null/0
Limited typesUse available types creatively