Writing scripts on the API
Introduction
In order to write a script on the TSLab API, you must create a class inherited from the IExternalScript interface.
This interface has the following implementation:
As you can see, the interface has only one Execute method, which takes two parameters.
IContext - contains the general script context; it is needed for drawing graphs and caching.
ISecurity - allows you to work with the tool, contains candles, ticks, you can work with positions.
The Execute method is called each time TSLab starts a script recount.
You can also use other interfaces, they differ only in the number of tools in the parameters:
IExternalScript2 - two tools at the input (ISecurity)
IExternalScript3 - three tools at the input (ISecurity)
IExternalScript4 - four tools at the input (ISecurity)
IExternalScriptMultiSec - input array of tools (ISecurity)
Scripts template
To write scripts, you can use the following template:
Main properties and methods
Last updated