Pieces of long code to be stored in a script or library

07 Dec 2018, 04:19Pieces of long code to be stored in a script or library#1
Luigi Zollinoposts: 23since: 11 Oct 2016

Dear Panagiotis,

in many of my bots I have the same pieces of long code.

There is a way to store it in a script or library and recall it back in a cBot with a simple line of code instead of hundreds line of code ?

Thank you very much for your always kind help

07 Dec 2018, 10:23#2
Panagiotis Charalampousposts: 1818since: 13 Jan 2017

Hi Luigi,

A cBot is nothing less than a C# project. So if you edit it using Visual Studio you can have all the options available for a C# project. This means that you can have separate classes for reusable code. See below an example of calling a function of another class inside the cBot.

This way you can organize your code in a proper object oriented approach. Let me know if you need any additional assistance.

Best Regards,

Panagiotis


Head of Community Management at cTrader
07 Dec 2018, 18:33RE:#3
Luigi Zollinoposts: 23since: 11 Oct 2016

Panagiotis Charalampous said:

Hi Luigi,

A cBot is nothing less than a C# project. So if you edit it using Visual Studio you can have all the options available for a C# project. This means that you can have separate classes for reusable code. See below an example of calling a function of another class inside the cBot.

This way you can organize your code in a proper object oriented approach. Let me know if you need any additional assistance.

Best Regards,

Panagiotis

Thank youv very much !!!!