PureBytes Links
Trading Reference Links
|
<FONT face=Arial color=#0000ff
size=2>Further step in this "Null" problem : I have inserted a "NZ()"
function in the code example. And it appears that this function doesn't convert
the first 5 bars of the mo array in 0 values. So, the values initialy present in
those first 5 bars are not Null/Nan/Infinity values. So what are they ? And how
can we test them ?
<FONT face=Arial color=#0000ff
size=2>
<FONT face=Arial color=#0000ff
size=2>Hereafter is the modified code example :
<FONT face=Arial color=#0000ff
size=2>
<FONT
size=1>
mo = MA(C,<FONT
color=#ff00ff>5);
Nz(mo);
test = 0;<FONT
color=#800000>
for<FONT
color=#000000>(i=0<FONT
color=#000000>;i<BarCount;i++)
{
if(mo[i]
== Null) test[i] = 1;
}
AddColumn<FONT
color=#000000>(test,"test"<FONT
color=#000000>);
AddColumn<FONT
color=#000000>(mo,"mo");
Filter = <FONT
color=#ff00ff>1;
<IMG
src="bmp00013.bmp">
<FONT face=Arial color=#0000ff
size=2>
<FONT face=Tahoma
size=2>-----Message d'origine-----De : Silvarius
[mailto:silvarius@xxxxxxx]Envoyé : vendredi 28 novembre 2003
19:32À : amibroker@xxxxxxxxxxxxxxxObjet : RE:
[amibroker] Re: Null constant
<FONT face=Arial color=#0000ff
size=2>stéphane,
<FONT face=Arial color=#0000ff
size=2>
The
problem is not at the end of the loop, but at the beginning, where the 5 first
bars are supposed to hold a "Null" value, and are not reported as such in the
"if" test.
<FONT face=Arial color=#0000ff
size=2>
<FONT face=Arial color=#0000ff
size=2>Normaly, in the code example, the mo array is calculated as
:
<FONT face=Arial color=#0000ff
size=2>
<FONT face=Arial color=#0000ff
size=2>mo[0] = Null
<FONT face=Arial color=#0000ff
size=2>mo[1] = Null
<FONT face=Arial color=#0000ff
size=2>...
<FONT face=Arial color=#0000ff
size=2>mo[4] = Null
<FONT face=Arial color=#0000ff
size=2>mo[5] = number
<FONT face=Arial color=#0000ff
size=2>mo[6] = number
<FONT face=Arial color=#0000ff
size=2>...
<FONT face=Arial color=#0000ff
size=2>mo[BarCount - 1] = number
<FONT face=Arial color=#0000ff
size=2>
So
why does the test "mo[0] == Null" return a "false" result
?
<FONT face=Arial color=#0000ff
size=2>
Your
test (mo[i] > 0) returns a "true" result for any bar holding a number value
and a "false" result for the first five bars holding a Null value. But the
inverse test (mo[i] <=0) returns a false result for every bar. I would like
a test that returns "true" for the first bars holding Null values, and "false"
for all the other bars holding number values.
<FONT face=Arial color=#0000ff
size=2>
We
can of course use the array generated by your test, and buid a new one by
inversing the 0 and the 1, but I would like to understand why I can't test
directly a Null value in a for loop.
<FONT face=Arial color=#0000ff
size=2>
<FONT face=Arial color=#0000ff
size=2>Friendly yours, Jérôme.
<FONT face=Tahoma
size=2>-----Message d'origine-----De : Stephane Carrasset
[mailto:nenapacwanfr@xxxxxxxxx]Envoyé : vendredi 28 novembre
2003 17:34À :
amibroker@xxxxxxxxxxxxxxxObjet : [amibroker] Re: Null
constantjerome,à la fin de l'execution de
la boucle ( barcount-1)mo[i] ne sera jamais null sauf si une valeur a 4
jours de dataaussi test[i] ne donne jamais 1 mais zero.fais une
explore avecfor(i=0;i<BarCount;i++){if(mo[i] >0 )
test[i] = 1;}stephane> Hello,>
> Until yet, I have not succeeded in using the "Null" constant in for
loops.> In the simple following code, I would have expected the
first 5 bars of the> "test" array to hold a "1" value. This is
not the case, so the expression> (mo[i] == Null) does not return
a true result even when the MA(C,5) doesn't> return any value. Is
this by design or do I use this constant in a wrong way>
?> > Thank you in advance for any piece of help.>
> Best regards, Jérôme ULRICH> > >
-------------------------> mo = MA(C,5);> > test =
0;> > for(i=0;i<BarCount;i++)> > {>
> if(mo[i] == Null) test[i] = 1;> > }> >
AddColumn(test,"test");> > AddColumn(mo,"mo");>
> Filter = 1;> >
--------------------------Send BUG REPORTS to
bugs@xxxxxxxxxxxxxSend SUGGESTIONS to
suggest@xxxxxxxxxxxxx-----------------------------------------Post
AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page:
<A
href="">http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check
group FAQ at: <A
href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Your use of Yahoo! Groups is subject to the <A
href="">Yahoo! Terms of Service.
Send
BUG REPORTS to bugs@xxxxxxxxxxxxxSend SUGGESTIONS to
suggest@xxxxxxxxxxxxx-----------------------------------------Post
AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page: <A
href="">http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check
group FAQ at: <A
href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Your use of Yahoo! Groups is subject to the <A
href="">Yahoo! Terms of Service.
Yahoo! Groups Sponsor
ADVERTISEMENT
Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
Attachment:
Description: ""
|