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

[amibroker] Re: Directional Oscillator/Bruiser



PureBytes Links

Trading Reference Links

Hello,

To avoid out-of-range errors simply add
n<BarCount condition to your formula as shown in the sample below:

FirstVisibleBar = Status( "FirstVisibleBar" );
Lastvisiblebar = Status("LastVisibleBar");
for( n = Firstvisiblebar; n < Lastvisiblebar AND n < BarCount; n++)
{

}


Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message ----- 
From: "Herman van den Bergen" <psytek@xxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Saturday, September 04, 2004 11:49 AM
Subject: RE: [amibroker] Status("firstvisiblebarindex") vs Status("firstvisiblebar")


Thank you again Tomasz,

you wrote: firstvisiblebar / lastvisiblebar give you bar item number that
can be used to iterate arrays. It is in the range of 0..BarCount-1 (if you
do not have blank bars in the right) or 0..BarCount -1 + NumberOfBlankBars
(if you have them).

Am i correct that the range is from 0..Barcount, not 0..Barcount-1;

Would the code below be the most efficient loop template that would work
under ALL Amibroker conditions and elliminate all out-of-range-errors? If
so, perhaps we should add it to the help file?
Test = Null;
NumberOfBlankBars = 3;
NumBarsRequired = 100;
SetBarsRequired( NumBarsRequired  );
FirstVisibleBar = Max( Status( "FirstVisibleBar" ) - NumBarsRequired, 0 );
Lastvisiblebar = Status("LastVisibleBar") - NumberOfBlankBars;
for( n = Firstvisiblebar; n < Lastvisiblebar; n++)
    {
    Test[ n ] = n;
    }
Plot(Test,"Test",6,styleArea);

Many thanks,

Herman

  -----Original Message-----
  From: Tomasz Janeczko [mailto:amibroker@xxxxxx]
  Sent: Saturday, September 04, 2004 3:41 AM
  To: amibroker@xxxxxxxxxxxxxxx
  Subject: Re: [amibroker] Status("firstvisiblebarindex") vs
Status("firstvisiblebar")


  Hello,

  FIRST category
  firstvisiblebar / lastvisiblebar give you bar item number that can be used
  to iterate arrays. It is in the range of 0..BarCount-1 (if you do not have
blank bars in the right)
  or 0..BarCount -1 + NumberOfBlankBars (if you have them).

  SECOND category
  firstvisiblebarindex / lastvisiblebar index give you bar index which is
ABSOLUTE
  position in the quotation database (like BarIndex()).

  FIRST should be used if you want to reference array elements for example:
  CloseAtFirstVisibleBar = Close[ Status("firstvisiblebar" ) ];

  SECOND should be used if you want to compare to numbers returned by
BarIndex(), for example:
  CloseAtFirstVisibleBar = LastValue( ValueWhen( BarIndex() ==
Status("firstvisiblebarindex"), Close ) );

  Those two things may be different but may be the same depending on how
your formula is written
  and how many previous/future bars are referenced.

  The difference between the two is bi[ 0 ] term, i.e.:

  bi = BarIndex();

  firstvisblebarindex == firstvisiblebar + bi[ 0 ];
  lastvisblebarindex == lastvisiblebar + bi[ 0 ];


  This is already explained in the User's Guide:
  http://www.amibroker.com/f?barindex

  Best regards,
  Tomasz Janeczko
  amibroker.com
  ----- Original Message -----
  From: "Herman van den Bergen" <psytek@xxxxxxxx>
  To: <amibroker@xxxxxxxxxxxxxxx>
  Sent: Saturday, September 04, 2004 1:16 AM
  Subject: RE: [amibroker] Status("firstvisiblebarindex") vs
Status("firstvisiblebar")


  [TJ] The difference is the same as between BarIndex() and BarCount.
  Barindex() and barcount work as expected, but these new functions do not.
  Please try the code below.

  [stepane] click on the chart and the results will be diferent...
  That is what i expected, but nothing changes... did you try? PLEASE try
the
  code below, the barcount and BarIndex() work as expected but the others do
  not. No matter what/where I click the first four numbers do not change,
they
  do change with chart scrolling.

  firstvisiblebar = Status("firstvisiblebar");
  firstvisiblebarindex = Status("firstvisiblebarindex");
  lastvisiblebar = Status("lastvisiblebar");
  Lastvisiblebarindex = Status("Lastvisiblebarindex");
  Title =
  "\nfirstvisiblebarindex= "+NumToStr(firstvisiblebarindex,1.0,False)+
  "\nfirstvisiblebar= "+NumToStr(firstvisiblebar,1.0,False)+
  "\nLastvisiblebar= "+NumToStr(lastvisiblebar,1.0,False)+
  "\nLastvisiblebarindex= "+NumToStr(Lastvisiblebarindex,1.0,False)+
  "\nBarindex= "+NumToStr(BarIndex(),1.0,False)+
  "\nBarcount= "+NumToStr(BarCount,1.0,False);

  What do i do wrong?
  herman
    -----Original Message-----
    From: s.carrasset [mailto:s.carrasset@xxxxxxxxxxx]
    Sent: Friday, September 03, 2004 6:17 PM
    To: amibroker@xxxxxxxxxxxxxxx
    Subject: Re: [amibroker] Status("firstvisiblebarindex") vs
  Status("firstvisiblebar")


    Herman,

    click on the chart and the results will be diferent...


    stephane

    Herman van den Bergen a écrit :

    > Can some body explain the difference between
    > Status("firstvisiblebarindex")
    > and  Status("firstvisiblebar"),  and  Status("Lastvisiblebarindex")
and
    > Status("Lastvisiblebar") ? They seem to return the same
    > values...Please try:
    > firstvisiblebar = Status("firstvisiblebar");
    > firstvisiblebarindex = Status("firstvisiblebarindex");
    > lastvisiblebar = Status("lastvisiblebar");
    > Lastvisiblebarindex = Status("Lastvisiblebarindex");
    > Title =
    > "\nfirstvisiblebarindex= "+NumToStr(firstvisiblebarindex,1.0,False)+
    > "\nfirstvisiblebar= "+NumToStr(firstvisiblebar,1.0,False)+
    > "\nLastvisiblebar= "+NumToStr(lastvisiblebar,1.0,False)+
    > "\nLastvisiblebarindex= "+NumToStr(Lastvisiblebarindex,1.0,False);
    >
    > Tia,
    >
    > herman
    >
    >
    >
    > [Non-text portions of this message have been removed]
    >
    >
    >
    > Check AmiBroker web page at:
    > http://www.amibroker.com/
    >
    > Check group FAQ at:
    > http://groups.yahoo.com/group/amibroker/files/groupfaq.html
    >
    >
    > *Yahoo! Groups Sponsor*
    > ADVERTISEMENT
    > click here
    >
  <http://us.ard.yahoo.com/SIG=12910vlmm/M=298184.5285298.6392945.3001176/D=
gr
  oups/S=1705632198:HM/EXP=1094335700/A=2319498/R=0/SIG=11thfntfp/*http://ww
w.
  netflix.com/Default?mqso=60185352&partid=5285298>
    >
    >
    >
    > *Yahoo! Groups Links*
    >
    >     * To visit your group on the web, go to:
    >       http://groups.yahoo.com/group/amibroker/
    >
    >     * To unsubscribe from this group, send an email to:
    >       amibroker-unsubscribe@xxxxxxxxxxxxxxx
    >
<mailto:amibroker-unsubscribe@xxxxxxxxxxxxxxx?subject=Unsubscribe>
    >
    >     * Your use of Yahoo! Groups is subject to the Yahoo! Terms of
    >       Service <http://docs.yahoo.com/info/terms/>.
    >
    >
    >
    >
    > __________ NOD32 1.860 (20040903) Information __________
    >
    > This message was checked by NOD32 antivirus system.
    > http://www.nod32.com




    Check AmiBroker web page at:
    http://www.amibroker.com/

    Check group FAQ at:
  http://groups.yahoo.com/group/amibroker/files/groupfaq.html


          Yahoo! Groups Sponsor
                ADVERTISEMENT





  --------------------------------------------------------------------------
--
  --
    Yahoo! Groups Links

      a.. To visit your group on the web, go to:
      http://groups.yahoo.com/group/amibroker/

      b.. To unsubscribe from this group, send an email to:
      amibroker-unsubscribe@xxxxxxxxxxxxxxx

      c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms of
Service.



  [Non-text portions of this message have been removed]




  Check AmiBroker web page at:
  http://www.amibroker.com/

  Check group FAQ at:
http://groups.yahoo.com/group/amibroker/files/groupfaq.html
  Yahoo! Groups Links








  Check AmiBroker web page at:
  http://www.amibroker.com/

  Check group FAQ at:
http://groups.yahoo.com/group/amibroker/files/groupfaq.html


        Yahoo! Groups Sponsor
              ADVERTISEMENT





----------------------------------------------------------------------------
--
  Yahoo! Groups Links

    a.. To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

    b.. To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

    c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



[Non-text portions of this message have been removed]




Check AmiBroker web page at:
http://www.amibroker.com/

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Yahoo! Groups Links








------------------------ Yahoo! Groups Sponsor --------------------~--> 
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Check AmiBroker web page at:
http://www.amibroker.com/

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> 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/