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

[amibroker] Re: How to check on a variable that does not exist?



PureBytes Links

Trading Reference Links

TJ -

IsNull() throws an error if it is passed a string.  With that string
kludge I added, the routine could be generic and I think it will
handle all data types.

-- Bruce

P.S. Looking forward to seeing you in Vegas.  My friend Don who we had
all of those discussions with is coming also.

--- In amibroker@xxxxxxxxxxxxxxx, "Tomasz Janeczko" <groups@xxx> wrote:
>
> Hello,
> 
> Converting to string is not necessary. Instead use IsNull function
> 
> function NotDefined( VarName )
> {
>   return IsNull( VarGet( VarName ) );
> }
> 
> 
> 
> Best regards,
> Tomasz Janeczko
> amibroker.com
> ----- Original Message ----- 
> From: "bruce1r" <brucer@xxx>
> To: <amibroker@xxxxxxxxxxxxxxx>
> Sent: Saturday, February 09, 2008 8:24 PM
> Subject: [amibroker] Re: How to check on a variable that does not exist?
> 
> 
> > Herman, Progster -
> > 
> > Common problem when you want a general purpose routine that is
> > included and needs to test for existence of needed variables or set
> > defaults.  If you think variant instead of variable, there is a common
> > solution that may give you what you want -
> > 
> > function NDef( Varname )
> > {
> > str =  "" + VarGet( Varname );
> > res = IIf( str != "{EMPTY}", True, False );
> > 
> > return res;
> > }
> > 
> > // W is undefined
> > X = C;
> > Y = 1;
> > Z = "ABC";
> > 
> > _TRACE( "NDef( \"W\" ) = " + NDef( "W" ) );
> > _TRACE( "NDef( \"X\" ) = " + NDef( "X" ) );
> > _TRACE( "NDef( \"Y\" ) = " + NDef( "Y" ) );
> > _TRACE( "NDef( \"Z\" ) = " + NDef( "Z" ) );
> > 
> > Buy = Sell = Short = Cover = 0;
> > 
> > 
> > 
> > 
> > 
> > Please note that this group is for discussion between users only.
> > 
> > To get support from AmiBroker please send an e-mail directly to 
> > SUPPORT {at} amibroker.com
> > 
> > For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
> > http://www.amibroker.com/devlog/
> > 
> > For other support material please check also:
> > http://www.amibroker.com/support.html
> > 
> > Yahoo! Groups Links
> > 
> > 
> >
>




Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com

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

For other support material please check also:
http://www.amibroker.com/support.html
 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/