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

Re: [amibroker] Re: AFL Execution time for indicator code



PureBytes Links

Trading Reference Links

This thread brings up some interesting points.

There a number of factors involved when choosing arrays or loops for a  
task.

Array arithmetic algorithms are different than loop arithmetic  
algorithms.
      It usually takes more steps to do complex array logic (unless  
using a complex array operator that has no direct single operator  
equivalent)
      Using iif() always generates two arrays for the true and false  
values.
      If fast AFL is on, the number of bars is reduced and the speed  
increases for array operations.
      If SetBarsRequired() is used to increase the number of bars,  
they can not be reduced later on in subsequent passes.

A well designed loop can take advantage of a few speedup tricks.
      Many operations can be conditionally skipped.
      Intermediate values can be passed without using variables, or  
using one variable instead of a new array.
      Using if() only evaluates and generates as much information as  
required.
      The number of bars in the calculation can be changed dynamically  
for speed.
      SetBarsRequired() still has an effect on speed for the same  
reasons as above and many array operations are still needed.

While array operations should be used for most things, loops can be  
faster when the logic required to use only arrays becomes cumbersome  
or the number of bars processed is reduced.
Also, SetBarsRequired() "bigger only values" change limitations is a  
real speed killer for some applications like mine that change the  
number of bars of history dynamically from a parameter --and also  
under AFL program control to speed up certain passes for UI speed  
reasons.

My programs are filled with a good mix of both array logic and loops  
depending on speed and on simplifying the complexity of the logic.

Best regards,
Dennis

On Aug 12, 2008, at 7:21 PM, Tomasz Janeczko wrote:

> Hello,
>
> Iterating through bars using loop is a lot slower than array  
> operation.
> It can be 10x or more depending on number of bars.
>
> Best regards,
> Tomasz Janeczko
> amibroker.com
> ----- Original Message -----
> From: "sidhartha70" <sidhartha70@xxxxxxxxx>
> To: <amibroker@xxxxxxxxxxxxxxx>
> Sent: Tuesday, August 12, 2008 11:30 PM
> Subject: [amibroker] Re: AFL Execution time for indicator code
>
>
>> Thanks TJ. That's impressive.
>>
>> What happens where you are not using AFL in array mode and are using
>> looping structures through each bar...?
>>
>> I think you have said before that there is no special execution
>> penalty for this...?
>>
>> Many Thanks
>>
>> --- In amibroker@xxxxxxxxxxxxxxx, "Tomasz Janeczko" <groups@xxx>  
>> wrote:
>>>
>>> Hello,
>>>
>>> Here is an article that covers that in detail:
>>> http://www.amibroker.com/kb/2008/08/12/afl-execution-speed/
>>>
>>>
>>> Best regards,
>>> Tomasz Janeczko
>>> amibroker.com
>>> ----- Original Message -----
>>> From: "Tomasz Janeczko" <groups@xxx>
>>> To: <amibroker@xxxxxxxxxxxxxxx>
>>> Sent: Tuesday, August 12, 2008 6:21 PM
>>> Subject: Re: [amibroker] Re: AFL Execution time for indicator code
>>>
>>>
>>>> AFL array processing is at native machine code speed. Can't be
>> faster than that.
>>>>
>>>> Best regards,
>>>> Tomasz Janeczko
>>>> amibroker.com
>>>> ----- Original Message -----
>>>> From: "sidhartha70" <sidhartha70@xxx>
>>>> To: <amibroker@xxxxxxxxxxxxxxx>
>>>> Sent: Tuesday, August 12, 2008 4:59 PM
>>>> Subject: [amibroker] Re: AFL Execution time for indicator code
>>>>
>>>>
>>>>> Thanks TJ. I am using 5.16 actually.
>>>>>
>>>>> As a point of interest, how does AFL execution speed compare with
>> C#...?
>>>>>
>>>>>
>>>>> --- In amibroker@xxxxxxxxxxxxxxx, "Tomasz Janeczko" <groups@>  
>>>>> wrote:
>>>>>>
>>>>>> If you are using linked charts, it is recommeded to upgrade to  
>>>>>> 5.16
>>>>>>
>>>>>> Best regards,
>>>>>> Tomasz Janeczko
>>>>>> amibroker.com
>>>>>> ----- Original Message -----
>>>>>> From: "sidhartha70" <sidhartha70@>
>>>>>> To: <amibroker@xxxxxxxxxxxxxxx>
>>>>>> Sent: Tuesday, August 12, 2008 2:24 PM
>>>>>> Subject: [amibroker] Re: AFL Execution time for indicator code
>>>>>>
>>>>>>
>>>>>>> TJ... no I don't.
>>>>>>>
>>>>>>> --- In amibroker@xxxxxxxxxxxxxxx, "Tomasz Janeczko" <groups@>
>> wrote:
>>>>>>>>
>>>>>>>> Do you use lots of Foreign()/SetForeign() ?
>>>>>>>>
>>>>>>>> Best regards,
>>>>>>>> Tomasz Janeczko
>>>>>>>> amibroker.com
>>>>>>>> ----- Original Message -----
>>>>>>>> From: "sidhartha70" <sidhartha70@>
>>>>>>>> To: <amibroker@xxxxxxxxxxxxxxx>
>>>>>>>> Sent: Tuesday, August 12, 2008 1:17 PM
>>>>>>>> Subject: [amibroker] AFL Execution time for indicator code
>>>>>>>>
>>>>>>>>
>>>>>>>>> Lets say I'm looking at 200 tick charts ... I use a number
>> of quite
>>>>>>>>> complex indictaors to guide my trading... what's the highest
>>>>>>>>> realistically usable 'total execution time' for any given
>> indicator
>>>>>>>>> under those cirumstances...? I want to check my coding is ok.
>>>>>>>>>
>>>>>>>>> Why do I ask...? Because I have 9 charts on my dual screen set
>>>>> up...
>>>>>>>>> some are just price graphs. Other's price graphs + more
>> complex AFL
>>>>>>>>> code... a number of my 'panes' indicate that they take 0.02
>>>>> secs total
>>>>>>>>> execution time... in concert these seem to be taking my
>> AmiBroker
>>>>>>>>> session towards unusable slowness...
>>>>>>>>>
>>>>>>>>> As I mentioned yesterday my average total exec time for all
>>>>> graphs is
>>>>>>>>> 0.65-0.7 secs... as well as this I have a real time quote
>>>>> window open.
>>>>>>>>>
>>>>>>>>> As I sit here now, I have one of my 8 x 3Ghz cores grinding
>> away at
>>>>>>>>> about 80%...
>>>>>>>>>
>>>>>>>>> Oh... I use IQ Feed by the way.
>>>>>>>>>
>>>>>>>>> Many Thanks
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> ------------------------------------
>>>>>>>>>
>>>>>>>>> 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 NEW RELEASE ANNOUNCEMENTS and other news always check
>> DEVLOG:
>>>>>>>>> http://www.amibroker.com/devlog/
>>>>>>>>>
>>>>>>>>> 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 NEW RELEASE ANNOUNCEMENTS and other news always check  
>>>>>>> DEVLOG:
>>>>>>> http://www.amibroker.com/devlog/
>>>>>>>
>>>>>>> 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 NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
>>>>> http://www.amibroker.com/devlog/
>>>>>
>>>>> 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 NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
>>>> http://www.amibroker.com/devlog/
>>>>
>>>> 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 NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
>> http://www.amibroker.com/devlog/
>>
>> 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 NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
> http://www.amibroker.com/devlog/
>
> 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 NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html
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/