Using TSLab API in SharpDevelop. Using external C# script. Creating indicators based on ready-to-use C# indicator code.
Compiling script/indicator project in SharpDevelop. Applying ready scripts and indicators in TSLab.
First of all you should mind the difference between the script and the user’s indicator and between the ways they can be used in TSLab.
- User’s Indicator. It is a .dll file (for example, StochK.dll). The user’s indicators are kept in X:\Program Files\TSLab\Handlers. These indicators can be found in the Editor Toolbar in the category User’s and can be used as regular blocks.
- Script. Script is a *.cs file (for example, Script.cs). Such script can be applied in TSLab via the block External Script. Find this block in the category Service Elements and type in the path to the .cs file.
1. Installing SharpDevelop
1.1. The development environment SharpDevelop can be downloaded for free: http://www.sharpdevelop.com/OpenSource/SD/Download/ .
1.2. Choose the latest version 3.2.
1.3. Download the archive .msi
1.4. Start the installation process. Install the application.
2. TSLab Settings
2.1. Launch the program TSLab.
2.2. Go to File – Program Settings and check the box Script Debugging.
The initial stage is complete. Now you need to create a project in Sharp Develop and set it up.
3. Creating a Project (indicator or script) in SharpDevelop
3.1. Create a new project. Go to File – New – Solution
3.2. In the new window choose Windows Application and give it a name “My First Project”. The new project has been created.
3.3. Choose References in the left column and right-click it. Choose Add Reference from the list.
In the new window choose the tab .Net Assembly Browser and push Browse. Go to the folder where TSLab has been installed and choose 2 files:
After that the files will appear in the tree on the right side of the screen:
3.4. Delete from the tree on the left side of the screen the following items
3.5. Right-click on the name “My First Project” and choose Properties.
Choose Class Library In the tab Application of the property Output Type.
3.6. Save the project
3.7. Create a file in the project where the script or indicator code will be. To do this you should go to File – New – File. In the new window choose “Create file inside project”.
Choose the object Class in the new window and push OK.
Delete the sample code generated automatically.
4. Script project compilation. Integrating the project into TSLab.
4.1. Insert the ready-to-use script code. We can borrow the script given in the User Guide - http://www.tslab.ru/docs/online/newapiscript.htm . Here is the result:
4.2. Click Build and choose Build Solution (F8) in the menu.