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

[amibroker] Re: A simple loop, but not so simple?



PureBytes Links

Trading Reference Links

> //  Now the loop
> end = SelectedValue(bi);
> start = end-100;
> for (i=start; i<=end; i++)
> {
> }
> // NOTE - assumes at least the following
> SetBarsRequired(100,0)

I don't know if it is viable idea but I like the idea of processing any part of the array that is in current execution (full database array or QuickAFL specified array) anywhere,anytime without tripping over SetBarsRequired, or needing to specify SBR for a defined pane OR block of delineated code.

Something like C(LastValue(BarIndex()) - 10) would perform the required exectution on the close for only the last 10 bars.

It could apply in BT, or charts, where the LastValue(BarIndex()) puts the stake in the ground.

This way we could shorten the bars being referenced when and where ever we like ... I guess it is our problem if, in some cases it actually slows down the execution.

R language allows ragged arrays and also array indexing (subsections of an array), which seems to offer some advantages to time series analysis.

KEYWORDS

OPTIMAL RT PERFORMANCE

--- In amibroker@xxxxxxxxxxxxxxx, "bruce1r" <brucer@xxx> wrote:
>
> Herman -
> 
> Bottom line - do the following - explanation follows -
> 
> //  The following yields a QuickAFL array index
> bi = BarIndex();
> bi = bi - bi[0];
> 
> //  Now the loop
> end = SelectedValue(bi);
> start = end-100;
> for (i=start; i<=end; i++)
> {
> }
> // NOTE - assumes at least the following
> SetBarsRequired(100,0)
> 
> To see how this works is a little tough without pictures, but envision
> the following -
> 
>     * Ticker contains 5000 bars
>     * Last 1000 bars displayed
>     * SetBarsRequired(100,0) has been used
> QuickAFL is going to present arrays as 1100 bars (1000 displayed+100
> back).  The trick is that the BarIndex() function returns the bar index
> for the full data.  So, it returns values 3900 - 4999 in the BarIndex()
> array that you "see" in AFL.  You have to convert it to a QuickAFL index
> that you can use for looping by subtracting the "bias amount" of the
> first bar.
> 
> See Tomasz's much better explanation at -
> 
> http://www.amibroker.com/kb/index.php?s=quickafl
> 
> -- BruceR
>




------------------------------------

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

Yahoo! Groups Links

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

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

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