CTrader 3 >= .net 4.5 ? True : False;

Created at 03 Sep 2018, 16:34
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!
GA

GammaQuant

Joined 14.06.2017

CTrader 3 >= .net 4.5 ? True : False;
03 Sep 2018, 16:34


Hi is the new cTrader running on .net 4.5 or above?

If not when will this be added?

Kind regards

 


@GammaQuant
Replies

ClickAlgo
04 Sep 2018, 08:36 ( Updated at: 21 Dec 2023, 09:20 )

Hi GammaQuant,

If you want to use a different version of the .NET framework with your cTrader project you simply open the project using Visual Studio and open the project properties and shown below and change the target framework to another version. You will now be able to use all the features of the framework that relates to the framework in your project. You will also need to make sure your machine and any target machines will have this version of the framework installed.

cTrader runs on version 4.0, but your code can run on any version.

 

Paul Hayes
Sales & Marketing
Emailcontact@clickalgo.com
Phone: (44) 203 289 6573
Websitehttps://clickalgo.com

Twitter | Facebook | Google+ | YouTube | Pinterest | LinkedIn

 


@ClickAlgo

nordic
09 Sep 2018, 03:43 ( Updated at: 21 Dec 2023, 09:20 )

RE:

ClickAlgo said:

Hi GammaQuant,

If you want to use a different version of the .NET framework with your cTrader project you simply open the project using Visual Studio and open the project properties and shown below and change the target framework to another version. You will now be able to use all the features of the framework that relates to the framework in your project. You will also need to make sure your machine and any target machines will have this version of the framework installed.

cTrader runs on version 4.0, but your code can run on any version.

 

Paul Hayes
Sales & Marketing
Emailcontact@clickalgo.com
Phone: (44) 203 289 6573
Websitehttps://clickalgo.com

Twitter | Facebook | Google+ | YouTube | Pinterest | LinkedIn

 

Paul, could you please elaborate on this?  I've tried to use elements of .NET 4.7 (specifically System.ValueTuple installed via NuGet to enable me to return multiple values out of a method in better syntax), but cTrader won't compile the code.  I would have thought if the cTrader client is still running on .NET4.0 then it won't have compatibility for syntax and types not available by default in the language?

 


@nordic

ClickAlgo
09 Sep 2018, 12:03

Hi Nordic,

Maybe I should have explained that the cTrader cBot assembly will run under .NET 4.0, but you can have many other separated assemblies running on any version of the framework as long as they are installed on the client machine.

If you are using just a single default cBot project then try changing the framework to 4.7, it is all backward compatible.

Paul.


@ClickAlgo

nordic
09 Sep 2018, 13:46 ( Updated at: 21 Dec 2023, 09:20 )

RE:

ClickAlgo said:

Hi Nordic,

Maybe I should have explained that the cTrader cBot assembly will run under .NET 4.0, but you can have many other separated assemblies running on any version of the framework as long as they are installed on the client machine.

If you are using just a single default cBot project then try changing the framework to 4.7, it is all backward compatible.

Paul.

Thanks Paul. At the risk of sounding daft, I've changed the .NET version of the solution (containing only 1 basic cBot project) to .NET4.7, and VS builds it without issue, but cTrader doesn't.

Attempting to build the code in cTrader throws the below compile errors (example of the basic tuple syntax included):

Am I not understanding something about this process?


@nordic

ClickAlgo
09 Sep 2018, 14:25

When you build via Visual Studio, as long as you have the cBot extension it will create your cBot or indicator for you, there is no need to build from within the cTrader platform.

 


@ClickAlgo

nordic
17 Sep 2018, 03:45

RE:

ClickAlgo said:

When you build via Visual Studio, as long as you have the cBot extension it will create your cBot or indicator for you, there is no need to build from within the cTrader platform.

 

I must be missing something, then.  Using cTrader Public Beta 3.02, the only viable way to get cTrader to run any code in backtest is if it is compiled from within cTrader.  If I hit Edit in Visual Studio (using VS 2017 Community edition with extension installed), it can be edited and built in VS, and the code updates in the cTrader editor, but the changes won't run in backtest until I compile from the cTrader editor.

Does all this boil down to backtesting being incompatible with building from VS?  I wouldn't have thought so, but I'm at a bit of a loss.


@nordic

PanagiotisCharalampous
17 Sep 2018, 17:18

Hi nordic,

I could not reproduce such an issue. cBots should work in backtesting even if compiled in VS.

Best Regards,

Panagiotis


@PanagiotisCharalampous

ClickAlgo
17 Sep 2018, 19:36

Hi Nordic,

Panagiotis is correct, if you compile with VS and the red asterisk on the cBot disappears then it is compiled, make sure you are looking at your errors tab in VS.

I compile using only VS on a regular basis for cBots, indicators and Add-Ons.

Paul.


@ClickAlgo

nordic
18 Sep 2018, 16:01

RE:

ClickAlgo said:

Hi Nordic,

Panagiotis is correct, if you compile with VS and the red asterisk on the cBot disappears then it is compiled, make sure you are looking at your errors tab in VS.

I compile using only VS on a regular basis for cBots, indicators and Add-Ons.

Paul.

Thanks guys, appreciate it (I was ignoring the VS errors tab).  I think I've found the culprit, which seems to be my insistence to use System.ValueTuple as a method return type.  Of course there are workarounds, but I've been trying to get this particular function to work as it simplifies the class library I'm building.

VS will happily build the below code with no errors in a project created from scratch, but not with a cBot launched out of cTrader (target framework set to 4.7.1):

private (double A, double B) TupleMethod()
        {
            return (2.1, 7.6);
        }

When I remove the implicit ValueTuple return type, VS builds the bot and it can be used as normal.  I think this may be a bug?

At any rate, thanks for the help and patience!


@nordic

driftingprogrammer
16 Feb 2020, 13:02

I am not sure of external libraries can be imported to cTrader

nordic said:

ClickAlgo said:

Hi Nordic,

Panagiotis is correct, if you compile with VS and the red asterisk on the cBot disappears then it is compiled, make sure you are looking at your errors tab in VS.

I compile using only VS on a regular basis for cBots, indicators and Add-Ons.

Paul.

Thanks guys, appreciate it (I was ignoring the VS errors tab).  I think I've found the culprit, which seems to be my insistence to use System.ValueTuple as a method return type.  Of course there are workarounds, but I've been trying to get this particular function to work as it simplifies the class library I'm building.

VS will happily build the below code with no errors in a project created from scratch, but not with a cBot launched out of cTrader (target framework set to 4.7.1):

private (double A, double B) TupleMethod()
        {
            return (2.1, 7.6);
        }

When I remove the implicit ValueTuple return type, VS builds the bot and it can be used as normal.  I think this may be a bug?

At any rate, thanks for the help and patience!

 

Hi,

This post would suggest that it is a breeze to just upgrade the project properties to .NetFramework 4.6.1 and download all the latest packages from nuget, compile the code in Visual Studio and expect it to run like a breeze inside cTrader.

My experience has suggested otherwise and it is elaborated on these 2 posts

 

 

I feel like i might be missing something.

 

Thanks,

Vipin.


@driftingprogrammer