Input Fields

Basic Information

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.

Sorting

Inputs fields are automatically sorted alphabetically. You can influence the sorting by numbering the input field.

Tooltip

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

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.

InputGroupHeader is not available in the visual editor.

Comment Inputs

Input

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.

InputInterval

Creates a drop-down list with all available interval options. Can be used for multi-interval strategies.

InputOrderType

This creates a drop-down with the available order types. The result can be used in combination with SetOrderType or the PlaceOrder commands.

Account & Market

The 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.

‌With 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.

Pricesource & Price Market

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 market parameter.

Options Drop-down

‌InputOptions

‌Creates a drop-down with custom values.

‌InputConstant‌

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.

Constant Helpers‌

There are also a few input commands that are designed for a specific category. Commands like InputMaType(), InputSignalType() and InputCdlType() create a drop-down with all the options in that category.

Tables

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.