Appearance
Error Reference
This page describes all runtime errors you may encounter when writing dxScript indicators, along with explanations and solutions.
Member Access Errors
Not a function
Occurs when you try to invoke a non-callable value as a function.
Common Causes
- Calling a property that is not a method
- Calling a built-in series (like
close,open) as a function
Example
javascript
// ❌ Wrong: 'close' is a series, not a function
const x = close();'module' has no member 'X'
Occurs when accessing a non-existent member of a module or object.
Common Causes
- Typo in method or property name
- Accessing removed or renamed API
Example
javascript
// ❌ Wrong: Typo in method name
const avg = color.GREN;
// Error: 'color' has no member 'GREN'. Did you mean 'color.GREEN'?
// ❌ Wrong: Typo in method name
const len = input.bol("bool", true);
// Error: 'input' has no member 'bol'. Did you mean 'input.bool'?'module.X' is read-only and cannot be modified
Occurs when trying to assign a value to a read-only property.
Common Causes
- Trying to modify module objects
Example
javascript
// ❌ Wrong: Cannot modify module
input.bool = function () {
};
// Error: 'input.bool' is read-only and cannot be modifiedArgument Errors
'method' expected at least N argument(s), got M
Occurs when a function receives fewer arguments than required.
Common Causes
- Missing required parameters
- Optional parameters placed before required ones
- Forgetting to pass options object
Example
javascript
// ❌ Wrong: Missing name parameter
input.bool(true);
// Error: 'input.bool' expected at least 2 argument(s), got 1'method' parameter 'name' must be T, got T'
Occurs when an argument has the wrong type.
Common Causes
- Passing a string where a number is expected
- Passing a number where a series is expected
- Passing the wrong object type
Example
javascript
// ❌ Wrong: String instead of number
const len = input.double("length", "20");
// Error: 'input.double' parameter 'argument 2' must be number, got stringTroubleshooting Checklist
When you encounter an error:
- Check the spelling: error messages often suggest the correct name
- Verify the module: make sure you're using the right module (e.g.,
ta.smanotts.sma) - Count arguments: check required vs optional parameters in reference
- Check types: ensure arguments match expected types (number, string, series, etc.)
- Check context: some functions only work in
initsection, others inonTick() - Check mutability: built-in series and modules are read-only