Re: [amibroker] Re: error 10. subscript out of range

 

TJ

My problem now is I cannot use the APPLY in the editor.  I wish there was a way to tell the editor to count ALL bars.

I use a complex script with multiple timeframes and using absolute bar counting is the only way I could think to keep track of the barindex between different timeframes.  ie what barindex from lower timeframe corresponds to which barindex from the higher timeframe.

Here is a small demo I wrote for this:
http://bbb-amibroker.blogspot.gr/2016/03/timeframeset-and-barindex-of-compressed.html

If somebody could suggest a better way to relate barindexes from different timeframes, without the need for 
SetBarsRequired( -2, -2 ),   then the script would become much more efficient.





On Mon, Apr 25, 2016 at 11:05 AM, Tomasz Janeczko groups@amibroker.com [amibroker] <amibroker@yahoogroups.com> wrote:
 

Hello,

Thank you very much for your e-mail.

As written in the article, you should not make assumptions on how many bars you
get because different symbols may use different counts.

AFL editor for "Syntax Check" uses not more than 200 bars for two reasons:
1. To catch coding mistakes exactly like this one, i.e. making assumptions on number of bars
2. To make syntax checks faster for very complex formulas

Best regards,
Tomasz Janeczko
amibroker.com

On 2016-04-25 08:43, 'B. Pitatzidis' bobptz@gmail.com [amibroker] wrote:
Thank you for the link TJ.

I think this answers my question:
"during AFL Editor's Verify Syntax not more than 200 most recent bars are used"

In my code I use something like:
SetBarsRequired( -2, -2 );
.....
AbsBarcount = Status( "quickaflfirstdatabar" ) + BarCount;
.....
TFdatetime[AbsBarCount - 1] =

The last line triggers the error ONLY from the Editor.  Makes sense if inthe editor the barcount is only 200.









On Mon, Apr 25, 2016 at 9:21 AM, Tomasz Janeczko groups@amibroker.com [amibroker] <amibroker@yahoogroups.com> wrote:
 

Hello,

"I am pretty sure my indexes are not out of range"

If program says it is out of range you can be 100% sure that it really *is* out of range.

As always everything is covered by documentation:
http://www.amibroker.com/kb/2014/09/22/do-not-make-assumptions-on-number-of-bars/


Best regards,
Tomasz Janeczko
amibroker.com



On 2016-04-25 08:14, 'B. Pitatzidis' bobptz@gmail.com [amibroker] wrote:
Hello

I am having "Error 10" (subscript out of range), but I am pretty sure my indexes are not out of range.  The problems occurs only in the editor, when I click the Apply button.  The script runs without any problems and produces correct results when I run it normally. 

Here is a typical error message I get:
Error 10. Array subscript out of range. You must not access array elements outside 0..(BarCount-1) range. You attempted to access non-existing 11454-th element of array.

However the BARCOUNT is 11491 (bigger than 11457). 

I checked this guide and it is definetely not my case:
http://www.amibroker.com/guide/errors/10.html

I assume it is some setting in the editor or cache that I need to set?  I searched all of them and increased them to over 20.000.
 






__._,_.___

Posted by: "B. Pitatzidis" <bobptz@gmail.com>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (6)

Upgrade your account with the latest Yahoo Mail app
Get organized with the fast and easy-to-use Yahoo Mail app. Upgrade today!

**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

TO GET TECHNICAL SUPPORT send an e-mail directly to
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/


.

__,_._,___


EmoticonEmoticon