Keyword Arguments
Learn how to use keyword arguments (kwargs) in kScript v2 for clear, readable, and maintainable function calls with named parameters.
Overview
Keyword arguments (kwargs) allow you to pass parameters to functions by name rather than position. This makes function calls more readable, reduces errors, and allows for flexible parameter ordering.
All
Function Support
Any
Parameter Order
Self
Documenting
Basic Syntax
Keyword Argument Format
Use the parameterName=value
syntax to pass arguments by name. You can mix positional and keyword arguments, but positional arguments must come first.
Keyword Arguments Syntax
Self-Documenting
Parameter names make function calls self-explanatory.
Flexible Order
Parameters can be specified in any order.
Selective Parameters
Easily specify only the parameters you need.
Practical Examples
Technical Indicators
Using kwargs makes indicator parameters crystal clear:
Technical Indicator Examples
Data Sources
Specify exactly which data you need:
Data Source Examples
Plotting & Visualization
Create clear, customized charts:
Plotting Examples