Transferring Scripts of Bots/Indicators from the Project and Back.

Transferring Scripts of Bots/Indicators from the Project and Back.

In OsEngine, bot scripts can be stored both within the project and externally, as text files.

If bots (and indicators) are within the project, they can be debugged and modified, with Visual Studio providing assistance.

If bots (and indicators) are as files, they can be quickly transferred from one version of OsEngine to another.

Both approaches have their advantages and are useful in different stages of a bot's lifecycle. In this article, we will discuss how to transfer bots (and indicators) from the project to scripts and back.

 

1. Transferring a Bot from the Project to Scripts.

Task: You have a fully tested and ready bot inside the project. For example, you have a bot named "MyEnvelopeTrend." It is located in the project here:

You need to move it to this folder:

1. Move the bot to the scripts folder. Save it.

2. Delete the bot from within the project.

After this, the bot should appear the same way in the tester and in live trading.

 

2. Transferring a Bot from Script to Project.

Task: You want to modify a standard bot from the scripts. For example, this one:

To do this, you need to transfer this script completely to the OsEngine project in Visual Studio:

1. Create a file named ADDivergence.cs in the project.

2. Transfer the source code from the script to this file!

3. Delete the file from the file system, leaving only the one inside the project.

4. Build the project, and you can perform debugging and make changes in the script on the fly. Hooray!

 

3. Transferring an Indicator from the Project to Scripts.

Task: You have a fully tested and ready indicator within the project. For example, "AC." It is located in the project here:

First, you need to remove the "Indicator" attribute from the indicator in the project. To do this, open the file and delete this line:

After that, move this file from the project to the file system. Like this:

1. Transfer the indicator script to the file system along with all source files.

2. Delete the file in the project.

 

4. Transferring an Indicator from Script to Project.

Task: You want to modify a standard indicator from the scripts. For example, this one:

Transfer the script to the project:

1. Create a file for the indicator in the project and move all the code from the script into it.

2. Delete the indicator file in the folder.

Next, you need to add the attribute to the indicator:

1. Open the indicator file.

2. Add the following construct, which should include the name of the indicator you transferred.

Wishing you successful algorithms!

OsEngine Support