Multiple Files...

Created at 01 May 2016, 07:36
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!
MA

martinplatt.com

Joined 01.05.2016

Multiple Files...
01 May 2016, 07:36


Hi,

 

Aside from creating DLLs externally, is there any way of creating multiple files to contain implementations relating to a given concern / class(es)?

 

As it stands you could drop everything into the one file, and then have to cut and paste classes that are to be reused into another bot or indicator.  This seems a shame to present an environment that by default will force you to do things in a non-OO manner.

I'm okay with the idea of DLLs being in there, but that then forces you to move out of the cAlgo environment to do that stuff.  That seems a bit of a shame.

I was excited when I saw the quality of cAlgo, and the fact that we can do some decent programming in there, instead of using C++ in a pretty clunky MT4 (MT5 unfortunately is a little restrictive, as that is awesome).  I'd really love to see this become a full strength environment.  At this point, I'm tempted to create my own integration between whatever platform I need to use, as nothing really works all that well yet.  I really look forward to that changing here.

 

Cheers,

 

Martin.

 


@martinplatt.com
Replies

ClickAlgo
02 May 2016, 20:12

Hi Martin,

Not quite sure about the question, but take a look at partial classes.

I think your question relates to the Microsoft .NET framework with the C# programming language, you may be better off asking them on a forum like stack exchange  or Msdn as the cTrader platform offers an API for automated trading and not how you would design or use the C# programming language with .NET.

I hope you find the answers to your questions by visiting one of the above sites.

Paul. :-)


@ClickAlgo

martinplatt.com
03 May 2016, 01:12

RE:

Paul_Hayes said:

Hi Martin,

Not quite sure about the question, but take a look at partial classes.

I think your question relates to the Microsoft .NET framework with the C# programming language, you may be better off asking them on a forum like stack exchange  or Msdn as the cTrader platform offers an API for automated trading and not how you would design or use the C# programming language with .NET.

I hope you find the answers to your questions by visiting one of the above sites.

Paul. :-)

Hi Paul,

I meant simply being able to have multiple files with different classes in them be possible.  Currently has to all go into one file - they only way to separate things is to use visual studio to create DLLs to use by cAlgo.  Seems like it would be good to be able to segregate classes by file.

I'm currently questioning things that are related to design and best practices, and flow, because I believe these to be more important than getting into technical details at this point.  Once those fundamentals are dealt with then will be good to look at the technical aspects.

 

Cheers,

 

Martin.


@martinplatt.com

ClickAlgo
03 May 2016, 10:04

Hi Martin,

You do not need to use assemblies, you can have a single Visual Studio project and put as many files with classes in there as you wish. The cAlgo IDE only allows a single file as it is for very basic use, but with VS you can have a normal development environment. 

Do this, edit your cAlgo cBot with Visual Studio and just add any additional classes files you require, reference them from your main cBot class and when you compile your algo file it will compile the whole project with all related .cs files

cTDN Website Limitations

you may be referring to the cTDN website which does not support multiple file uploaded of projects, so if you want to upload your VS project with multiple files it will only show your cBot class and not any referenced classes, this could your issue. The classes are there, they are just not shown on the website.


@ClickAlgo

martinplatt.com
03 May 2016, 10:49

RE:

Paul_Hayes said:

Hi Martin,

You do not need to use assemblies, you can have a single Visual Studio project and put as many files with classes in there as you wish. The cAlgo IDE only allows a single file as it is for very basic use, but with VS you can have a normal development environment. 

Do this, edit your cAlgo cBot with Visual Studio and just add any additional classes files you require, reference them from your main cBot class and when you compile your algo file it will compile the whole project with all related .cs files

cTDN Website Limitations

you may be referring to the cTDN website which does not support multiple file uploaded of projects, so if you want to upload your VS project with multiple files it will only show your cBot class and not any referenced classes, this could your issue. The classes are there, they are just not shown on the website.

I still mean multiple files that make up the bot, and something so that you could reference a class stored in a file.  The only way I can see to do this is through a DLL.

But I wanted something like MT4, where there is an include folder, and you can add your own folders and code files to arrange in whatever way you want to.  THAT is what I am suggesting.

Using visual studio isn't relevant, as we're making suggestion on improvement to cAlgo. 

You suggestion of putting everything into one DLL, whilst that might seem a clever idea, when you develop large projects that reference multiple libraries, that becomes inplausible very quickly.  I want to develop libraries like I have in MT4.  That really shouldn't be a difficult thing to implement in cAlgo, but would improve turn around times for new projects.


@martinplatt.com

ClickAlgo
03 May 2016, 12:32

Hi Martin,

I was just trying to be helpful, with cTrader you have the benefit of harnessing the power of .NET with C# as the programming language, as standard you use Visual Studio for the development. Remember you can have separate class files in the project, you do not need external assemblies. I will stop trying to help now.

good luck :-)


@ClickAlgo

martinplatt.com
03 May 2016, 12:42

RE:

Paul_Hayes said:

Hi Martin,

I was just trying to be helpful, with cTrader you have the benefit of harnessing the power of .NET with C# as the programming language, as standard you use Visual Studio for the development. Remember you can have separate class files in the project, you do not need external assemblies. I will stop trying to help now.

good luck :-)

Yeah, I know you can have separate class files in one file, but they're then not reusable - or they are, but only by copying and pasting them.

I'm trying to make suggestions that will make cAlgo better than MT4 and MQL4, and at the moment it isn't, as you can use C++ in mql4, and split code into multiple files without leaving the mql editor.

I know this is early days, but would love to see this go places.

I would like to have conversations with you about stuff you can help with, but as I said in the beginning I have been using .NET since before it was in beta (2002) - this sort of a project is a much smaller project than I would normally be doing, but the same principles apply.  

I think it's awesome that there is the ability to switch between environments, so I'm trying to figure out if I should be spending my time suggesting stuff for cAlgo and the editor in there, or working on addins for visual studio to achieve the same from the Visual Studio end.

No idea if there's anyone else around in the forums, as so far it appears to be only you and I, and I sincerely hope that that is not the case.  If it is, I will stop suggesting things, and go think of a better way to hook into environments for trading.

There's ninjatrader which uses C# as well, wasn't overly impressed with the trading environment there, hoping this will be a better experience.

 

Cheers,

 

Martin.


@martinplatt.com

ClickAlgo
03 May 2016, 13:13

thanks martin for a nice reply, I would stick with VS for your dev with cTrader. The cAlgo IDE and the API is still in its infancy stage, but there is a lot of potential in the future for Add-On's for bespoke trading and charting applications with it. I also apologies as I understand now you were trying to get Spotware to provide a development environment like you have in MT4, but this may be years away.

I hope you stay with cTrader and share ideas in the future. :-)


@ClickAlgo

martinplatt.com
03 May 2016, 14:53

Cheers bud.

I have a bunch of ideas to get around the current problems, and will keep with cTrader, and use it where I can, for sure.

This could be a really cool thing if it were open source too - just sayin' :)

 


@martinplatt.com