Checking Status Flags
Zorro's current status can be checked through status flags that can be either on (active) or off (not active). The following function is used for checking a flag:
is (int Flag): int
Returns nonzero resp. true when the given status flag (or any flag of the given flag combination) is set, otherwise zero resp. false.
Flags can be combined with the '+' or '|' operator. For instance, is(TRAINMODE | TESTMODE) returns nonzero when either the TRAINMODE or the TESTMODE is active.
The following status flags are available for the is function:
The script is running in [Test], [Train], resp. [Trade] mode.
A demo account is selected through the [Account] scrollbox.
The script is running on a Zorro S version.
The [Script] or [Asset] scrollboxes have been changed since the last script run, or the [Edit] button has been clicked. The sliders are then set back to their default positions. Use this flag when you want to initialize something only at the first run of the script.
The [Ok] button of a nonmodal message box has been clicked.
Initial run of the simulation before the price data is loaded and before the log file is opened. Can be used to initialize global and static variables. System variables that are not yet known - f.i. variables that depend on the asset and simulation period - are at 0 during the initial run.
First run of the simulation with valid price data and system variables. Normally follows the INITRUN.
First initial run of the script, in the case of multiple simulation runs due to training cycles or NumTotalCycles. While INITRUN and FIRSTRUN is set at the start of any simulation run, FIRSTINITRUN is only set at the really first run.
Last run of the simulation. All trades are closed. Can be used to calculate results, aside from the evaluate or objective functions.
The script is currently running in the simulation. Script functions can also be executed outside a simulation run f.i. by clicking on [Result] or on a panel button.
The script has entered or exited at least one position.
The script is currently in the lookback period, either at the begin of the simulation, or due to a RECALCULATE run.
The current bar is the first bar of the current day.
The script is currently generating capital allocation factors in [Train] mode.
The script is currently generating trade rules in [Train] mode. If neither FACTORS nor RULES is set in [Train] mode, the script is generating parameters.
The Zorro instance was started through the command line.
The script is an executable (*.x).
The script called the loop function.
The script called the asset function.
The current asset is the same as selected in the [Asset] scrollbox.
The script called commands that plot a histogram rather than a price chart.
Some macros for often-used flags have been defined for convenience:
The same as is(TRAINMODE).
The same as is(TESTMODE).
Process for updating parameters or rules, started by clicking [Train] while live trading (Zorro S only).
Process started by clicking [Test] while live trading, f.i. for comparing the live trading results with backtest results of the same period (Zorro S only).
► latest version online