How does the VS extension work to forward build execution to cTrader ?

Created at 21 Jan 2021, 23:59
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
JE

JerryTrader

Joined 06.01.2021

How does the VS extension work to forward build execution to cTrader ?
21 Jan 2021, 23:59


Hello guys, 

I'm new to cTrader and I'm still figuring out how to have a good workflow before switching to the platform and converting all my indicators / bots.
One of my prerequisites is to be able to use .Net Framework 4.6.2 and C# 6, which is not natively supported yet. 
Unfortunately, it is "in their backlog with no ETA" for few years now, and I feel like that they don't care that much (correct me if I'm wrong).

Thanks to this thread, I managed to be able to use .Net Framework 4.6.2 and C# 6, but the limitation is that we have to build the DLLs first, then build the solution.
I'm looking for a way to be able to simply build the solution, which will first build my DLLs, then call the "Build Solution" that is magically forwarded to cTrader thanks to the VS Extension.

I wanted to try 2 different approaches, but can't understand how to do it because of some mystic behavior:

  1. Solution 1: Add a Pre-Build event on the cBot project, that will build my DLLs. But why does the "Build Events" is not showing ? Every project I create have this tab...
  2. Solution 2: Add a Post-Build event on my DLLs (because this time I have the tab on my project), that will forward the build of the cBot project to cTrader. But there's no way to know what to call in the Post-Build event to do so...

@cTrader team:

  1. Is the .Net Framework upgrade still really in the pipe ?
  2. Since we cannot predict when cTrader will support .Net Framework 4.6+, can you answer to at least one of my questions above ?

 

Thanks in advance for your help, because I really want to use this "Trader first" platform


@JerryTrader
Replies

PanagiotisCharalampous
22 Jan 2021, 14:46

Hi JerryTrader,

We are hoping to migrate cTrader Desktop to .Net Core by summer.

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous

JerryTrader
22 Jan 2021, 15:07

Hi Panagiotis,

Thanks for your answer. I'm a bit worried that you're just "hoping" but I'll deal with it, as long as I find a hack to use 4.6.2 + C# 6.

Can you tell me :

  1. How is cBot/Indicator project created to be detected by cTrader ? Because if I try to create a project myself (to have the Build Events tab) with same name, same assembly name, same namespace, same .Net version, Build / Edit in Visual Studio never shows up in cTrader...
  2. Why does the "Build Events" is not showing on the cBot/Indicator project ?
  3. How can I forward the build to cTrader from VS, using a command line or something

I am open to any solution that could help me workaround this, and patiently wait for the migration to be published.

 

Note: I'm using Visual Studio 2017 Enterprise

 

Many thanks,
Jerry


@JerryTrader

PanagiotisCharalampous
22 Jan 2021, 15:49

Hi JerryTrader,

Unfortunately we cannot commit on an ETA hence the wording. Also we cannot suggest any hacks to the platform, neither support them.

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous

JerryTrader
22 Jan 2021, 16:19

I don't look for real hacks... Just ways to work around the lack of upgrades of the language used...
.Net Framework 4.0 has been released in 2010 ... 11 years ago

I can understand that it can be hard to migrate to 4.6+, and that you can't commit on an ETA.

But please, can you at least explain (without having to support any workaround), how is cBot/Indicator project created to be detected by cTrader, or why does the "Build Events" is not showing on the cBot/Indicator project ?

I'm considering fully switching to cTrader, and migrate 15 years of MQL4 EAs and Indicators, but it makes no sense for me to go from MQL4 old-school language to C# old-school version...


@JerryTrader

PanagiotisCharalampous
23 Jan 2021, 10:29

Hi JerryTrader,

A workaround would be to just change your target framework in your cBot/Indicator project but you should understand that you do this at your own responsibility.

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous

JerryTrader
23 Jan 2021, 12:41

If it was that simple...  I already tried that but cTrader won't be able to compile C#6 language features such as lambda or string interpolation.

There's few topics in this forum mentioning that it is not working, like the one I linked in my original post. 

That is why we are forced to reference another compiled 4.6.2 DLL in the 4.0 cBot/Indicator. But it needs a 2 step compilation process,  which is error prone and time wasting. 

In my original post,  I thought of few differents approaches to workaround this, but the way cTrader projects are created is not common, and the way it is forwarding the build to cTrader is totally opaque. This is the reason why I seek for your help.

Thanks for helping me find a way to use cTrader in a user friendly manner. 


@JerryTrader

PanagiotisCharalampous
25 Jan 2021, 08:31

Hi JerryTrader,

As I explained above you will need to wait for the official cTrader update.

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous

JerryTrader
25 Jan 2021, 21:17 ( Updated at: 25 Jan 2021, 21:21 )

RE:

Ok...

I am a bit disappointed by such a support and lack of consideration for traders' needs, maybe it is not as "Traders first" as I thought it would be.
Anyways... Thanks for the time you took for writing those answers.

I guess I will have to reverse engineer all by myself to answer my own questions, so, if this can help someone there, here are the answers

JerryTrader said:

Hi Panagiotis,

Thanks for your answer. I'm a bit worried that you're just "hoping" but I'll deal with it, as long as I find a hack to use 4.6.2 + C# 6.

Can you tell me :

  1. How is cBot/Indicator project created to be detected by cTrader ? Because if I try to create a project myself (to have the Build Events tab) with same name, same assembly name, same namespace, same .Net version, Build / Edit in Visual Studio never shows up in cTrader...
  2. Why does the "Build Events" is not showing on the cBot/Indicator project ?
  3. How can I forward the build to cTrader from VS, using a command line or something

I am open to any solution that could help me workaround this, and patiently wait for the migration to be published.

 

Note: I'm using Visual Studio 2017 Enterprise

 

Many thanks,
Jerry

 

  1. To be built/edited in Visual Studio, cBot/Indicators projects (csproj) must have the following ProjectTypeGuids : DD87C1B2-3799-4CA2-93B6-5288EE92882
    <ProjectTypeGuids>{DD87C1B2-3799-4CA2-93B6-5288EE928820};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
    Note that you must have the cBot and Custom Indicators VS extension installed and enabled to "Edit in Visual Studio" from cTrader.


  2. You must have the extension installed and enabled to load a cAlgo project inside Visual Studio, otherwise, the project will fail loading.
    The extension is responsible for hiding the "Build Events", but I still ignore why cTrader don't want us to use any build event, preventing us from doing any automated integrations...


  3. It is possible to trigger a build from cTrader by using the command line : cTrader.exe /compile="yourProject.csproj' /debug="true" (the debug flag is optional if you want to build to release)
    To find all the cTrader name, open your Registry Editor, and go to : HKEY_CURRENT_USER\Software\Classes\.algo\OpenWithProgids
    To find all the cTrader.exe paths, go to : HKEY_CURRENT_USER\Software\Classes\{cTrader installation name}\shell\open\command

 

Hope this helps,
Cheers,
Jerry


@JerryTrader