[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [amibroker] Does the variable exist ?



PureBytes Links

Trading Reference Links



Correct and thanks Tomasz. That's what i did ...
 
// Let's get the new values for the AmiPn's
// from loaded Include and overwrite the
// existing AmiPn's ...
for( pn = 0; pn < 10; pn++ )
{
     AmiPName = "AmiPNew"+NumToStr(pn,1.0);      // Variable name AmiPn new ...
     AmiP  = "AmiP"+NumToStr(pn,1.0);                      // Existing AmiPn in header AFL ...
     // Check if variable exists ...
     if (VarGet(AmiPName)>0)
     {
          VarSet(AmiP,VarGet(AmiPName));                  // Assign value AmiPNew to existing    
     }
     else
     {
          pn = 10;
     }
}
 
Regards, Ton.
 
----- Original Message -----
Sent: Wednesday, October 21, 2009 9:18 PM
Subject: Re: [amibroker] Does the variable exist ?

 

You can use VarGet.
 
if( IsNull( VarGet("something" ) ) )
{
  // does NOT exist
}
 
or you can use typeof
 
if( typeof( Variable ) == "undefined" )
{
  printf( "Variable does NOT exist"
);
}
 

Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message -----
Sent: Wednesday, October 21, 2009 9:03 PM
Subject: Re: [amibroker] Does the variable exist ?

Thanks but that's not what I mean Aron. I want to check in AFL if a variable exitsts or not. So a variable being defined in the program. Let's say you have a loop that creates variables with VarSet going from AmiP0 thru AmiP9. You don't know where the loop ends and therefore do not know which variables you are getting. For that reason you must have a possibility tot check if a variable exists or else you are getting a syntax error. So there must be an instruction in AFL that provides this check. Something like IF ( VarExist(AmiP5)) etc. I just don't get the right instruction ...
 
Regards, Ton.
 
 
----- Original Message -----
From: Aron
Sent: Wednesday, October 21, 2009 7:22 PM
Subject: Re: [amibroker] Does the variable exist ?

 

Formula Editor > Edit> Find

On 10/21/2009 6:57 PM, amsiev wrote:
> How do I check in AFL if a variable exists ? Say I have a variable AmiP8 and want to know in the program if this variable exists. What's the AFL instruction for that ? Should be something like :
> If (VarExist(AmiP8)) etc. But I cannot find it ...
>
> Regards, Ton.
>
>
>
> ------------------------------------
>
> **** 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/
>
> Yahoo! Groups Links
>
>
>
>



__._,_.___


**** 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/





Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___