Named Int GV value of negative 1218568896

Questions about MultiCharts and user contributed studies.
bowlesj3
Posts: 2180
Joined: 21 Jul 2007
Has thanked: 227 times
Been thanked: 429 times

Named Int GV value of negative 1218568896

Postby bowlesj3 » 03 Jul 2020

Hi,

When a named integer GV is not initialized in MS-Access it picks it up as value -1218568896. So to test it for not being initialized in a Multicharts 64 bit I use the GetNamedInteger GV command and I put it in a variable and test it for <= 0 (zero). The script was failing so I put a fileappend statement in to debug it. It shows the variable is being set to value 1.

So I decided to change it to a named double. The uninitialized named double gets loaded into the variable as 0 (zero) so my script logic works.

So is what is happening when I use a named integer normal? If it is I am wondering why?

Thanks,
John

User avatar
Vlada MultiCharts
Posts: 293
Joined: 22 Apr 2020
Has thanked: 8 times
Been thanked: 76 times

Re: Named Int GV value of negative 1218568896

Postby Vlada MultiCharts » 21 Aug 2020

Using Global Variables depends on the DLL and the DLL version used.
We recommend you to initialize variables prior to usage, this will minimize the possibility of receiving unexpected results.

The following script will print -2.00.

Code: Select all

once cleardebug; DefineDLLFunc: "GlobalVariable.dll", Int, "GV_SetNamedInt", lpstr, Int; DefineDLLFunc: "GlobalVariable.dll", Int, "GV_GetNamedInt", lpstr, Int; //once GV_SetNamedInt("GV Time", 3.14);// init once print(GV_GetNamedInt("GV Time", -2.79));
If you uncomment the string below,the code will print 3.00.

Code: Select all

//once GV_SetNamedInt("GV Time", 3.14);// init
We suggest you use DLL from MultiCharts package, you can check it here.


Return to “MultiCharts”