With the input field command you can create dynamic input field for your script. The command will create an input field in the settings menu after the script is saved. Using input fields for dynamic values such indicator parameter makes your life easier when tuning the script.
Inputs fields are automatically sorted alphabetically. You can influence the sorting by numbering the input field.
An input name should always be short but clear. Sometimes you need more room to explain the setting. Each input command has a tool-tip parameter which can be used to store and show additional information about the input.
Grouping input fields is a way to have clear sections in the menu. You can do this in two ways. The first, and easier way, is the
group parameter which every input command has. This will group all the inputs with the same group name and add a group header above them. Input fields without a group will be grouped under Other Settings.
The second grouping method only works in the script editor as used
InputGroupHeader(). This will automatically group and sort all inputs defined after that, until a next
InputGroupHeader() is used. Input fields above the first header are groped under Other Settings.
The most used input field command will be Input. This single command can create three types of input fields depending on the default value. The command supports numbers, text, and checkboxes. When there is no default value specified the default type will be a text field which can be used as a text or as a number input.
Creates a drop-down list with all available interval options. Can be used for multi-interval strategies.
This creates a drop-down with the available order types. The result can be used in combination with SetOrderType or the PlaceOrder commands.
InputAccount() command will create an account options drop-down. The return value is the account guid and can be used for every command containing an account or market parameter.
InputMarket() you can create a market drop-down that is connected to the selected main account. The return value can be used for every command containing a market parameter.
InputAccountMarket() will create 2 or 3 drop-downs depending on the selected account. One drop-down for a secondary account and the second is a market drop-down related to that account. Possibly a third drop-down when the selected market is margin/leverage. The return value will be a concatenated string of the account, market, and leverage. This can be used for every command that contains an account, market or leverage parameter.
InputPriceSource() will create a options list will the available price sources. With the return value and CreateMarket we can create market string of the main market and selected price source.
InputPriceSourceMarket() will create both a price source and market drop-down. The return value can be used for every command that requires or has an optional
Creates a drop-down with custom values.
Create an options drop-down based on the default value. All the commands belonging to the same category will be listed in the drop-down.
There are also a few input commands that are designed for a specific category. Commands like
InputCdlType() create a drop-down with all the options in that category.
HaasScript also supports tables as input fields. Although the support is limited to the script editor and only number fields are available, this type of input is perfect for settings like a market-making script or crypto index bot.
The command returns an array with the row values. By using a simple for-loop we can loop over the rows and collect the parameters.
The first parameter of the
InputTable() should always be the
InputTableOptions(). This is where we define the table specifications like the name, fixed number of rows, max number of rows and group. When the fixed number of rows is anything other than 0, the table will have a fixed number of input rows that cannot be deleted or expanded.
maxRows() allows for maximum numbers or rows without a minimum.
The rest of the parameters for
InputTable() are the
InputTableColumn() commands. This defines the column header and possibly (recommended) default values.