Re: [amibroker] How to inizialize a variable only once

 

Hello,

Thank you very much for your e-mail.

You are mixing things up.
The KB article says about STATIC variables ONLY.

You have just NORMAL variable.

You should just place

Lmin = 0;

at the top of your formula. That's it. Nothing more.

Best regards,
Tomasz Janeczko
amibroker.com

On 2016-04-16 11:34, gamacc@aruba.it [amibroker] wrote:
Hello there,
from the Knowlegde Base (Oct., 6 2006) of AB I've got this code:

if (Nz( StaticVarGet("InitializationDone") == 0))
{
   StaticVarSet("InitializationDone", 1);
   // code for first execution
}

I need to initialize my variable "Lmin" only once and I've written this code:

if (Nz( StaticVarGet("InitializationDone") == 0))
{
   StaticVarSet("InitializationDone", 1);
    LMin = 999999;
}

This code doesn't work. My variable "Lmin" remains not initialize and I get a syntax error 29 (Variable used without having been initialized) in the subsequent line of my code (not reported) that use the variable "Lmin".

Any ideas?

Thanks and best regards.





__._,_.___

Posted by: Tomasz Janeczko <groups@amibroker.com>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (2)
**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

TO GET TECHNICAL SUPPORT send an e-mail directly to
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/


.

__,_._,___

Related Posts


EmoticonEmoticon

:)
:(
=(
^_^
:D
=D
=)D
|o|
@@,
;)
:-bd
:-d
:p
:ng
:lv