PureBytes Links
Trading Reference Links
|
thanks Tomasz Janeczko
--- In amibroker@xxxxxxxxxxxxxxx, "Tomasz Janeczko" <groups@xxx>
wrote:
>
> This is not a bug. Your code simply does not initialize variable
properly
> and you refer to uninitialized array elements (you are reading
array elements
> that you never written to)
>
> Instead of:
> Jstop[0] = Close[0];
>
> Use
>
> Jstop = 0; // this sets initial value to zero.
> Jstop[0] = Close[0];
>
> Alternatively you can write simply:
>
> Jstop = Close[0];
>
> This guarantees that further upsizing to array will have all
elements
> initialized.
>
> Best regards,
> Tomasz Janeczko
> amibroker.com
> ----- Original Message -----
> From: "indo26_slate" <indo26_slate@xxx>
> To: <amibroker@xxxxxxxxxxxxxxx>
> Sent: Tuesday, May 29, 2007 10:36 AM
> Subject: [amibroker] I am suspicious that I found an AFL AB bug
>
>
> > /* Program: atr_values_test
> > ** Author: Joshua Chellew
> > ** Purpose: To understand the state of arrays. I wrote this
> > program in order to get a better understanding
> > ** of the runtime behaviour and how it
> > works on the state of arrays
> > ** Findings: I suspect I may have found a bug. The value of Jstop
> > [1] is unexpected. I expected Jstop[1] to have
> > ** the value '0'. I used a 3rd party
> > utility called 'DebugView' in order to read the _TRACE calls. I
> > ** ran this AFL program as a weekly
> > system on 1 ticker/company. When I ran a scan, this is what I
found:
> > **
> > [2524] at the start of 'ATR
> > Values test' program
> > [2524] Close[0] = 13.3582,
> > Jstop[0] = 13.3582
> > [2524] Close[1] = 13.2819,
> > Jstop[1] = 2.29594e-038
> > [2524] Close[2] = 13.1778,
> > Jstop[2] = 0
> > [2524] Close[3] = 13.1708,
> > Jstop[3] = 0
> > [2524] Close[4] = 12.8447,
> > Jstop[4] = 0
> >
> > ..........
> >
> >
> > ..........
> >
> >
> > [2524] Close[201] = 8, Jstop
> > [201] = 0
> > [2524] Close[202] = 8.29,
> > Jstop[202] = 0
> > [2524] Close[203] = 8.36,
> > Jstop[203] = 0
> > [2524] Close[204] = 8.43,
> > Jstop[204] = 0
> > [2524] Close[205] = 8.38,
> > Jstop[205] = 0
> > [2524] Close[206] = 8.39,
> > Jstop[206] = 0
> >
> > **
> > ** You will notice Jstop[1] has a
> > value '2.29594e-038' which I find strange and unexpected because
the
> > program
> > ** only assigns Jstop[0]. It does not assign
> > Jstop[1] and therefore I expect it's value to be '0'. I can't
find
> > ** any explanation other than a bug in AFL/AB.
> > */
> >
> >
> > _TRACE("at the start of 'ATR Values test' program");
> >
> > Jstop[0] = Close[0];
> >
> > for(i = 0; i < BarCount - 1; i++)
> > {
> > _TRACE("Close["+ i +"] = " + Close[i] +
> > ", Jstop["+ i +"] = " + Jstop[i]);
> > }
> >
> > Buy = 0;
> > Sell = 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/
|