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

RE: [amibroker] Re: Null constant



PureBytes Links

Trading Reference Links




<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> 
mo[0] 
= Null
mo[1] 
= Null
<FONT face=Arial color=#0000ff 
size=2>...
mo[4] 
= Null
mo[5] 
= number
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. 







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.