Trading Blox will support script file automation. Each script file can be created to run Trading Blox for a different reason. This topic provides details for creating and execute a Windows "Batch-File" and Windows "VB-Script" files to accomplish tasks. For example, each task can execute a Suite to generate a new position and order report.
Batch-Script Files, and VB-Script Files are fairly simple, user created files that can wake up Trading Blox so it performs the task defined in the script file. Script file commands are keywords that will be recognized by Trading Blox to sequence how the script file operates. The Script-File-Commands details are defined below.
This is made possible by the use of Batch-Job Files that contain script commands that Trading Blox can support the options listed in command table. It also required that the suite name used in the Batch-Job File's script be a name created earlier that will perform what the user intended.
Automation in this context means, any suite in Trading Blox that will produce a test result, or will generate new orders report, can be made to run from double-clicking on a Batch-Job File name. Batch-Job Files can also be added to the Windows Task Scheduler that run on a specific day and time.
A Batch-Job File is simple text file that contains one or more commands listed to perform a wanted task.
In your Trading Blox installation folder there are three ".bat" files, and four ".vbs" files. Both groups are "Batch Job Files" that will execute and perform a job. Each type of Batch Job file has its own group of command language that are specific to the type of file you want to create.
The DOS commands are used in ".bat" files. There is a lot of information about how to use these command on the internet. To locate them use the search term "Dos script commands" in a search engine. A tutorial that covers how to perform task using these commands is available here: "Batch Script - Commands."
A ".vbs" file, VBScript file, is also a text Batch-Job File that is modeled on the Microsoft Visual Basic language. VBScript files have more language commands items and can perform more complex tasks. See the "VBScript Tutorial."
In the Trading Blox Roundtable Customer Support Forum, there is a discussion named: "Batch-Job" that instructs and reports current task command updates.
The language items in a Batch File create a script that can perform a Trading Blox actions. To enable Windows to recognize the saved text file is a "Batch Executing File", the name of the file must have ".bat" suffix. For example, "AnyBatchScript.bat" will run the language items as a Windows Batch File script. When naming a new batch-job file, consider using a name that helps to reflect the task process the Batch-Job file will perform. For example, "UpdateOrders.bat", will create a new position and orders report.
These Batch Job Files are installed when Trading Blox is installed:
Description: |
|
---|---|
Windows Batch Files are a series of commands that execute each command in the order in which its command are listed.
This batch file name "Backup.bat" will create a backup of all the files that are contained within Trading Blox installation folder.
A this batch job name can be executed with by double-clicking with your mouse, the Batch-Job file name.
"CurrentBackup.zip." When this batch file is run, it will look to see if there is a "CurrentBackup.zip" already in the Backups folder. If that file is found, the previous "" will be renamed to a folder named: "Backup Backup 2019-04-26-09-13-54.zip." Date shown in the renamed backup zip file name is the date and time that the new "CurrentBackup.zip" was created. |
|
This batch file updates a beta version of Trading Blox. |
|
This batch file create a Service Report File of Trading Blox. Service Reports are used for resolving problems that other methods tried have been unsuccessful. |
Description: |
|
---|---|
This batch file restarts. Trading Blox after the updated files have been installed. |
|
BetaUpdater.vbs |
Only use this Batch-Job file, if you need to update the Beta Version you have running in Trading Blox. |
This batch file resets all the registry settings to their default values when executed. Use this when you find there is something unusual happening with how Trading Blox is performing. ![]() Main Screen License Group - Refresh Settings When this option is used, your license information is required so the software can update its license information. |
|
![]() Check For New Version Use this Help - Version Group option to download the latest release version. When the updated files are downloaded, the UpDater.vbs batch job will executed and unpack and replace the updated Trading Blox files. |
To create a Batch-Job File that will run a test, or generate a new orders report, the command Flag options that are supported in Trading Blox are the Flags that need to be in the script that generates a test, or a new orders report.
In the following table are the current supported command Flag options support by Trading Blox. Some of the Flags are used in the examples are below this table.
To generate an automated test or new orders report, the process can be started by double-clicking on the Batch-Job File name. In our examples, the place we use to save a Batch-Job File is the folder location where Trading Blox is installed. User's with experience with Batch-Job automation learn that with more Batch-Job file language items added to a Batch-Job file, they can store their file anywhere because the added language items will know the Trading Blox file location.
You can use windows scheduler for this as well, if you create a .bat file.
Supported Flag Options: |
Description: |
---|---|
-bd |
This command specifies Broker Direct. ie. tradingblox.exe -suite "IB Suite" -bd |
-delay |
Test delays are in seconds. |
-exit |
This flag tells Trading Blox to exit when the test or orders are finished running.
Runs silent mode: no breakpoints and no data loading error messages |
-hidden |
When this flag added Trading Blox will run in a hidden window. |
-min |
This flag is used, Trading Blox will start in a minimized window. |
-noProgress |
Hides the progress dialog during a test or an order report execution. |
-normal |
Use this option after a -hidden was used so the normal display more will be visible. |
-orders |
Generates a new order report (F7) for each suite-name in the list of suites named in the batch job file. |
–suite |
Suites to use with batch job can be any suite name that is shown in the Suite list of Trading Blox (i.e. "suitename1", "suite name 2"). Suite names must be have quotation marks around the suite name. When more than one suite is to run, each suite-name must be separated by a Coma [ , ] |
-test |
Runs a standard (F5) test for each suite-name in the list of suites |
-wf
|
This flag will execute a Trading Blox Walk Forward Test in Trading Blox in versions 5.3 and that were released on or later than January 29, 2019.
The Walk Forward menu item only does one thing. It runs a Walk Forward Test. In a script, the Trading Blox Batch-Job flag -wf is used to use Global Walk Forward menu items.
Walk-Forward Testing requires the Walk-Forward System be elected in the suite. This enables the Reporting Calculations so the testing statistics can appear in the test report. The Walk-Forward System is not a standard blox and it doesn't appear in the Global Suite Parameters list of options because the blox in the system doesn't contain any parameters even though it is a Global Suite System blox.
Walk-Forward Testing doesn't normally generate orders because the default test disables orders. Generating Orders in this type of test is a special condition that needs the user to change the default test so it can generate orders. This the system selected for the Walk-Forward Testing needs the user to enter into the Before Test script of the selected system the order generation function test.SetGeneratingOrders( TRUE ) before running the Walk-Forward Test. |
Single Batch Job File Example: |
---|
To run a test, or to generate orders, each of the following Windows Batch Job files show what to include to automate a test, or to generate a new orders report.
NOTE: In the examples offered here, the Windows Batch Job files are placed in the folder where Trading Blox is installed. As you gain experience in working with an automated execution process, the automation process can add additional language elements needed to automate changing the Batch Job file's location. For this example, and so the process will be as simple as possible, the file will be saved in the Trading Blox installation folder.
Basic Batch Job Tutorials: Our first example will create a Windows Job Batch to run a Trading Blox Suite named "TestSuiteTest" when the file name is double clicked. To keep this example as simple as possible, the file will be placed in the same folder location where Trading Blox is installed.
•To create this file, open the Windows Notepad.exe program. •Then click the File -> Save As option and use the file-browser dialog to find the folder when Trading Blox is installed. •When installed folder appears, type the file named: TestSuiteTest.bat into the dialog's file-name area. •Once the file is saved, enter the following text into the text area, save the file and close Notepad (Suite Test Example). tradingblox.exe -suite "TestSuiteTest" -test -exit
•To run your new "TestSuiteTest.bat" file, click on the main menu's File Tab and then Click on the Main button in the Open Folder group. •the new file you created will appear near the bottom of the folder's list of file when the folder is set to display items in ascending alphabetical order.
When the automation is intended to generate new orders, use this version of the Batch-Job file: tradingblox.exe -suite "TestSuiteTest" -orders -exit
|
Multiple Batch Job File Example: |
---|
To run multiple .bat files in a row, or at the same time, use a Windows Script Host file. Create a file in notepad with a ".vbs" extension. The following sets the current directory, and runs several bat files one after another.
The first parameter of the WSHShell.Run function is the first Batch-Job file name that will execute. The second , Batch-Job name will execute when the first file ends it execution. The last Batch-Job file name in this example will execute after the second file terminates it execution.
Multiple Batch-Job executions can run a sequence of programmed tasks, and each will wait for the prior Batch-Job to stop running so the next file is able to perform their tasks.
This above example runs its tasks hidden, and the ".bat" file also uses the "-hidden" and the "-noProgress" flags in their scripts. This approach enables them to run behind the scenes while the computer is used for other tasks.
If a ".bat" file references a different Trading Blox installation folders, then the wait on return parameter could be false, which would launch all these processes at the same time. A multiple simultaneous license of Trading Blox would be required to run multiple instances at the same time. |
Multiple Batch Job File Example: |
---|
This is a PowerShell script that updates CSI data daily downloaded data. It also will run a suite to build dividends, and generates orders:
Start-Process -wait "C:\UA\EzDownloader.exe" -WorkingDirectory "C:\UA\"
$pathToExe = "C:\DataUpdater\TBDataUpdater\TradingBlox.exe" $arguments = "-suite BuildDividends -test -exit"
Start-Process -wait -FilePath $pathToExe -ArgumentList $arguments -WorkingDirectory "C:\DataUpdater\TBDataUpdater\"
$arguments = "-suite FancySystem -orders -exit" Start-Process -wait -FilePath $pathToExe -ArgumentList $arguments -WorkingDirectory "C:\DataUpdater\TBDataUpdater\"
This script example can easily be modified to update the TB dividends, and Generate orders.
|
Website Script Information Resources: |
---|
Batch Script - Commands (Tutorial)
https://msdn.microsoft.com/en-us/library/d5fk67ky(v=vs.85).aspx
Windows VBScript commands (Tutorial)
|
Links: |
---|
Windows VBScript commands, Reference on Windows Script Host, Windows VBScript commands, WshScriptExec Object |
See Also: |
---|
Edit Time: 8/23/2021 7:43:47 AM |
Topic ID#: 110 |