PureBytes Links
Trading Reference Links
|
Herman,
The last sentence from my previous
e-mail should give you an answer:
"Please note that the very <FONT
color=#800000>first exectution after clicking "APPLY" in Indicator
Builder uses always *ALL* bars
because
it needs to analyse your code and its
requirements. Only subsequent executions use QuickAFL (less
bars)."
Best regards,Tomasz
Janeczkoamibroker.com
<BLOCKQUOTE
>
----- Original Message -----
<DIV
>From:
Herman van den
Bergen
To: <A title=amibroker@xxxxxxxxxxxxxxx
href="">amibroker@xxxxxxxxxxxxxxx
Sent: Sunday, July 25, 2004 1:38 PM
Subject: RE: [amibroker] Looping within
QuickAFL bounds
<FONT face=Arial color=#0000ff
size=2>Tomasz, I understand what you are saying.... But if I test the code
below using DebugView and i get 0.43 Second
execution regardless of wether I have QuickAFL set On
or OFF. So it appears that in this case QuickAFL does not restrict my
loops to its bounds...( i used AB 4.6, EOD data, max zoom (10bars
displayed)). Now if I set the loop to start at Barcount-40 to cover only the
data I think i should i get a dramatic improvement in execution - which is
what i want. <FONT
size=+0><SPAN
class=406480511-25072004>What am i doing
wrong?
<SPAN
class=406480511-25072004>h<SPAN
class=406480511-25072004>erman<SPAN
class=406480511-25072004><FONT
color=#0000ff>_TRACE("#Start");<FONT
face="Lucida Console">array = <FONT face="Lucida Console"
color=#ff00ff>0<FONT
face="Lucida Console">;<FONT face="Lucida Console"
color=#800000>for<FONT
face="Lucida Console">(bar=<FONT face="Lucida Console"
color=#ff00ff>0;
bar<BarCount; bar++) { T1=<FONT
color=#0000ff>LinearReg(<FONT
color=#0000ff>LinearReg(C,20),<FONT
color=#ff00ff>20); // just to
slow things down a bitLRR[bar] = T1[bar];<FONT
size=2>array[ bar ] = bar; }<FONT
face="Lucida Console" color=#0000ff>Plot(
array, <FONT face="Lucida Console"
color=#ff00ff>"bar",
colorRed );<FONT face="Lucida Console"
color=#0000ff>Plot( <FONT
face="Lucida Console" color=#0000ff>BarIndex<FONT
face="Lucida Console">(), <FONT face="Lucida Console"
color=#ff00ff>"barindex"<FONT
face="Lucida Console">, colorBlue );<FONT
color=#0000ff>_TRACE(<FONT
color=#ff00ff>"#End");
<FONT
size=2><FONT face=Arial
color=#0000ff>
<FONT
size=2>
<FONT
size=2> -----Original
Message-----From: Tomasz Janeczko
[mailto:amibroker@xxxxxx]Sent: Sunday, July 25, 2004 3:40
AMTo: amibroker@xxxxxxxxxxxxxxxSubject: Re:
[amibroker] Looping within QuickAFL boundsImportance:
High
Herman,
You do not do worry about it or handle it by
yourself.
AmiBroker does it for you.
for(bar=0; bar<barcount; bar++) { ....
}
does not waste any cycles,
Try it:
array = 0;
for(bar=0; bar<barcount; bar++)
{
array[ bar ] = bar;
}
Plot( array, "bar", colorRed );
Plot( BarIndex(), "barindex", colorBlue
);
This because array item 0 already
is the first bar used by quick AFL (not the first bar in your data
set)
and (barcount-1) is a last array item
of quickafl (not the last bar in your data set).
I have mentioned it that barcount is a number
of bars (items) in the array which may be smaller.
<TABLE cellSpacing=0
cellPadding=0 width=529 border=0 x:str>
<TD class=xl24
width=97 height=17>Bar Index
<TD class=xl24
align=right width=32 x:num>0
<TD class=xl24
align=right width=28 x:num>1
<TD class=xl24
align=right width=31 x:num>2
<TD class=xl24
align=right width=28 x:num>3
<TD class=xl24
align=right width=30 x:num>4
<TD class=xl24
align=right width=32 x:num>5
<TD class=xl24
align=right width=29 x:num>6
<TD class=xl24
align=right width=37 x:num>7
<TD class=xl26
align=right width=36 x:num>8
<TD class=xl24
align=right width=35 x:num>9
<TD class=xl24
align=right width=40 x:num>10
<TD class=xl24
align=right width=32 x:num>11
<TD class=xl24
align=right width=42 x:num><FONT face="Arial CE"
size=2>12
<TD class=xl25
height=17>Array element
<TD
><FONT
face="Arial CE" size=2>
<TD
><FONT
face="Arial CE" size=2>
<TD
><FONT
face="Arial CE" size=2>
<TD
><FONT
face="Arial CE" size=2>
<TD class=xl25
align=right x:num>0
<TD class=xl25
align=right x:num>1
<TD class=xl25
align=right x:num>2
<TD class=xl25
align=right x:num>3
<TD class=xl26
align=right x:num>4
<TD class=xl25
align=right x:num>5
<TD
>
<TD
>
<TD
>
As you can see in the picture above when
QuickAFL is on, BarCount variable will give you 6 in that case
(the number of items in the array). So if you
will iterate from 0 to 5 you will access only visible
items automatically.
<FONT face=Arial
size=2>
So writing
for(bar=0; bar<barcount; bar++) you are already accessing only
what is necessary, not more.
Please note that the very first exectution
after clicking "APPLY" in Indicator Builder uses always *ALL* bars
because
it needs to analyse your code and its
requirements. Only subsequent executions use QuickAFL (less
bars).
Best regards,Tomasz
Janeczkoamibroker.com
<BLOCKQUOTE
>
----- Original Message -----
<DIV
>From:
Herman van den
Bergen
To: <A
title=amibroker@xxxxxxxxxxxxxxx
href="">AmiBroker YahooGroups
Sent: Sunday, July 25, 2004 2:38
AM
Subject: [amibroker] Looping within
QuickAFL bounds
<SPAN
class=437013000-25072004>Hello,
<SPAN
class=437013000-25072004>
would anybody
have figured out how to restrict a loop to the same range as QuickAFL.
Normally is use loops like:
<SPAN
class=437013000-25072004>for(bar=0; bar<barcount; bar++) { ....
}
<SPAN
class=437013000-25072004>
However this
is wasting a lot of cycles, especially when working with about 100,000
minute bars of which only the displayed segment (about 1% of the
data) is important. <SPAN
class=437013000-25072004>For use with QuickAFL ON, can anybody
provide the code to define:
<SPAN
class=437013000-25072004>FirstBarUsedByQuickAFL =
?
<SPAN
class=437013000-25072004>LastBarUsedByQuickAFL =
?
<SPAN
class=437013000-25072004>so that I can make the loop like
so:
<SPAN
class=437013000-25072004>for( bar = FirstBarUsedByQuickAFL; bar <=
LastBarUsedByQuickAFL; Bar++ ) { ....
}
Many
thanks,
<SPAN
class=437013000-25072004>herman.Check
AmiBroker web page at:<A
href="">http://www.amibroker.com/Check
group FAQ at: <A
href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Check AmiBroker web page at:<A
href="">http://www.amibroker.com/Check
group FAQ at: <A
href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Check AmiBroker web page
at:<A
href="">http://www.amibroker.com/Check
group FAQ at: <A
href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html
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
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 the Yahoo! Terms of Service.
|