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

Re: [amibroker] Subscript out of range



PureBytes Links

Trading Reference Links

Thanks
----- Original Message -----
Sent: Thursday, December 15, 2005 7:49 AM
Subject: Re: [amibroker] Subscript out of range

Hello,
 
LastValue(BarIndex()) is different than BarCount.
 
BarIndex refers to absolute bar index, while NOT ALL bars are used for indicator calculation.
Indicators usually use visible bars only (plus some more).
 
So you must use subscripts in range of 0... (BarCount-1)
============================================
As only BarCount refers to actual number of array elements used for AFL calculation.

Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message -----
From: Terry
Sent: Thursday, December 15, 2005 4:28 PM
Subject: RE: [amibroker] Subscript out of range

It seems like LastValue(BarIndex()) should work, but you're clearly get errors so just use the (simpler) i < BarCount; as shown in Help examples.

 

--

Terry

-----Original Message-----
From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf Of Ara Kaloustian
Sent: Wednesday, December 14, 2005 22:57
To: AB-Main
Subject: [amibroker] Subscript out of range

 

I am using code below to export RT data to a disk file, in a format that I can later import into AB.

 

The output is OK for a few bars, then I get error "subscript out of range..."

 

Thanks

 

Ara

 

//File: UTIL - Export data

//Version 1.0

//December 15, 2005

Path = "D:\\Data\\Amibroker\\AB Data\\" + Name() + ".csv";

fh = fopen(Path,"w");

if( fh )

{

fputs( "Date,Time,Open,High,Low,Close,Volume\n", fh );

for( i = 0; i < LastValue(BarIndex()); i++ )

{

Date_ = DateNum();

Time_ = TimeNum();

qs = StrFormat("%.0f,%.0f,%.4f, %.4f, %.4f, %.4f, %.0f\n",

Date_[i],Time_[i],O[ i ], H[ i ], L[ i ], C[ i ], V[ i ] );

fputs( qs, fh );

}

fclose( fh );

}

 

 




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