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

Re: [amibroker] Re: Index comparison: Steve Dugas



PureBytes Links

Trading Reference Links

Thanks Bill !
 
Steve
----- Original Message -----
Sent: Sunday, May 28, 2006 9:44 PM
Subject: Re: [amibroker] Re: Index comparison: Steve Dugas

Gilles and Steve:
 
I think the problem occurs when endBar = startBar which generates an error in
 
else
     if (BeginValue(barNumber) )
{  ......
 
There are a number of ways to correct this, depending on what one wants to do, but forcing visible bar with the following change is one way:
 
else
    if(BeginValue(barNumber) != EndValue(barNumber)
{ .....
 
Bill
 
 
----- Original Message -----
Sent: Sunday, May 28, 2006 8:52 AM
Subject: [amibroker] Re: Index comparison: Steve Dugas

I'll try that! I only have an EOD database, from Yahoo quotes, hence
I can't see what could possibly change... Hope the other user will
read this!
Thank you anyway!
Friendly,
Gilles

-- In amibroker@xxxxxxxxxxxxxxx, "Steve Dugas" <sjdugas@xxx> wrote:
>
> Hi Gilles,
>
> Another user reported the same error, he was using RT 1-minute
bars. I don't
> know the answer, I have never had a problem on my EOD database.
The error
> indicates that the code is trying to access elements outside the
bounds of
> the array, but this should not be happening. My first thought is
that maybe
> incoming streaming data causes the array size, bar numbers, or
something
> like that to be constantly changing but I really don't know how
this works
> internally. Maybe TJ could comment if he reads this. The other
user said he
> got it to work after playing with the params a liitle, maybe he
could pass
> on exactly what he did to fix it. You could also try setting
beginning range
> marker and see if that helps - at least that might reveal whether
the
> problem is at the beginning or end of the array..
>
> Steve
>
> ----- Original Message -----
> From: "gillesdeprez" <gillesdeprez@xxx>
> To: <amibroker@xxxxxxxxxxxxxxx>
> Sent: Friday, May 26, 2006 5:50 AM
> Subject: [amibroker] Index comparison: Steve Dugas
>
>
> > Hi Steve!
> > Sorry to bother you once again, but I've got this error message,
and
> > the code is way too tough for me...
> > unnamed1:
> > for(Bar=StartBar,Bar<=EndBar,Bar++//fill bars inside range
> >
> > Zero(Bar)
> > Error 10
> > Subscript out or range.
> > You must not access array elements outside 0..(Barcount-1) range
> > Use edit Formula to correct error
> >
> > Maybe in french I could deal with it, but here...
> > Thanks again, have a nice day!
> > Gilles
> >
> >
> >
> >
> >
> >
> >
> > --- In amibroker@xxxxxxxxxxxxxxx, "Steve Dugas" <sjdugas@> wrote:
> >>
> >> Here it is again - as usual, watch out for line wrap...
> >>
> >> Steve
> >>
> >> =========================================================
> >>
> >> // Filename: Rel Perf Close.afl
> >>
> >> // Task: Plots relative performance of tickers entered into
params
> > dialog.
> >>
> >> // set charting options
> >>
> >> SetBarsRequired( 100000, 100000 );
> >>
> >> SetChartOptions( 0,
> > chartShowDates|chartShowArrows|chartWrapTitle );
> >>
> >> // initialize variables
> >>
> >> _N( Tickers = ParamStr( "Enter Tickers ( comma seperated
> > list )", "!! SET
> >> TICKERS !!" ) );
> >>
> >> UsingRange = ParamToggle( "Display % Change Relative
> > To", "Previous Bar ( no
> >> options to set )|First Bar Of Range ( set options below )", 1 );
> >>
> >> UsingDates = ParamToggle( "Set Range Using", "Visible Bars
> > (default) / Range
> >> Markers (when set)|Dates Below" );
> >>
> >> StartDate = ParamDate( "Range Start Date", Date() );
> >>
> >> EndDate = ParamDate( "Range End Date", Date() );
> >>
> >> PlotZero = ParamToggle( "Display Zero Line?", "No|Yes", 1 );
> >>
> >> Extend = ParamToggle( "Extend Final Values/Zero Line Across All
> > Bars?",
> >> "No|Yes" );
> >>
> >> ColorStart = Param( "Start Color Rotation At #", 34, 0, 55, 1 );
> >>
> >> ColorInc = Param( "Increment Color Rotation By", 1, -55, 55,
1 );
> >>
> >> GraphXSpace = Param( "GraphXSpace", 5, -50, 100, 1 );
> >>
> >> BarNumber = BarIndex();
> >>
> >> DateNumber = DateNum();
> >>
> >> TickerName = "";
> >>
> >> DataBase = GetDatabaseName();
> >>
> >> // calculate start and end of range
> >>
> >> if ( UsingDates ) // use dates from param dialog
> >>
> >> {
> >>
> >> StartBar = LastValue( ValueWhen( StartDate == DateNumber,
> > BarNumber ) );
> >>
> >> EndBar = LastValue( ValueWhen( EndDate == DateNumber,
> > BarNumber ) );
> >>
> >> }
> >>
> >> else if ( BeginValue( BarNumber ) ) // use start and end of
range
> > if start
> >> marker set
> >>
> >> {
> >>
> >> StartBar = BeginValue( BarNumber );
> >>
> >> EndBar = EndValue( BarNumber );
> >>
> >> }
> >>
> >> else // use visible bars
> >>
> >> {
> >>
> >> StartBar = Status( "firstvisiblebar" );
> >>
> >> EndBar = Status( "lastvisiblebar" ) - 1;
> >>
> >> }
> >>
> >> // plot zero line
> >>
> >> if ( PlotZero )
> >>
> >> {
> >>
> >> if ( Extend )
> >>
> >> Zero = 0;
> >>
> >> else
> >>
> >> {
> >>
> >> Zero = Null;
> >>
> >> for ( Bar = StartBar; Bar <= EndBar; Bar++ ) // fill bars inside
> > range
> >>
> >> Zero[Bar] = 0;
> >>
> >> }
> >>
> >> Plot( Zero, "", colorBrown, styleLine|styleNoLabel );
> >>
> >> }
> >>
> >> // assign ticker name and get close
> >>
> >> for ( i = 0; ( Ticker = StrExtract( Tickers, i ) ) != "";
i++ ) //
> > extract
> >> current ticker
> >>
> >> {
> >>
> >> if ( Ticker == "CURRENT" )
> >>
> >> {
> >>
> >> TickerName = Name();
> >>
> >> TickerClose = Close;
> >>
> >> Color = colorWhite;
> >>
> >> }
> >>
> >> else if ( Ticker == "INDUSTRY" )
> >>
> >> {
> >>
> >> Ticker = GetBaseIndex();
> >>
> >> TickerName = IndustryID( 1 ) + " ( " + Ticker + " )";
> >>
> >> TickerClose = Foreign( Ticker, "close" );
> >>
> >> Color = colorBrightGreen;
> >>
> >> }
> >>
> >> else if ( Ticker == "SECTOR" )
> >>
> >> {
> >>
> >> if ( DataBase == "Data-TC2005" )
> >>
> >> {
> >>
> >> Ticker = StrLeft( GetBaseIndex(), 4 ) + "0";
> >>
> >> TickerName = SectorID( 1 ) + " ( " + Ticker + " )";
> >>
> >> TickerClose = Foreign( Ticker, "close" );
> >>
> >> }
> >>
> >> else // database is QP2
> >>
> >> {
> >>
> >> Ticker = GetBaseIndex(); // plot industry, need to create
> > composite sectors
> >>
> >> TickerName = SectorID( 1 ) + " ( " + Ticker + " )";
> >>
> >> TickerClose = Foreign( Ticker, "close" );
> >>
> >> }
> >>
> >> Color = colorGreen;
> >>
> >> }
> >>
> >> else if ( Ticker == "MARKET" )
> >>
> >> {
> >>
> >> Color = colorRed;
> >>
> >> if ( DataBase == "Data-TC2005" )
> >>
> >> {
> >>
> >> if ( MarketID() == 1 )
> >>
> >> {
> >>
> >> Ticker = "nyse";
> >>
> >> TickerName = MarketID(1);
> >>
> >> TickerClose = Foreign( Ticker, "Close" );
> >>
> >> }
> >>
> >> else if ( MarketID() == 2 )
> >>
> >> {
> >>
> >> Ticker = "xax";
> >>
> >> TickerName = MarketID(1);
> >>
> >> TickerClose = Foreign( Ticker, "close" );
> >>
> >> }
> >>
> >> else if ( MarketID() == 3 )
> >>
> >> {
> >>
> >> Ticker = "compqx";
> >>
> >> TickerName = MarketID(1);
> >>
> >> TickerClose = Foreign( Ticker, "close" );
> >>
> >> }
> >>
> >> }
> >>
> >> else // database is QP2
> >>
> >> {
> >>
> >> if ( MarketID() == 1 )
> >>
> >> {
> >>
> >> Ticker = "!nya";
> >>
> >> TickerName = MarketID(1);
> >>
> >> TickerClose = Foreign( Ticker, "Close" );
> >>
> >> }
> >>
> >> else if ( MarketID() == 2 )
> >>
> >> {
> >>
> >> Ticker = "!xax";
> >>
> >> TickerName = MarketID(1);
> >>
> >> TickerClose = Foreign( Ticker, "close" );
> >>
> >> }
> >>
> >> else if ( MarketID() == 3 )
> >>
> >> {
> >>
> >> Ticker = "!comp";
> >>
> >> TickerName = MarketID(1);
> >>
> >> TickerClose = Foreign( Ticker, "close" );
> >>
> >> }
> >>
> >> }
> >>
> >> }
> >>
> >> else
> >>
> >> {
> >>
> >> TickerName = Ticker;
> >>
> >> TickerClose = Foreign( Ticker, "close" );
> >>
> >> Color = ( ( ( ColorStart + ( i * ColorInc ) ) % 56 ) + 56 ) %
56;
> >>
> >> }
> >>
> >> // calculate % change
> >>
> >> TickerChg = Null; // initialize % change array
> >>
> >> if ( UsingRange ) // calculate % change relative to start of
range
> >>
> >> for ( Bar = StartBar; Bar <= EndBar; Bar++ ) // fill bars inside
> > range
> >>
> >> TickerChg[Bar] = ( TickerClose[Bar] - TickerClose[StartBar] ) /
> >> TickerClose[StartBar] * 100;
> >>
> >> else
> >>
> >> for ( Bar = StartBar; Bar <= EndBar; Bar++ ) // fill bars inside
> > range
> >>
> >> TickerChg[Bar] = ( TickerClose[Bar] - TickerClose[Bar-1] ) /
> >> TickerClose[Bar-1] * 100;
> >>
> >> if ( TickerName == "!! SET TICKERS !!" )
> >>
> >> Title = EncodeColor( colorRed ) + Tickername;
> >>
> >> else
> >>
> >> Plot( TickerChg, TickerName, Color, styleLine );
> >>
> >> if ( Extend )
> >>
> >> Plot( TickerChg[EndBar], "", Color, styleLine );
> >>
> >> }
> >>
> >> ----- Original Message -----
> >> From: "gillesdeprez" <gillesdeprez@>
> >> To: <amibroker@xxxxxxxxxxxxxxx>
> >> Sent: Thursday, May 25, 2006 12:27 PM
> >> Subject: [amibroker] Re: Index comparison: Steve Dugas
> >>
> >>
> >> > Hi Steve, thanks for your answer...But attachments are not
stored
> >> > anymore on Yahoo groups...Or did I miss something? I checked
the
> > AB
> >> > library, and the file section of this group, unsuccessfully...
> >> > TIA, friendly,
> >> > Gilles
> >> >
> >> >
> >> >
> >> >
> >> >
> >> > --- In amibroker@xxxxxxxxxxxxxxx, "Steve Dugas" <sjdugas@>
wrote:
> >> >>
> >> >> Here is a pretty flexible relative performance tool. Range
> >> > defaults to
> >> >> visible bars but you can change it with range markers or by
> >> > setting dates in
> >> >> the Params. Also, ticker list accepts keywords like CURRENT,
> >> > INDUSTRY,
> >> >> etc.(you may need to edit the tickers associated with the
> > keywords
> >> > depending
> >> >> on your data provider). Feel free to ask if you have any
> > questions.
> >> >>
> >> >> Steve
> >> >>
> >> >> ----- Original Message -----
> >> >> From: "gillesdeprez" <gillesdeprez@>
> >> >> To: <amibroker@xxxxxxxxxxxxxxx>
> >> >> Sent: Tuesday, May 23, 2006 9:21 AM
> >> >> Subject: [amibroker] Index comparison
> >> >>
> >> >>
> >> >> > Hi all!
> >> >> > Does one of you know if there is any possibility to compare
> >> > index with
> >> >> > AB? I mean, compare for example the djia with the BEL20,
from
> > a
> >> >> > starting point let's say 1st january 2004, where both index
> >> > would be
> >> >> > at the same level for this date?
> >> >> > TIA, be happy!
> >> >> > Gilles
> >> >> >
> >> >> >
> >> >> >
> >> >> >
> >> >> >
> >> >> >
> >> >> >
> >> >> > Please note that this group is for discussion between users
> > only.
> >> >> >
> >> >> > To get support from AmiBroker please send an e-mail
directly
> > to
> >> >> > SUPPORT {at} amibroker.com
> >> >> >
> >> >> > For other support material please check also:
> >> >> > http://www.amibroker.com/support.html
> >> >> >
> >> >> >
> >> >> > Yahoo! Groups Links
> >> >> >
> >> >> >
> >> >> >
> >> >> >
> >> >> >
> >> >> >
> >> >> >
> >> >> >
> >> >>
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> > Please note that this group is for discussion between users
only.
> >> >
> >> > To get support from AmiBroker please send an e-mail directly
to
> >> > SUPPORT {at} amibroker.com
> >> >
> >> > For other support material please check also:
> >> > http://www.amibroker.com/support.html
> >> >
> >> >
> >> > Yahoo! Groups Links
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >>
> >
> >
> >
> >
> >
> >
> >
> >
> > Please note that this group is for discussion between users only.
> >
> > To get support from AmiBroker please send an e-mail directly to
> > SUPPORT {at} amibroker.com
> >
> > For other support material please check also:
> > http://www.amibroker.com/support.html
> >
> >
> > Yahoo! Groups Links
> >
> >
> >
> >
> >
> >
> >
> >
>






No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.394 / Virus Database: 268.7.2/349 - Release Date: 05/26/06


Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com

For other support material please check also:
http://www.amibroker.com/support.html





SPONSORED LINKS
Investment management software Real estate investment software Investment property software
Software support Real estate investment analysis software Investment software


YAHOO! GROUPS LINKS