Zorro's current status can be checked through status flags that can be either on (active) or off (not active).
The is() function is used for reading the state of a
status flag. The following status flags are available:
The script is running in [Test], [Train], or [Trade] mode.
A demo account is selected through the [Account] scrollbox.
The script is running on a Zorro S version.
See also 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 session or 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 session or simulation with valid price data, parameters,
factors, and system variables. Normally immediately after 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
first initial run.
Last run of the simulation. All trades are closed. Can be used to calculate results, aside from the evaluate or objective functions.
If a live session or simulation is aborted with [Stop] or
quit(0), no EXITRUN is performed.
At least once in the simulation a trade was liquidated because the equity
dropped below the maintenance margin.
The script is currently running in simulation or live trading. Script functions can also be executed outside a simulation run f.i. by clicking on [Result] or on a panel button.
A broker API call or a main, run, tick, or
tock function is currently executed. Check this flag to
determine if an asychronous process, f.i. triggered by a click
function, is allowed to access the broker API or global variables. See also
One of the sliders has been moved. Reset this flag with
set(SLIDERS|OFF); for detecting the next slider movement.
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 parameters in [Train]
The script is currently generating capital allocation factors in [Train] mode.
The script is currently generating rules or machine
learning models in [Train] mode.
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 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).
The same as is(TRADEMODE).
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).
The same as is(INITRUN).
System flags, isf
► latest version online