Parameters
At the heart of Botmain's automation platform lies its advanced backtesting engine, designed to give traders the ability to rigorously test and refine their strategies under a wide array of market conditions. One key enabler is the ability to create custom input parameters to your strategy and then run multiple backtests for each parameter combination. This allows the trader to view portfolio analytics for each combination for granular analysis of strategy performance but also helps the trader identify optimal configurations.
Botmain identifies any @Parameter()
-decorated properties on your strategy class and allows you to provide values for them through the GUI. This includes all @Parameter()
-decorated properties on all @Inject()
-decorated
Creating strategy input parameters
- Define a @Parameter() property:
- On your strategy class, add the
@Parameter()
decorator to one of your properties.
- On your strategy class, add the
import { InstrumentProcessorBase , Parameter } from "@botmain/common";
export class TrendTrader extends InstrumentProcessorBase {
static display = "Trend Trader";
@Parameter() allowTrading: boolean;
}
- Implement
getRunSettingsInputs()
:- Implement static method
getRunSettingsInputs()
to bind parameters to the GUI
- Implement static method
import { InstrumentProcessorBase , Parameter, InputParameter } from "@botmain/common";
export class TrendTrader extends InstrumentProcessorBase {
static display = "Trend Trader";
@Parameter() allowTrading: boolean;
static getRunSettingsInputs() {
return [
new InputParameter<TrendTrader>({
key: 'allowTrading',
type: 'checkbox',
display: 'Allow Trading',
defaultValue: true
})
]
}
}
The type
option indicates how the parameter should be displayed in the GUI. Possible values include search-select
, single-select
, multi-select
, checkbox
, and input
. The above parameter will display in the GUI as such.

Indicator Parameters
Most built-in indicator have parameters such as period
to control the lookback calculation period. You can also define parameters on your customer indicators. All indicator parameters, including indicators nested inside other indicators are displayed in the GUI:
For example, try adding an Exponential Moving Average indicator to your strategy:
import { InstrumentProcessorBase , Parameter, InputParameter } from "@botmain/common";
import { ExponentialMovingAverage } from "@botmain/indicators";
export class TrendTrader extends InstrumentProcessorBase {
static display = "Trend Trader";
@Inject() ema: ExponentialMovingAverage ;
@Parameter() allowTrading: boolean;
static getRunSettingsInputs() {
return [
new InputParameter<TrendTrader>({
key: 'allowTrading',
type: 'checkbox',
display: 'Allow Trading',
defaultValue: true
})
]
}
}
The result will be 2 additional parameters added to the GUI:

Providing multiple parameter values
A powerful feature is available by providing multiple, comma-separated parameter values. When parameters are given multiple values, the number of test runs will increase by the combination of all parameter values.
For example, below we provide multiple values to the Ema period
and smoothing factor
parameters:

As a result, the number of test runs has increased to 6. That is, 3 possibilities for period
and 2 possibilities for smoothingFactor
, resulting in 6 possible combinations.
These backtests will run independently and you will have the opportunity to evaluate each combination's performance and determine the most effective settings for your strategy. This process is a form of manual optimization.
For more powerful optimization strategies, see