Page 1 of 1

Example of using DLL in Multicharts

Posted: Jan 31 2017
by maxmax68
Hello,
I just started learning VisualBasic to learn how to create Dll with Visual Studio for use with MC.
I'm just a novice and I'll probably be asking something stupid or wrong,
but I would be very grateful if some Dll experienced programmer would provide an example of a very basic open source code of how to draw a button in a chart of Multicharts and how to draw a horizontal trendline at close at pressing of the button.

A simple practical example sometimes helps a lot more than the references to textbooks,
I hope for a good Samaritan.

Thanks in advance
Best regards
Massimo

Re: Example of using DLL in Multicharts

Posted: Jan 31 2017
by TJ

Re: Example of using DLL in Multicharts

Posted: Feb 05 2017
by hughesfleming
Hi Massimo,

I am not sure that visual basic is the right tool for the job. You might as well switch your license to MC.net and use C# or VB.net. You might also consider Code Typhon 64 (Object Pascal) if you must create Dll's for Easylanguage Multicharts. Just import the SDK type library, write your code and then compile your DLL.

Here is an example of an Simple Moving Average that imports PLkit.dll. Code syntax is not that different from EasyLanguage.

Code: Select all

library smadll;

{$mode objfpc}{$H+}

uses
Classes, PLKit_1_0_TLB;


var price,sum: double;
var i: integer;

function SMAdll(pELObj : IEasyLanguageObject; period:integer): double; stdcall;

begin


if period < 1 then exit(0);


sum := 0;
for i := 0 to period-1 do
begin
Price := pELObj.CloseMD[data1].AsDouble[i];
sum := sum + price;
end;
result := sum / period;
end;

exports SMAdll;



begin
end.

Calling your DLL from Easylanguge:

Code: Select all


external: "smadll.dll", double, "SMAdll", IEasyLanguageObject {self},int {length};

CloseData1 = SMAdll(self,length);

Re: Example of using DLL in Multicharts

Posted: Feb 05 2017
by maxmax68
Just import the SDK type library, write your code and then compile your DLL.
Hello hughesflemming,
thank you very much for the example, you were very kind.
I'm just the at first steps with the DLL,and not being a programmer at this moment I confess to being very confused.
The words "import SDK library" and "compile DLLs" are obscure for me at the moment.
I understand to be too far behind with the study so for now I thank you for the time you gave me and quit.

Any DLL guide for Dummies ?

Best regards
Massimo

Re: Example of using DLL in Multicharts

Posted: Feb 05 2017
by hughesfleming
I don't think there is a Dll's made easy guide somewhere because it is not that easy. With that in mind, I do think that you should only consider taking the time to write dlls when you absolutely can't find any other way to solve the problem in EL. It is important to also know your limitations. Even if you do get comfortable in a couple of languages, your best investment will still be to consult a professional programmer. This is especially true with automated trading.

regards,

Alex