Type/to search
Getting Started
Platform Basics
Writing Strategies
Strategy Structure
Programming Languages
Strategy Parameters
Interactive Controls
Types of Interactive Controls
Interactive Controls in Status Bar
Strategy Frontend
Template Library
Built-in Libraries
UI Text Localization
API Quick Reference
Development Tools
Backtesting System
Advanced Topics
Data and Research
Extended API Interface

There are 5 types of interactive control. When the control's button is clicked, GetCommand in the strategy receives a string message. The variable names in the table are only examples:

TypeExample variableDefault valueMessage received by GetCommand()
Number (number)cmdNumOptional, may be emptyEnter 123 and click: cmdNum:123
Boolean (true/false)cmdBoolRequired, on or offClick with the switch on: cmdBool:true
String (string)cmdStrOptional, may be emptyEnter abc and click: cmdStr:abc
Dropdown (selected)cmdComboxOptional, may be emptyPick option 2 and click: cmdCombox:1 (index from 0)
Button (button)cmdBtnNo inputClick: cmdBtn

The message format is variable:value; a button sends only its variable name. Description, remarks and component configuration of interactive controls work as for strategy parameters; see Interface Parameter Types and Component Configuration.

Example: changing a strategy parameter with an interactive control

On the strategy editing page, add a string interactive control named changeSymbol under "Strategy Interaction". The settings of the interactive control:

Setting up an interactive control

While the strategy runs live, enter ETH_USDT in the control's input box and click its button; GetCommand() receives the message changeSymbol:ETH_USDT. The strategy detects the message and updates the corresponding variable (parameters set in the strategy interface are global variables too; a global variable in the code is used here for demonstration):

javascript
// strategy parameter var symbol = "BTC_USDT" function main() { while (true) { var cmd = GetCommand() if (cmd) { var arr = cmd.split(":") if (arr.length == 2 && arr[0] == "changeSymbol") { // the changeSymbol control was triggered: update the parameter Log("Changed symbol parameter to:", arr[1]) symbol = arr[1] } } LogStatus(_D(), ", Current symbol parameter value:", symbol) Sleep(3000) } }