[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

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

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