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

[amibroker] Re: Difference between 0 and Null for variables?



PureBytes Links

Trading Reference Links

That all makes sense, esp. Tuzo's last explanation.

Thanks for the comprehensive feedback guys.




--- In amibroker@xxxxxxxxxxxxxxx, "tuzo_wilson" <j.tuzo.wilson@xxx> wrote:
>
> --- In amibroker@xxxxxxxxxxxxxxx, "ozzyapeman" <zoopfree@> wrote:
> 
> > What is the difference, if any, between 0 and Null when assigning
> > non-boolean variables? When should we use Null instead of plain old 0?
> 
> Some good posts on this so I won't repeat what has been said.  
> In your example, variables that will be assigned to later (e.g.
> valueAtBuy) are initialized to Null.  Variables that are going to be
> incremented (e.g. longContractCount) are initialized to 0.
> 
> That makes sense from a common sense point of view.  What is the
> valueAtBuy before there is a buy?  Who knows -- there is no value yet.
>  How many long contracts do you have before you enter into any long
> contracts?  This is known -- you have zero contracts.
> 
> 
> Tuzo
> 
> > For example, all of the six variables below are real numbers, yet some
> > are initially set to Null and others to 0.
> > 
> > I copied this snippet from an example AFL that works properly:
> > 
> > 
> > // Set up variables for our entry values, as our stops will test
> > // against the initial entry prices
> > 
> > valueAtBuy = valueAtShort = Null;
> > profitLevel = profitLevel2 = Null;
> > 
> > 
> > // Number of open contracts
> > 
> > longContractCount  = 0;
> > shortContractCount = 0;
> > 
> > for (i = start; i < BarCount; i++)
> > {
> >
>



------------------------------------

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/