RealTest supports an optional Windows command line mode. To use this mode, simply invoke RealTest from any Windows command shell window or batch script, with arguments specifying your desired action.
Supported command line tasks:
❖realtest -import script.rts
•runs script.rts in Import mode
•saves data to RTD file if import definition includes a SaveAs path
❖realtest -scan script.rts
•runs script.rts in Scan mode
•saves scan output to CSV if ScanSettings include a SaveScanAs path
❖realtest -test script.rts
•runs script.rts in Test mode
•saves results data to RTR if the Settings include a ResultsFile path
•saves results window contents to CSV if test settings include a SaveTestListAs path
•saves stats to CSV if test settings include a SaveStatsAs path
•saves final position list to CSV if test settings include a SavePositionsAs path
•saves trade list to CSV if test settings include a SaveTradesAs path
❖realtest -orders script.rts
•runs script.rts in Orders mode
•generates and saves Order List file(s) as specified in the script
•also saves results and other output as is done for Test mode
Multiple run modes can precede a script name, e.g. realtest -import -test script.rts will run that script first for import and then for backtest.
Multiple scripts can follow a run mode, e.g. realtest -orders orders1.rts orders2.rts orders3.rts will generate orders from three different scripts.
If all scripts ran successfully, the program return code will be 0.
If there were errors, the return code will be one of the following:
Code
|
Meaning
|
1
|
unknown command line task
|
2
|
license error
|
3
|
file open/read/write error
|
4
|
memory error
|
5
|
script error (syntax etc.)
|
6
|
import error
|
7
|
can't load data file
|
8
|
other / unspecified
|
Note that in the event of an error, the usual popup message that would be displayed when not running in command line mode is instead appended to a file called "errorlog.txt" in the folder where RealTest was installed.
When using a standard Windows .CMD batch script, you can check the return code using %errorlevel%, as in the following example:
@echo off
cd c:\RealTest
start /wait RealTest -import -scan my_scan.rts
if errorlevel 1 goto error
start /wait RealTest -import -orders my_orders.rts
if errorlevel 1 goto error
echo Script completed
goto done
:error
echo An error occurred -- see Notepad for details
start notepad c:\RealTest\errorlog.txt
:done
pause
exit
Note also that in batch mode, RealTest runs with its main window minimized, but you can restore it manually if desired, to see what it's doing.
The command -noexit can optionally be added to the command line. If found, RealTest will remain open after processing the other commands.
If errors are encountered in a -noexit run, RealTest will close, return an error code, and log the error to errorlog.txt, as if -noexit had not been specified.
|