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

Re: [amibroker] Boolean question



PureBytes Links

Trading Reference Links




Jason,
Not when used as:
 
for (i=0;i < 
BarCount;i++)     {     
A1=C[BarIndex() - i];     
}
I am greeted 
with: Error 6. Array subscript has to be a number
<FONT 
color=#000000> 
I will try 
nested FORs. Maybe.
<FONT 
color=#000000> 
<FONT 
color=#000000>Thanks,
<FONT 
color=#000000>-CS
<BLOCKQUOTE 
>
  ----- Original Message ----- 
  <DIV 
  >From: 
  <A title=jcasavant@xxxxxxxxxxxx 
  href="">Jayson 
  To: <A title=amibroker@xxxxxxxxxxxxxxx 
  href="">amibroker@xxxxxxxxxxxxxxx 
  Sent: Tuesday, May 27, 2003 6:36 AM
  Subject: RE: [amibroker] Boolean 
  question
  
  <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: <A 
  href="">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 title=gkavanagh@xxxxxxxxxxxxx 
    href="">Graham 
    To: <A title=amibroker@xxxxxxxxxxxxxxx 
    href="">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 
    face="Courier New" color=fuchsia><SPAN lang=EN-AU 
    >20<FONT 
    face="Courier New" color=black><SPAN lang=EN-AU 
    >;
    <SPAN 
    lang=EN-AU 
    >Z1=<FONT 
    face="Courier New" color=red><SPAN lang=EN-AU 
    >BarCount<FONT 
    face="Courier New" color=black><SPAN lang=EN-AU 
    > > T1;
    <SPAN 
    lang=EN-AU 
    >if<FONT 
    face="Courier New" color=black><SPAN lang=EN-AU 
    >(Z1)
    <SPAN 
    lang=EN-AU 
    >for<FONT 
    face="Courier New" color=black><SPAN lang=EN-AU 
    > (i=<FONT 
    face="Courier New" color=fuchsia><SPAN lang=EN-AU 
    >0<FONT 
    face="Courier New" color=black><SPAN lang=EN-AU 
    >;i<T1;i++)
    <SPAN 
    lang=EN-AU 
    >     
    {
    <SPAN 
    lang=EN-AU 
    >     
    A1=i ;
    <SPAN 
    lang=EN-AU 
    >Plot<FONT 
    face="Courier New" color=black><SPAN lang=EN-AU 
    >(A1,<FONT 
    face="Courier New" color=darkred><SPAN lang=EN-AU 
    >"test"<FONT 
    face="Courier New" color=black><SPAN lang=EN-AU 
    >,<FONT 
    face="Courier New" color=fuchsia><SPAN lang=EN-AU 
    >3<FONT 
    face="Courier New" color=black><SPAN lang=EN-AU 
    >,<FONT 
    face="Courier New" color=fuchsia><SPAN lang=EN-AU 
    >1<FONT 
    face="Courier New" color=black><SPAN lang=EN-AU 
    >);
    <SPAN 
    lang=EN-AU 
    > 
    <SPAN 
    lang=EN-AU 
    >     
    }
    <SPAN 
    > 
    
    <FONT face="Times New Roman" color=teal 
    size=3><SPAN 
    >Cheers,<FONT 
    color=teal size=3><SPAN 
    >Graham
    <FONT 
    face="Times New Roman" color=#339966 size=2><SPAN 
    ><A 
    href=""><SPAN 
    >http://groups.msn.com/ASXShareTrading
    <FONT 
    face="Times New Roman" color=#339966 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 face=Tahoma 
    color=blue size=2><SPAN 
    >T1=20;<FONT 
    face=Tahoma color=blue><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 face=Tahoma 
    color=blue 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 class=MsoNormal  
    align=center><SPAN 
    >
    
    
    
    <FONT face=Tahoma color=black 
    size=2>This 
    doesn't because of the "array error" in <FONT 
    face=Tahoma color=red><SPAN 
    >IF(Z1)<FONT 
    face=Tahoma color=black> , 
    although there is only one possible response per bar, 
    and <SPAN 
    >Z1<FONT 
    face=Tahoma color=black> 
    sure looks Boolean to me since it is either true or 
    false.
    
    <FONT face=Tahoma 
    color=red size=2><SPAN 
    >T1=20;<FONT 
    face=Tahoma color=red><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 face=Tahoma 
    color=red size=2><SPAN 
    >Plot(A1,"test",3,1);
    <DIV class=MsoNormal  
    align=center><SPAN 
    >
    
    
    
    <FONT face=Tahoma 
    color=red size=2><SPAN 
    >Z1 = ( (BarIndex() 
    > T1) == true );<FONT face=Tahoma 
    color=black>  doesn't 
    work, and of course <FONT face=Tahoma 
    color=red>Z1=IIF(BarIndex() 
    > T1,TRUE,FALSE); <FONT face=Tahoma 
    color=black>doesn't 
    work.
    
    <FONT face=Tahoma color=blue 
    size=2><SPAN 
    > 
    
    <FONT face=Tahoma color=blue 
    size=2><SPAN 
    > 
    
    <FONT face=Tahoma color=black 
    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 face=Tahoma color=blue 
    size=2><SPAN 
    > 
    
    <FONT face=Tahoma color=black 
    size=2><SPAN 
    >Plot( 
    <SPAN 
    >IIF( Z1, function(loop), NULL 
    )<SPAN 
    >, "test", Color, 
    Line);
    
    <FONT face=Tahoma color=blue 
    size=2><SPAN 
    > 
    
    <FONT face=Tahoma color=black 
    size=2>Any 
    other ideas?
    
    <FONT face=Tahoma color=blue 
    size=2><SPAN 
    > 
    
    <FONT face=Tahoma color=black 
    size=2><SPAN 
    >Thanks,
    
    <FONT face=Tahoma color=black 
    size=2><SPAN 
    >-CS
    
    <FONT face=Tahoma color=blue 
    size=2><SPAN 
    > 
    <BLOCKQUOTE 
    >
      
      <SPAN 
      >----- Original Message ----- 
      
      
      <FONT 
      face=Arial size=2><SPAN 
      >From:<FONT 
      face=Arial> <A 
      title=gkavanagh@xxxxxxxxxxxxx 
      href="">Graham 
      
      <FONT face=Arial 
      size=2><SPAN 
      >To:<FONT 
      face=Arial> <A 
      title=amibroker@xxxxxxxxxxxxxxx 
      href="">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 
      face="Times New Roman" color=teal size=3><SPAN 
      >Cheers,Graham
      <P 
      ><FONT 
      face="Times New Roman" color=#339966 size=2><SPAN 
      ><A 
      href=""><SPAN 
      >http://groups.msn.com/ASXShareTrading
      <P 
      ><FONT 
      face="Times New Roman" color=#339966 size=2><SPAN 
      ><A 
      href=""><SPAN 
      >http://groups.msn.com/FMSAustralia
      <FONT face=Tahoma 
      size=2>-----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> 
      
      <FONT face=Tahoma 
      size=2>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;
      
      <FONT face=Tahoma 
      size=2><SPAN 
      >Does <FONT 
      face=Tahoma><SPAN 
      >Z1 contain a 
      boolean response?
      
      <FONT face="Times New Roman" 
      size=2> 
      
      <FONT face=Tahoma 
      size=2>Anyone know 
      how to convert <SPAN 
      >Z1 to 
      boolean?
      
      <FONT face="Times New Roman" 
      size=2> 
      
      <FONT face=Tahoma 
      size=2><SPAN 
      >Thanks,
      
      <FONT face=Tahoma 
      size=2><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. 
  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.