DefineDLLFunc: "GlobalVariable.dll", ...  [SOLVED]

Questions about MultiCharts and user contributed studies.
maxmax68
Posts: 163
Joined: 20 Nov 2012
Has thanked: 55 times
Been thanked: 48 times

DefineDLLFunc: "GlobalVariable.dll", ...  [SOLVED]

Postby maxmax68 » 02 Feb 2017

DefineDLLFunc: “dll name”, the parameter dll returns, “the name of the function you refer to (inside the external dll)”, the type of the data you send to the external dll.
Usage example:
DefineDLLFunc: "GlobalVariable.dll", float, "GV_GetFloat", int ;
Hello,
I would like to know what is the correct way to define all different types of GV (set and get mode).

For Integer should be:
DefineDLLFunc: "GlobalVariable.dll", int, "GV_SetInteger", int, int ;
DefineDLLFunc: "GlobalVariable.dll", int, "GV_GetInteger", int ;

for Float,Double, ... ???

In Multicharts is allowed also GVSetInteger or only GV_SetInteger ?
What is the difference ?

Best Regards
Massimo

User avatar
Angelina MultiСharts
Posts: 260
Joined: 28 Dec 2016
Has thanked: 28 times
Been thanked: 66 times

Re: DefineDLLFunc: "GlobalVariable.dll", ...

Postby Angelina MultiСharts » 03 Feb 2017

Hello maxmax68,

Please see the file attached, there are some examples that you might find useful.
Attachments
GV+2-2.ELD
(29.71 KiB) Downloaded 788 times

andrei
Posts: 25
Joined: 24 Jan 2013
Has thanked: 2 times
Been thanked: 1 time

Re: DefineDLLFunc: "GlobalVariable.dll", ...

Postby andrei » 29 Nov 2018

Hello maxmax68,

Please see the file attached, there are some examples that you might find useful.
Why don't you guys include these functions in the default function library the product ships with?

andrei
Posts: 25
Joined: 24 Jan 2013
Has thanked: 2 times
Been thanked: 1 time

Re: DefineDLLFunc: "GlobalVariable.dll", ...

Postby andrei » 29 Nov 2018

Are the functions defined in GV+2-2.ELD supposed to work in a PortfolioTrader ... for passing values across between 2 strategies?

I have a Portfolio Trader w/ 2 strategies:

first exports with GVSetNamedDouble("stloss",stLoss);
second imports with stloss = GVGetNamedDouble("stloss", 0);

but I only get 0 (the errorcode set in GVGetNamedDouble above) - is there anything else I'm missing?

thanks

andrei
Posts: 25
Joined: 24 Jan 2013
Has thanked: 2 times
Been thanked: 1 time

Re: DefineDLLFunc: "GlobalVariable.dll", ...

Postby andrei » 29 Nov 2018

There may be a bug within GlobalVariables.

What I found is one needs to get the return of the below function into a variable for the value to be passed across the other strategy (both part of a portfolio trader).
r = GVSetNamedDouble("stloss",stLoss);

if one is using only GVSetNamedDouble("stloss",stLoss) then it doesn't work.

Did anyone experience such a behavior?
Last edited by andrei on 29 Nov 2018, edited 1 time in total.

andrei
Posts: 25
Joined: 24 Jan 2013
Has thanked: 2 times
Been thanked: 1 time

Re: DefineDLLFunc: "GlobalVariable.dll", ...

Postby andrei » 29 Nov 2018

Are these working in a backtest optimization within a Portfolio Trader?
Or does it need to be single thread?

Asking as - what I get in an optimization - applying best result to param values renders inaccurate backtest results (when using Global Variables).

dvdkite
Posts: 65
Joined: 16 May 2018
Has thanked: 10 times
Been thanked: 1 time

Re: DefineDLLFunc: "GlobalVariable.dll", ...

Postby dvdkite » 31 Jan 2019

Hi.

I also just imported GV+2-2.ELD but I'm still unable to communicate between 2 charts.
I just upgraded to the last version of multichart so I suppose that every required dll are already embedded.

So in one chart I've tried to use

GVSetInteger(1,myValue);

and in another chart I'm trying get myValue to print and plot it for testing:

GVGetInteger(1);

As I understood correctly the 1 should be the location of my global variables where I stored myValue.

So ... why I'm still getting as value 0...... at the beginning -1 and then 0....

Any ideas? Should I install other dll?

thanks

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: DefineDLLFunc: "GlobalVariable.dll", ...

Postby TJ » 31 Jan 2019

Hi.

I also just imported GV+2-2.ELD but I'm still unable to communicate between 2 charts.
I just upgraded to the last version of multichart so I suppose that every required dll are already embedded.
...

What is "the last version of multichart" ?

Please go to your MultiCharts and copy the version number and build number.

dvdkite
Posts: 65
Joined: 16 May 2018
Has thanked: 10 times
Been thanked: 1 time

Re: DefineDLLFunc: "GlobalVariable.dll", ...

Postby dvdkite » 31 Jan 2019

With last I mean the Latest (today is 31st , I installed it yesterday). Version 12.0 Release (Build 17586).

Anyway I left the 2 chart open for 3 hours when I went home for lunch and now I can see that it is working! The code above is sending the value between charts.

Looking at this...I suppose that it is only working in realtime, is that correct?
So the only way to test if it work, is by running it in realtime?

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: DefineDLLFunc: "GlobalVariable.dll", ...

Postby TJ » 31 Jan 2019

With last I mean the Latest (today is 31st , I installed it yesterday). Version 12.0 Release (Build 17586).
...

Looking at this...I suppose that it is only working in realtime, is that correct?
So the only way to test if it work, is by running it in realtime?
It depends on how you program your code.

If you have a coding question, you need to post your codes.


Return to “MultiCharts”