Creating DLL To Extend MultiCharts Functionality

Questions about MultiCharts and user contributed studies.
User avatar
furytrader
Posts: 353
Joined: 30 Jul 2010
Location: Chicago, IL
Has thanked: 154 times
Been thanked: 215 times

Creating DLL To Extend MultiCharts Functionality

Postby furytrader » 01 Apr 2011

Does anyone here have any experience in creating DLL using Visual Studio .net to extend MultiCharts functionality? For example, how would one go about creating a DLL in the spirit of ELCollections.dll to add functionality to MultiCharts? Are there any good tutorials or examples online of how this might be done? It's a pretty obscure, advanced topic but if anyone has any suggestions, I'd be open to hearing them! Thanks!

User avatar
TJ
Posts: 6585
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 971 times
Been thanked: 1907 times

Re: Creating DLLs To Extend MultiCharts Functionality

Postby TJ » 01 Apr 2011

I remember reading somewhere that FreeBasic has something (scripts, codes, libraries, etc.,) for TS, that works in MultiCharts as well.

I have never tried them tho.

sptrader
Posts: 637
Joined: 09 Apr 2010
Location: Colorado
Has thanked: 400 times
Been thanked: 238 times
Contact:

Re: Creating DLLs To Extend MultiCharts Functionality

Postby sptrader » 01 Apr 2011

I think "power basic" dlls work with MC, I never tried any other.
http://www.powerbasic.com/products/pbdll32/

User avatar
furytrader
Posts: 353
Joined: 30 Jul 2010
Location: Chicago, IL
Has thanked: 154 times
Been thanked: 215 times

Re: Creating DLLs To Extend MultiCharts Functionality

Postby furytrader » 02 Apr 2011

Thank you - both of these suggestions are very helpful. I was able to test a very simple DLL using FreeBasic and it worked as it should. I did the same thing earlier this week in Visual Studio and kept getting errors. I find it ironic that we have to go "back" a few steps in technology in order to make DLLs that MultiCharts and TS can use. This is not a complaint really of Multicharts, but rather that Visual Studio (in its latest iteration) has completely bypassed the use of standard Win32 DLLs.

User avatar
TJ
Posts: 6585
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 971 times
Been thanked: 1907 times

Re: Creating DLLs To Extend MultiCharts Functionality

Postby TJ » 02 Apr 2011

furytrader wrote:Thank you - both of these suggestions are very helpful. I was able to test a very simple DLL using FreeBasic and it worked as it should. I did the same thing earlier this week in Visual Studio and kept getting errors. I find it ironic that we have to go "back" a few steps in technology in order to make DLLs that MultiCharts and TS can use. This is not a complaint really of Multicharts, but rather that Visual Studio (in its latest iteration) has completely bypassed the use of standard Win32 DLLs.

It is good to hear you made something working...
Hope you can share your solution with us when you have a minute.

User avatar
furytrader
Posts: 353
Joined: 30 Jul 2010
Location: Chicago, IL
Has thanked: 154 times
Been thanked: 215 times

Re: Creating DLLs To Extend MultiCharts Functionality

Postby furytrader » 02 Apr 2011

TJ, you bet I will, once I create some DLLs that have good functionality.

In the meantime, I used the following website for information on how to compile a DLL using FreeBasic. I was able to call the mathematical functions from inside of EasyLanguage once I created functions that referenced the DLL. As an example of how to do that, I used the functions that come with ELCollections.dll as a guide.

Here's the web page on making DLLs with Freebasic:

http://www.6thorigin.com/creating-windo ... r-mt4.html

Note that this website has some annoying spam features, so be warned.

User avatar
TJ
Posts: 6585
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 971 times
Been thanked: 1907 times

Re: Creating DLLs To Extend MultiCharts Functionality

Postby TJ » 02 Apr 2011

thanks for the link.


ps. if you search "FreeBasic" in this forum, you will find a few people who have incorporated FreeBasic into their studies.

janus
Posts: 755
Joined: 25 May 2009
Has thanked: 41 times
Been thanked: 84 times

Re: Creating DLLs To Extend MultiCharts Functionality

Postby janus » 05 Apr 2011

Yes, indeed I use FreeBasic extensively for my DLLs, although I am thinking of moving to PowerBasic as I believe it has a much larger audience and better support (and a nice IDE very much like Visual Studio but possibly even better and simpler to use). The main point though is pretty much any modern language can be used to develop DLLs - even COBOL. So, use a language you are most comfortable and experienced with. Then pick a good IDE. Visual Studio is fine for those who use it a lot and know it well enough to overcome some of it's odd ways, but for the casual user like me it's ridiculously complex and cumbersome. I'm happy with an IDE called FBIde, specifically developed for FreeBasic but it has not been updated for years. There are more recent IDEs for FreeBasic but haven't seen the need to change yet. If you are unhappy with Visual Studio then I suggest you look at PowerBasic especially if you are looking for a reasonably good development environment. If you want things as simple as can be then FreeBasic is a good start.

TIP: Since PowerLangauge uses double type for all it's numeric variables, only use double type when passing numerics; never use integer, single or other types on either side for numerics.

User avatar
geizer
Posts: 375
Joined: 16 Jun 2008
Has thanked: 40 times
Been thanked: 38 times

Re: Creating DLLs To Extend MultiCharts Functionality

Postby geizer » 05 Apr 2011

Has anybody considered or have experience with PureBasic ?

I did some research and found that PureBasic is essentially a translator from Basic dialect into x86 and 64x Assembler. The generated assembler code than passed into a Flat Assembler which generates final executables and dlls.

From what I've learned, PureBasic generates fast and slim executables and dlls. There are discussions comparing the performance of PureBasic and PowerBasic on both corresponding forums, which provide some information. I'm Interested to see if anybody else tried PureBasic.

Thanks,

P.S. I should mention that I actually bought a PureBasic lifetime license recently, but that's about all. The PureBasic forum is extremely friendly with code examples and people ready to help. There is a Beginner's Guide if anybody interested.
Last edited by geizer on 06 Apr 2011, edited 2 times in total.

janus
Posts: 755
Joined: 25 May 2009
Has thanked: 41 times
Been thanked: 84 times

Re: Creating DLLs To Extend MultiCharts Functionality

Postby janus » 06 Apr 2011

geizer wrote:Has anybody considered or have experience with PureBasic ?


No. There's also TrueBasic, yet another alternative.

I think the point is use whatever works for you and you are comfortable with. There are probably hundreds of different developing environments one could use, and most are probably OK. Just pick one and go for it.

User avatar
furytrader
Posts: 353
Joined: 30 Jul 2010
Location: Chicago, IL
Has thanked: 154 times
Been thanked: 215 times

Re: Creating DLLs To Extend MultiCharts Functionality

Postby furytrader » 06 Apr 2011

The one thing I would submit, though, is that using Visual Studio is probably not the way to go. Apparently, in Microsoft's eyes, writing Win32 DLLs perpetuates very old COM technology and so their support for doing it is limited. I followed several tutorials on how to make Win32 DLLs using VS and none of them worked for me. In Freebasic, though, I was able to make a functional one in about 5 minutes.

janus
Posts: 755
Joined: 25 May 2009
Has thanked: 41 times
Been thanked: 84 times

Re: Creating DLLs To Extend MultiCharts Functionality

Postby janus » 06 Apr 2011

furytrader wrote:The one thing I would submit, though, is that using Visual Studio is probably not the way to go.

I tend to agree. It's cumbersome to use. I do know some who do use it and find it good but it's generally those who use it everyday as part of their job or hobby and know it very well. I just like to keep it simple as possible and focus on trading. I also had a go to writing a DLL in VS but got nowhere after spending too much time. As you say one can do it FB (and other similar environments) in a matter of minutes.

cyberdad
Posts: 36
Joined: 10 Aug 2009

Re: Creating DLLs To Extend MultiCharts Functionality

Postby cyberdad » 08 Apr 2011

You can use Delphi. In terms of speed it is second only to C++. in terms of IDE, it is as close as it gets to VS (although a little buggy sometimes). Of course, it is a pricey choice if you don't already have a license.

Import Component-> Type Library-> PLkit type library
Create DLL project and add the type library to your project.

You also need a Powerlanguage indicator/signal to play the role of interfacing with the functions that your DLL exports. It is easy for someone with moderate programming experience in Delphi. If you are a complete beginner though, maybe you should stick to another language that provides example projects (no such thing for Delphi, I think).
Anyway, I found this to be the most powerful way of coding. A big plus is also platform independency (not by default but easily applied).

hughesfleming
Posts: 121
Joined: 22 Apr 2014
Has thanked: 33 times
Been thanked: 31 times

Re: Creating DLL To Extend MultiCharts Functionality

Postby hughesfleming » 05 Oct 2015

I am bumping this thread because I am having difficulty importing PLkit.dll into Delphi 10 x64. According to the previous post by Cyberdad, it was possible at some point to import the dll as a type library. This does not seem to be the case anymore unless I am doing something wrong.

I was able to create a simple x64 dll in Delphi 10 and call it using DefineDLLFunc without any problems. It was easy and worked on the first try which is always a good thing.

Does anyone have any ideas how plkit might import into Delphi properly?

Kind regards,

Alex

Edit: Never mind, I have decided to go ahead without PLkit for what I want to do. DefineDLLfunc works well enough.

hughesfleming
Posts: 121
Joined: 22 Apr 2014
Has thanked: 33 times
Been thanked: 31 times

Re: Creating DLL To Extend MultiCharts Functionality

Postby hughesfleming » 06 Oct 2015

Update:

I managed to get PLkit to import as a type library using the command line tools. It cannot be done within the IDE. I put together a simple indicator basically just calling CloseMD[Data1] and it worked.

After a few minutes Multicharts crashed so there is serious problem somewhere. I don't think I will go further with this. I have also tried Purebasic and there are problem there as well will Multicharts crashing on exit. I guess Visual Studio and C++ is the only real option for making x64 dlls if you want to use the SDK.

Alex

tonyng
Posts: 39
Joined: 04 Oct 2013
Has thanked: 2 times
Been thanked: 3 times

Re: Creating DLL To Extend MultiCharts Functionality

Postby tonyng » 06 Oct 2015

Did u do this? or it will crash if your code involve any initialization. i.e. put all your constructor and destructor inside this 2 function entry points.

external: "your.dll", int, "ONCREATE", IEasyLanguageObject ;
external: "your.dll", int, "ONDESTROY", IEasyLanguageObject ;
#events
OnCreate = ONCREATE ;
OnDestroy = ONDESTROY ;
{ Note: self pointer not explicitly passed in these two function
calls }
#end ;
These users thanked the author tonyng for the post:
hughesfleming


Return to “MultiCharts”