Trading Blox Builder Script Object allows any user to create a custom processing method. This ability is similar to how a subroutine or a function is created. Once a Custom-Script is created, it can be executed when the the purpose of the Custom-Script is needed.
Everything needed to create the Custom-Functions and Custom-Properties is built into the abilities of Trading Blox Basic. With these abilities and the understanding of what is needed from a customized process, the custom script can be called when it is available within a system list of blocks and script sections.
In simple terms, a Custom-Process/Function creates a Custom Script section that contains scripts that can perform a process that isn't already built-into Trading Blox Builder.
There is only one Script Object. A custom Script Functions can call other custom script. Because there is only one script object, the calling script will loose its parameter values during the process of the custom function being called. To prevent that from happening, if the parameter values of the calling custom script are needed, they should be assigned to local variables in the calling script before that script calls another custom function Keep in mind that each call to a custom function will overwrite any passed in parameters, and passed back return values that haven't been assigned to a local variable.
All functions and properties require the script-object name as a prefix word connected by a period '.' to a function or property keyword: script. plus the FunctionName or propertyName.
' This Script built-in Function will execute
' the text-named script section shown next:
script.Execute("AnyNameScript")
Similar to: Script.Execute() is the function: Script.InstrumentLoop(). This additional function will run a custom script that will loop each enabled instrument in the portfolio. Click on this InstrumentLoop link for an example of how it can be used.
Functions Name: |
Descriptions: |
---|---|
Execute() |
Use this function to Execute a custom script name that is available to the system. |
This function will return the existence of a custom script. This function can be Executed any block to discover the existence of the named custom script exists is included or not found in the system.
The ability to know a script exists prior to making an script.Execute( "Script-Name") call provides an opportunity to know if a named custom script is available before an error happens.
This next Code-Example provides a process that can be used to know what scripts are in the system and how to effectively access them quicker. ' --------------------------------------- ' script.Exist & script.GetReference Example ' --------------------------------------- ' --------------------------------------- Custom-Script sections now have the ability to GetReference a ID for each custom script name in a system. Read the GetReference function for more information about its purpose and use. |
|
The GetReference function returns an integer reference ID value that makes access to a custom script more efficient. Once a custom script reference is found, the ID-number can then be used to access that script faster and efficiently than will happen when the name of the custom script section is used.
Review the Example Code in the Exists function description.
In the Before Test script, it is possible to get the Custom-Script's ID for each of the Custom-Script section that can be saved in a BPV-Integer variables so they are available to access each Custom-Script during a test. In use, it is faster to use Reference-ID numbers to access a Custom-Script ID number than to use the Custom-Script's "text-name" . |
|
Used to access a value from a passed in series. Access is as defined for the series so that auto indexed series use an offset base, and non auto indexed series are manual direct index access. |
|
This function is similar to Script.Execute function. This function when run in a custom script will access each enabled instrument in the portfolio.
To enable or disable an instrument, use the instrument.DisableTrading function to change the instrument's inPortfolio state from TRUE to FALSE.
Typically this inPortfolio state is executed from SetParameters script section. Instrument data that is disabled will not be loaded into memory when the Before Test script section runs. |
|
Loops over all open orders in the system and calls the custom script. |
|
Used to set the return value to a number or string. |
|
Used to set a list of number return values. |
Properties Name: |
Description: |
---|---|
Count of the number of parameters passed into the custom function. |
|
Used to access a specific parameter, or a number of parameters. |
|
Used to access a custom function's return value number. |
|
Used to access the list of returned number values. |
|
The count of the Series type parameters passed into the custom function |
|
The count of the String type parameters passed into the custom function |
|
Used to access one specific String parameter, or a number of String parameters. |
|
Used to access a custom function's return value string. |
Edit Time: 12/18/2020 11:31:27 AM |
Topic ID#: 516 |