Original (English)

Zorro command line

Zorro can be started directly from an external program, a shortcut, a batch file, the Windows command shell, or a PHP exec call on a Windows server. The command line looks like this:

"C:\Users\YourName\Zorro\Zorro.exe" [filename] [options]

For starting it manually with command line options, use the Windows command prompt, navigate to your Zorro folder (cd command), type in a command line, for instance Zorro -run MyScript, and hit the [Enter] key.

If a script name is given, Zorro will open and start it. This allows to automatically run scripts or display historical data by clicking on the file. filename (without blanks or special characters) must be either an existing script in the StrategyFolder given in Zorro.ini, or a historical data file in .t1, .t6, or .t8 format. If a historical data file is given, the Chart script is started with that file. While the script is running, the COMMAND status flag is set to indicate that it's run from the command line. Several Zorro functions use this way to start other Zorro processes, e.g., for multicore training, retraining, or retesting. External tools, like the genetic optimizer, also use the command line.

You can give a command line option either directly in the Windows command prompt, or with the Windows [Run] function, or by editing the properties of a Zorro shortcut on the Windows desktop. For this, right click the shortcut icon and select Properties (for icons in the task bar you need to hold the [Shift] key). Under the shortcut tab you'll see the Target field containing the exact location of Zorro.exe within quotation marks. Add command line options, such as '-diag', after the last quotation mark, and save the modified shortcut with [Apply].

Besides the file name, the following command line options can be given (Zorro S only):

-run

Run the script in [Test] mode, and exit afterwards.

-train

Run the script in [Train] mode, and exit afterwards.

-trade

Run the script in [Trade] mode.

-edit

Select the script and open it in the editor.

-h

In combination with -run, -train, or -trade: run with minimized Zorro window.

-w offset

Shift the Zorro window by the given number of pixels to the right.

-stay

In combination with -run, -train, or -trade: don't close Zorro afterwards.

-a assetname

Select the given asset from the [Assets] scrollbox.

-c accountname

Selects the account with the given name from a user defined account list.

-d definename

Passes a #define statement with the given definename to the script, and stores the definename also in the Define string (Zorro S only). This way, a script started with the command line can behave or compile differently. Only a single #define can be set through the command line.

-u string

Allows to enter strings or other content that can be parsed from the command line with the report function.

-i number

Passes an integer number to the script (Zorro S only) that can be read through the Command variable. Up to 4 numbers can be transferred to the script, each preceded by "-i". This way, the same script started with the command line can behave in different ways.

-x 

Compiles the selected script to an executable, like the EXE flag, and exit afterwards (Zorro S only).

-diag

Starts Zorro in 'black box' mode, as if the DIAG flag was set. Used for debugging the startup behavior. A message "diagnostics mode" will appear in the message window at startup, and the DIAG flag is automatically set in subsequent scripts. Startup events are recorded to a file "diag.txt" in the Zorro main folder. Black box recording strongly reduces the program speed, so do not use this feature unnecessarily.

-quiet

Don't open a message box when Zorro encounters a fatal error; print the error in the message window instead. Don't wait 3 seconds after a command line run before closing the Zorro window.


The command line can be evaluated with the report function, so arbitrary user-defined command line options can be added. Use the ExitCode variable for returning with a script-defined exit code or error level.
   

Examples

Start a re-training run with the Z3 strategy.

Zorro.exe -train Z3

From outside the Zorro folder, run the script pricedownload.c with the selected asset "USD/CAD" in test mode.

"c:\Users\MyName\Zorro\Zorro.exe" -run pricedownload -a USD/CAD

Start Zorro in diagnostics mode. A file diag.txt is generated in the Zorro folder.

Zorro.exe -diag

A .bat file in the Zorro folder that trains 3 scripts when clicked on.

Zorro -train MyStrategy1
Zorro -train MyStrategy2
Zorro -train MyStrategy3

A .bat file that runs a Zorro script 50 times in 2 nested loops and passes the loop numbers to Command[0] and Command[1].

for /l %%x in (1, 1, 5) do (
for /l %%y in (1, 1, 10) do (
  @echo Loop %%x %%y
  Zorro -run MyScript -i %%x -i %%y
)
)
pause

 

See also:

Testing, Training, Trading, Zorro.ini, ExitCode, report, Command

► latest version online

Übersetzung (Deutsch)

Zorro Befehlszeile

Zorro kann direkt von einem externen Programm, einer Verknüpfung, einer Batch-Datei, der Windows-Befehlszeile oder einem PHP exec Aufruf auf einem Windows-Server gestartet werden. Die Befehlszeile sieht folgendermaßen aus:

"C:\Users\YourName\Zorro\Zorro.exe" [filename] [options]

Um es manuell mit Befehlszeilenoptionen zu starten, benutze die Windows-Befehlsaufforderung, navigiere zu deinem Zorro-Ordner (cd Befehl), tippe eine Befehlszeile ein, zum Beispiel Zorro -run MyScript, und drücke die [Enter] Taste.

Wenn ein Skriptname angegeben wird, öffnet und startet Zorro es. Dies ermöglicht das automatische Ausführen von Skripten oder das Anzeigen historischer Daten durch Klicken auf die Datei. filename (ohne Leerzeichen oder Sonderzeichen) muss entweder ein vorhandenes Skript im StrategyFolder sein, das in Zorro.ini angegeben ist, oder eine historische Datendatei im .t1, .t6 oder .t8 Format. Wenn eine historische Datendatei angegeben wird, wird das Chart Skript mit dieser Datei gestartet. Während das Skript läuft, wird das COMMAND Statusflag gesetzt, um anzuzeigen, dass es von der Befehlszeile aus gestartet wurde. Mehrere Zorro-Funktionen nutzen diesen Weg, um andere Zorro-Prozesse zu starten, z.B. für multicore Training, Retraining oder Retesting. Externe Tools, wie der genetische Optimierer, nutzen ebenfalls die Befehlszeile.

Du kannst eine Befehlszeilenoption entweder direkt in der Windows-Befehlsaufforderung eingeben, oder mit der Windows [Run] Funktion, oder indem du die Eigenschaften einer Zorro-Verknüpfung auf dem Windows-Desktop bearbeitest. Dazu rechtsklicke auf das Verknüpfungssymbol und wähle Eigenschaften (für Symbole in der Taskleiste musst du die [Shift] Taste gedrückt halten). Unter dem Shortcut Tab siehst du das Feld Ziel, das den genauen Speicherort von Zorro.exe in Anführungszeichen enthält. Füge Befehlszeilenoptionen hinzu, wie '-diag', nach dem letzten Anführungszeichen, und speichere die geänderte Verknüpfung mit [Apply].

Neben dem Dateinamen können die folgenden Befehlszeilenoptionen angegeben werden (Zorro S nur):

-run

Führe das Skript im [Test] Modus aus und beende es danach.

-train

Führe das Skript im [Train] Modus aus und beende es danach.

-trade

Führe das Skript im [Trade] Modus aus.

-edit

Wähle das Skript aus und öffne es im Editor.

-h

In Kombination mit -run, -train oder -trade: führe Zorro mit minimiertem Fenster aus.

-w offset

Verschiebe das Zorro-Fenster um die angegebene Anzahl von Pixeln nach rechts.

-stay

In Kombination mit -run, -train oder -trade: schließe Zorro danach nicht.

-a assetname

Wähle das angegebene Asset aus der [Assets] Scrollbox aus.

-c accountname

Wählt das Konto mit dem gegebenen Namen aus einer benutzerdefinierten Kontoliste.

-d definename

Übergibt eine #define Anweisung mit dem gegebenen definename an das Skript und speichert den definename auch im Define String (nur Zorro S). So kann ein Skript, das von der Befehlszeile aus gestartet wird, sich anders verhalten oder kompilieren. Nur ein einzelnes #define kann über die Befehlszeile gesetzt werden.

-u string

Ermöglicht das Eingeben von Strings oder anderem Inhalt, der von der Befehlszeile mit der report Funktion geparst werden kann.

-i number

Übergibt eine ganze Zahl an das Skript (nur Zorro S), die über die Command Variable gelesen werden kann. Bis zu 4 Zahlen können an das Skript übermittelt werden, jede vorangestellt mit "-i". So kann dasselbe Skript, das von der Befehlszeile gestartet wird, sich unterschiedlich verhalten.

-x 

Kompiliert das ausgewählte Skript zu einer ausführbaren Datei, ähnlich dem EXE Flag, und beendet danach (nur Zorro S).

-diag

Startet Zorro im 'Black Box' Modus, als ob das DIAG Flag gesetzt wäre. Wird zur Fehlerbehebung des Startverhaltens verwendet. Eine Meldung "diagnostics mode" erscheint beim Start im Nachrichtenfenster, und das DIAG Flag wird in nachfolgenden Skripten automatisch gesetzt. Startereignisse werden in einer Datei "diag.txt" im Hauptordner von Zorro aufgezeichnet. Die Black Box Aufzeichnung reduziert die Programmgeschwindigkeit stark, verwende diese Funktion daher nicht unnötig.

-quiet

Öffne keine Nachrichtenbox, wenn Zorro auf einen fatalen Fehler stößt; drucke den Fehler stattdessen im Nachrichtenfenster. Warte nach einem Befehlszeilenlauf nicht 3 Sekunden, bevor das Zorro-Fenster geschlossen wird.


Die Befehlszeile kann mit der report Funktion ausgewertet werden, sodass beliebige benutzerdefinierte Befehlszeilenoptionen hinzugefügt werden können. Verwende die ExitCode Variable, um mit einem skriptdefinierten Exit-Code oder Fehlerlevel zurückzukehren.
   

Beispiele

Starte einen Retraining-Lauf mit der Z3 Strategie.

Zorro.exe -train Z3

Von außerhalb des Zorro-Ordners, führe das Skript pricedownload.c mit dem ausgewählten Asset "USD/CAD" im Testmodus aus.

"c:\Users\MyName\Zorro\Zorro.exe" -run pricedownload -a USD/CAD

Starte Zorro im Diagnostikmodus. Eine Datei diag.txt wird im Zorro-Ordner generiert.

Zorro.exe -diag

Eine .bat Datei im Zorro-Ordner, die 3 Skripte trainiert, wenn darauf geklickt wird.

Zorro -train MyStrategy1
Zorro -train MyStrategy2
Zorro -train MyStrategy3

Eine .bat Datei, die ein Zorro-Skript 50 Mal in 2 verschachtelten Schleifen ausführt und die Schleifennummern an Command[0] und Command[1] übergibt.

for /l %%x in (1, 1, 5) do (
for /l %%y in (1, 1, 10) do (
  @echo Loop %%x %%y
  Zorro -run MyScript -i %%x -i %%y
)
)
pause

 

Siehe auch:

Testing, Training, Trading, Zorro.ini, ExitCode, report, Command

► latest version online