Getting Started
Platform Basics
Writing Strategies
Development Tools
Backtesting System
Advanced Topics
Data and Research
Integrations
Template Library Parameters
Template libraries can also set their own interface parameters. Template library parameters are used as global variables in the template library code.
For example, we set a template library parameter:

| Variable Name in Strategy Code | Parameter Name Displayed on Strategy Interface | Type | Default Value |
|---|---|---|---|
| param1 | Template Parameter 1 | Number | 99 |
Parameters of a Rust template are constants that can only be read, not modified, so in Rust the example below can only read the parameter:
rust
// template code
pub fn GetParam1() -> f64 {
Log!("param1:", param1);
param1
}
rust
// strategy code
fn main() {
Log!("Calling ext::GetParam1:", ext::GetParam1());
}
Examples
-
Template library code for testing the
param1parameter:javascript$.SetParam1 = function(p1) { param1 = p1 } $.GetParam1 = function() { Log("param1:", param1) return param1 }pythondef SetParam1(p1): global param1 param1 = p1 def GetParam1(): Log("param1:", param1) return param1 ext.SetParam1 = SetParam1 ext.GetParam1 = GetParam1rust// Rust template parameters are read-only constants; see above for how to read them -
Strategy code referencing the above template library example, using the template library's exported functions to get parameter
param1and modify parameterparam1.javascriptfunction main () { Log("Calling $.GetParam1:", $.GetParam1()) Log("Calling $.SetParam1:", "#FF0000") $.SetParam1(20) Log("Calling $.GetParam1:", $.GetParam1()) }pythondef main(): Log("Calling ext.GetParam1:", ext.GetParam1()) Log("Calling ext.SetParam1:", "#FF0000") ext.SetParam1(20) Log("Calling ext.GetParam1:", ext.GetParam1())rust// Rust template parameters are read-only constants; see above for how to read them