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

RE: [amibroker] Boolean question



PureBytes Links

Trading Reference Links




<SPAN 
class=219203313-27052003>CS,
I 
think Barsindex IS a number. It returns basically the same number as cum(1) 
the difference being that barsindex is faster and one is zero 
based..
 
Regards, 
Jayson 
<FONT face=Tahoma 
size=2>-----Original Message-----From: CS 
[mailto:res1wgwl@xxxxxxxxxxx]Sent: Tuesday, May 27, 2003 5:27 
AMTo: amibroker@xxxxxxxxxxxxxxxSubject: Re: [amibroker] 
Boolean question
Thanks Graham,
I'm slowly making my way through this. I don't 
have to use an IF. And won't again.
Now it seems that barindex() is 
not a number. As in Close[Barindex()-i]. Sure looks 
like a number to me.
 
-CS
<BLOCKQUOTE 
>
  ----- Original Message ----- 
  <DIV 
  >From: 
  <A href="" 
  title=gkavanagh@xxxxxxxxxxxxx>Graham 
  To: <A 
  href="" 
  title=amibroker@xxxxxxxxxxxxxxx>amibroker@xxxxxxxxxxxxxxx 
  Sent: Monday, May 26, 2003 3:22 PM
  Subject: RE: [amibroker] Boolean 
  question
  
  
  <SPAN 
  >Cs
  <SPAN 
  >I think you need to have something 
  to pass out of the loop for the plot to work, or have the plot within the 
  loop. The code is looking for what you are wanting to do with the variables 
  within the loop.
  <SPAN 
  >Remember that with script, from 
  which the loops originate you have to pass out the resultant arrays or values 
  back to the AFL for further processing. Sorry if my terminology or logic is 
  wrong it is just the way I can understand the process of 
  coding.
  <SPAN 
  >If you place the plot within the 
  loop you will get a series of 20 horizontal lines  for 
  A1
  <SPAN 
  lang=EN-AU 
  >T1=<FONT 
  color=fuchsia face="Courier New"><SPAN lang=EN-AU 
  >20<FONT 
  color=black face="Courier New"><SPAN lang=EN-AU 
  >;
  <SPAN 
  lang=EN-AU 
  >Z1=<FONT 
  color=red face="Courier New"><SPAN lang=EN-AU 
  >BarCount<FONT 
  color=black face="Courier New"><SPAN lang=EN-AU 
  > > T1;
  <SPAN lang=EN-AU 
  >if<FONT 
  color=black face="Courier New"><SPAN lang=EN-AU 
  >(Z1)
  <SPAN lang=EN-AU 
  >for<FONT 
  color=black face="Courier New"><SPAN lang=EN-AU 
  > (i=<FONT 
  color=fuchsia face="Courier New"><SPAN lang=EN-AU 
  >0<FONT 
  color=black face="Courier New"><SPAN lang=EN-AU 
  >;i<T1;i++)
  <SPAN 
  lang=EN-AU 
  >     
  {
  <SPAN 
  lang=EN-AU 
  >     
  A1=i ;
  <SPAN lang=EN-AU 
  >Plot<FONT 
  color=black face="Courier New"><SPAN lang=EN-AU 
  >(A1,<FONT 
  color=darkred face="Courier New"><SPAN lang=EN-AU 
  >"test"<FONT 
  color=black face="Courier New"><SPAN lang=EN-AU 
  >,<FONT 
  color=fuchsia face="Courier New"><SPAN lang=EN-AU 
  >3<FONT 
  color=black face="Courier New"><SPAN lang=EN-AU 
  >,<FONT 
  color=fuchsia face="Courier New"><SPAN lang=EN-AU 
  >1<FONT 
  color=black face="Courier New"><SPAN lang=EN-AU 
  >);
  <SPAN 
  lang=EN-AU 
  > 
  <SPAN 
  lang=EN-AU 
  >     
  }
  <SPAN 
  > 
  
  <FONT color=teal face="Times New Roman" 
  size=3><SPAN 
  >Cheers,<FONT 
  color=teal size=3><SPAN 
  >Graham
  <FONT 
  color=#339966 face="Times New Roman" size=2><SPAN 
  ><A 
  href=""><SPAN 
  >http://groups.msn.com/ASXShareTrading
  <FONT 
  color=#339966 face="Times New Roman" size=2><SPAN 
  ><A 
  href=""><SPAN 
  >http://groups.msn.com/FMSAustralia
  <SPAN 
  >-----Original 
  Message-----From: CS 
  [mailto:res1wgwl@xxxxxxxxxxx] <SPAN 
  >Sent: Tuesday, 27 May 2003 4:29 
  AMTo: 
  amibroker@xxxxxxxxxxxxxxx<SPAN 
  >Subject: Re: [amibroker] Boolean 
  question
  <FONT face="Times New Roman" 
  size=2> 
  
  <SPAN 
  >Graham,
  
  <SPAN 
  >Evidently, I can't see why what 
  was once a Boolean is no longer a Boolean. I am trying to find a conditional 
  variable that IF likes.
  
  <SPAN 
  >The whole point of this exercise 
  is to start a loop within FOR <SPAN 
  >after a certain 
  number of bars have passed from the beginning of the 
  data.
  
  <FONT face="Times New Roman" 
  size=2> 
  
  <FONT face="Times New Roman" 
  size=2> 
  
  <SPAN 
  >This 
  works:
  
  <FONT color=blue 
  face=Tahoma size=2><SPAN 
  >T1=20;<FONT 
  color=blue face=Tahoma><SPAN 
  ><FONT 
  face=Tahoma><SPAN 
  >Z1=True;<FONT 
  face=Tahoma><SPAN 
  >if(Z1)<FONT 
  face=Tahoma>for 
  (i=0;i<T1;i++)<FONT 
  face=Tahoma>     
  {<SPAN 
  >     A1=i 
  ;<SPAN 
  >     
  }
  
  <FONT color=blue 
  face=Tahoma size=2><SPAN 
  >Plot(A1,"test",3,1);
  
  <FONT face="Times New Roman" 
  size=2> 
  
  <SPAN 
  >Problem is, I need Z1 to be false 
  <SPAN 
  >until 20 bars have 
  passed, and Z1 of course, gives no choice in this 
  example.
  
  <DIV align=center class=MsoNormal 
  ><FONT color=blue 
  face=Tahoma size=2><SPAN 
  >
  
  
  
  <FONT color=black face=Tahoma 
  size=2>This 
  doesn't because of the "array error" in <FONT 
  color=red face=Tahoma><SPAN 
  >IF(Z1)<FONT 
  color=black face=Tahoma> , 
  although there is only one possible response per bar, 
  and <SPAN 
  >Z1<FONT 
  color=black face=Tahoma> sure 
  looks Boolean to me since it is either true or false.
  
  <FONT color=red 
  face=Tahoma size=2><SPAN 
  >T1=20;<FONT 
  color=red face=Tahoma><SPAN 
  ><FONT 
  face=Tahoma>Z1=BarIndex() > 
  T1;<SPAN 
  >if(Z1)<FONT 
  face=Tahoma>for 
  (i=0;i<T1;i++)<FONT 
  face=Tahoma>     
  {<SPAN 
  >     A1=i 
  ;<SPAN 
  >     
  }
  
  <FONT color=red 
  face=Tahoma size=2><SPAN 
  >Plot(A1,"test",3,1);
  <DIV align=center class=MsoNormal 
  ><FONT color=red 
  face=Tahoma size=2><SPAN 
  >
  
  
  
  <FONT color=red 
  face=Tahoma size=2><SPAN 
  >Z1 = ( (BarIndex() 
  > T1) == true );<FONT color=black 
  face=Tahoma>  doesn't 
  work, and of course <SPAN 
  >Z1=IIF(BarIndex() > T1,TRUE,FALSE); 
  <SPAN 
  >doesn't 
work.
  
  <FONT color=blue face=Tahoma 
  size=2><SPAN 
  > 
  
  <FONT color=blue face=Tahoma 
  size=2><SPAN 
  > 
  
  <FONT color=black face=Tahoma 
  size=2><SPAN 
  >Possibly, I should 
  write the loop as a function and access the function after the necessary 
  number of bars have passed by:
  
  <FONT color=blue face=Tahoma 
  size=2><SPAN 
  > 
  
  <FONT color=black face=Tahoma 
  size=2>Plot( 
  <SPAN 
  >IIF( Z1, function(loop), NULL 
  )<SPAN 
  >, "test", Color, 
  Line);
  
  <FONT color=blue face=Tahoma 
  size=2><SPAN 
  > 
  
  <FONT color=black face=Tahoma 
  size=2>Any 
  other ideas?
  
  <FONT color=blue face=Tahoma 
  size=2><SPAN 
  > 
  
  <FONT color=black face=Tahoma 
  size=2><SPAN 
  >Thanks,
  
  <FONT color=black face=Tahoma 
  size=2><SPAN 
  >-CS
  
  <FONT color=blue face=Tahoma 
  size=2><SPAN 
  > 
  <BLOCKQUOTE 
  >
    
    <SPAN 
    >----- Original Message ----- 
    
    
    <FONT 
    face=Arial size=2><SPAN 
    >From:<FONT 
    face=Arial> <A 
    href="" 
    title=gkavanagh@xxxxxxxxxxxxx>Graham 
    
    <FONT face=Arial 
    size=2><SPAN 
    >To:<FONT 
    face=Arial> <A 
    href="" 
    title=amibroker@xxxxxxxxxxxxxxx>amibroker@xxxxxxxxxxxxxxx 
    
    
    <FONT face=Arial 
    size=2><SPAN 
    >Sent:<FONT 
    face=Arial> Monday, May 26, 2003 6:15 
    AM
    
    <FONT face=Arial 
    size=2><SPAN 
    >Subject:<FONT 
    face=Arial> RE: [amibroker] Boolean 
    question
    
    <FONT face="Times New Roman" 
    size=2> 
    <SPAN 
    >Z1 will be a 0 or 1 depending if 
    the condition is false or true
    <FONT face="Times New Roman" 
    size=2> 
    
    <P 
    ><FONT 
    color=teal face="Times New Roman" size=3><SPAN 
    >Cheers,Graham
    <FONT 
    color=#339966 face="Times New Roman" size=2><SPAN 
    ><A 
    href=""><SPAN 
    >http://groups.msn.com/ASXShareTrading
    <FONT 
    color=#339966 face="Times New Roman" size=2><SPAN 
    ><A 
    href=""><SPAN 
    >http://groups.msn.com/FMSAustralia
    <SPAN 
    >-----Original 
    Message-----From: CS 
    [mailto:res1wgwl@xxxxxxxxxxx] <SPAN 
    >Sent: Monday, 26 May 2003 7:41 
    PMTo: <A 
    href="">amibroker@xxxxxxxxxxxxxxx<SPAN 
    >Subject: [amibroker] Boolean 
    question
    <FONT face="Times New Roman" 
    size=2> 
    
    <SPAN 
    >In AFL:
    
    <FONT face="Times New Roman" 
    size=2> 
    
    <FONT face=Tahoma 
    size=2><SPAN 
    >T1=20;
    
    <FONT face=Tahoma 
    size=2><SPAN 
    >Z1=BarIndex()>T1;
    
    <SPAN 
    >Does <FONT 
    face=Tahoma>Z1 
    contain a boolean response?
    
    <FONT face="Times New Roman" 
    size=2> 
    
    <SPAN 
    >Anyone know how to convert 
    <SPAN 
    >Z1 to 
    boolean?
    
    <FONT face="Times New Roman" 
    size=2> 
    
    <SPAN 
    >Thanks,
    
    <SPAN 
    >-CS
    <P class=MsoNormal 
    ><FONT 
    face="Times New Roman" size=2><SPAN 
    > 
    <FONT face="Courier New" 
    size=2>Send BUG REPORTS to 
    bugs@xxxxxxxxxxxxx<SPAN 
    >Send 
    SUGGESTIONS to suggest@xxxxxxxxxxxxx<FONT 
    face="Courier New">-----------------------------------------<FONT 
    face="Courier New">Post AmiQuote-related messages ONLY to: 
    amiquote@xxxxxxxxxxxxxxx (Web 
    page: <A 
    href="">http://groups.yahoo.com/group/amiquote/messages/)<FONT 
    face="Courier New">--------------------------------------------<FONT 
    face="Courier New">Check group FAQ at: <A 
    href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
    Your use of Yahoo! Groups is subject to 
    the Yahoo! Terms of 
    Service. 
    <FONT face="Times New Roman" 
    size=2> 
    <FONT face="Times New Roman" 
    size=2><FONT 
    face="Courier New">Send BUG REPORTS to bugs@xxxxxxxxxxxxx<FONT 
    face="Courier New"><FONT 
    face="Courier New">Send SUGGESTIONS to 
    suggest@xxxxxxxxxxxxx<FONT 
    face="Courier New">-----------------------------------------<FONT 
    face="Courier New">Post AmiQuote-related messages ONLY to: 
    amiquote@xxxxxxxxxxxxxxx (Web 
    page: <A 
    href="">http://groups.yahoo.com/group/amiquote/messages/)<FONT 
    face="Courier New">--------------------------------------------<FONT 
    face="Courier New">Check group FAQ at: <A 
    href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
    Your use of Yahoo! Groups is subject to 
    the Yahoo! Terms of 
    Service. 
  <FONT face="Times New Roman" 
  size=2><SPAN 
  ><FONT 
  face="Courier New">Send BUG REPORTS to bugs@xxxxxxxxxxxxx<FONT 
  face="Courier New"><FONT 
  face="Courier New">Send SUGGESTIONS to 
  suggest@xxxxxxxxxxxxx<FONT 
  face="Courier New">-----------------------------------------<FONT 
  face="Courier New">Post AmiQuote-related messages ONLY to: 
  amiquote@xxxxxxxxxxxxxxx (Web 
  page: <A 
  href="">http://groups.yahoo.com/group/amiquote/messages/)<FONT 
  face="Courier New">--------------------------------------------<FONT 
  face="Courier New">Check group FAQ at: <A 
  href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
  Your use of Yahoo! Groups is subject to 
  the 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. 
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












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.