Set Value
The Set Value rule outputs different numeric values depending on whether it has been executed. Before execution, it provides a configurable default value. After execution, it switches to a different update value. This creates simple state-based logic within your strategy.
How It Works
The Set Value rule starts by outputting the Default Value to any connected downstream rules. This initial output is available as soon as the strategy is loaded or deployed. When the rule is triggered and executes, the output changes to the Update Value and remains at that level until the strategy is reset or restarted.
This two-state behaviour is useful for implementing flags, toggles, or one-time configuration changes within a strategy. For example, you can use Set Value to start with a conservative position size and switch to a larger size after a specific condition is met, or to set an initial threshold that changes once the strategy enters its first trade.
Inputs
| Input | Type | Required | Description |
|---|---|---|---|
| Default Value | Number | Yes | The numeric value output before the rule has been executed. This serves as the initial state of the rule. |
| Update Value | Number | Yes | The numeric value output after the rule has been executed. This replaces the default value once the rule fires. |
Outputs
| Output | Type | Description |
|---|---|---|
| Value | Number | The current output value. Initially equal to Default Value, switches to Update Value after the rule is executed. |
Tips
Set Value works well as a simple on/off switch. For example, set the Default Value to 0 and the Update Value to 1, then use the output in a Compare Switch or condition rule to gate parts of your strategy that should only activate after a specific event has occurred. This is especially handy for strategies that need an initial warm-up period before entering trades.
Was this helpful? Let us know