Projects made in VS studio C# interact with MC powerlanguage  [SOLVED]

Questions about MultiCharts and user contributed studies.
evdl
Posts: 401
Joined: 19 Jan 2011
Location: Netherlands
Has thanked: 85 times
Been thanked: 124 times

Projects made in VS studio C# interact with MC powerlanguage

Postby evdl » 15 Aug 2016

Is it possible to get MC powerlanguage to interact with own applications that are coded with VS C#.

For example a customized toolbar or display that send info to MC and get info from MC.

Or is this only possible with MC.Net?

User avatar
bensat
Posts: 331
Joined: 04 Oct 2014
Has thanked: 46 times
Been thanked: 104 times

Re: Projects made in VS studio C# interact with MC powerlang

Postby bensat » 15 Aug 2016

I think user 'gboos' wrote his own application to execute trade signals, change limit exits & stops related to his studies in TT (Trading Technologies) in C# without using Multicharts API. AT the time execution from MC in TT wasn't available. So it should be no problem ... May you want to contact him, but I haven't seen him for quite a while.

Regards.

Ben

evdl
Posts: 401
Joined: 19 Jan 2011
Location: Netherlands
Has thanked: 85 times
Been thanked: 124 times

Re: Projects made in VS studio C# interact with MC powerlang

Postby evdl » 16 Aug 2016

Thanks Bensat,

Do you or other users know if the interacting works like we call the global variabels dll in powerlanguage.

Code: Select all

DefineDLLFunc: "GlobalVariable.dll", int, "GV_GetNamedInt", lpstr, int ;
I remember a post on the forum (which I can not find anymore) that it was only possible with C++ and I am not sure it will work with C#.

And a second question (much further beyond simple data from MC) is, if it's possible to get info from MC powerlanguage, where there is no reserved word for. For example, set indicators or signals to off/on. There is no way you can do this by code. Is it possible to do this by an external C# application, tapping in MC and get out the info that you want and control MC like you want.

Jad
Posts: 92
Joined: 15 Jun 2014
Has thanked: 13 times
Been thanked: 21 times

Re: Projects made in VS studio C# interact with MC powerlang  [SOLVED]

Postby Jad » 17 Aug 2016

Do you or other users know if the interacting works like we call the global variabels dll in powerlanguage.

Code: Select all

DefineDLLFunc: "GlobalVariable.dll", int, "GV_GetNamedInt", lpstr, int ;
Depending on what you're trying to achieve, you can either use GlobalVariable.dll or just create your own .dll and use that instead. I chose the latter.
I remember a post on the forum (which I can not find anymore) that it was only possible with C++ and I am not sure it will work with C#.
Yes, it is possible with C#. I've had to create MC callable .dlls in both C++ and C#. However, the C# route will require a wrapper to handle the 'unmanaged-to-managed-to-unmanaged' dialogue.

evdl
Posts: 401
Joined: 19 Jan 2011
Location: Netherlands
Has thanked: 85 times
Been thanked: 124 times

Re: Projects made in VS studio C# interact with MC powerlang

Postby evdl » 18 Aug 2016

Thanks Jad for the confirmation that C# works with normal MC.

After your post I did some googling on the forum, and I found a post about a wrapper I think.

http://www.multicharts.com/discussion/v ... 498#p51649

I will give that a try.

Jad
Posts: 92
Joined: 15 Jun 2014
Has thanked: 13 times
Been thanked: 21 times

Re: Projects made in VS studio C# interact with MC powerlang

Postby Jad » 18 Aug 2016

Thanks Jad for the confirmation that C# works with normal MC.
After your post I did some googling on the forum, and I found a post about a wrapper I think.
http://www.multicharts.com/discussion/v ... 498#p51649
I will give that a try.
Yes, 'Call_dotNET_code_from_PL' is a wrapper template that MC sent me when I first enquired about this. I had already started writing my own so I have no experience with using it - but it should be enough to get you going.

This page also has some useful information on using managed mode C# DLLs from unmanaged applications. It is MT centric but the principles still hold.

https://www.mql5.com/en/articles/249


Return to “MultiCharts”