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

[amibroker] Re: General questions about amibroker


  • Date: Sun, 21 Mar 2010 20:39:29 -0000
  • From: "Rob" <sidhartha70@xxxxxxxxx>
  • Subject: [amibroker] Re: General questions about amibroker

PureBytes Links

Trading Reference Links

To start with I'd do it brute force... and see how it executes speed wise. It should be easy & quick to code using AFL. You can worry about the speed after once you've tested it...

While it may seem inefficient, it's actually not. One thing you have to get your head around in 'array mode' is that while you might be operating on an entire array, it is very efficient code wise... it is one operation - just like looping through the array is on one piece of data.

TJ knows the real mechanics under the hood... i.e. how this works at a CPU level, but my advice would be to stop thinking about efficiency in the terms you are at the moment. Again, you are still in looping mindset.

AFL does have speed limitations... most of those centre around loading huge arrays that won't fit into CPU cache memory... hence what could be done in one CPU cycle with a smaller array must be done over multiple cycles on very large arrays - that is the main reason to keep array size reasonable (at 1M bars per array I would caution that you may be heading for trouble in execution speed terms. Again TJ can clarify).

Hope that helps.

--- In amibroker@xxxxxxxxxxxxxxx, "pipadder" <pipadder@xxx> wrote:
>
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> --- In amibroker@xxxxxxxxxxxxxxx, "pipadder" <pipadder@> wrote:
> >
> > Hi,
> > 
> > I am a systematic mechanical trader (almost exclusively forex). For the last couple of years [...]
> 
> Ok, it appears that trying to think in "array mode" is giving me a lot more trouble than I expected. One of the main problems I am finding is the fact that conditional execution of code (do/calculate stuff which needs to happen only for some bars, but not for some others) doesn't seem obvious now, and I am stuck. Or at least, the ways I can come up with to do things don't seem efficient to me.
> 
> Perhaps the best way is to give a concrete example... I am trying to code a system that is just a variation of your usual breakout box. I am working with a 1-minute bar database. So, the program is going to process these bars and determine when to place the orders. This will happen once a day, for a given bar (on a given minute, of course) which I can identify. Let's assume I am at the point where my program has already determined which bars those are and I have a nicely populated "buy" array with a few "1" here and there. The problem comes now: to use volatility-adjusted stops, once a "buy bar" is known the program needs to run some calculations that use a certain number of prior bars (several hundreds of them, actually) to determine stop placement (sellprice), order size, etc. So I am thinking about two possible options to do this:
> 
> 1) Brute force. I run these calculations and determine the volatility-adjusted stuff for every bar, whether it is a "buy" bar or not, so that I have those numbers available in an appropriately created array when needed. This could be done in AFL array style, but seems like total overkill: in a 1M database and to place only one order a day, I would only need to run this calculation once every 1440 bars. So running the calculation for every single bar looks quite inefficient.
> 
> 2) Conditional execution... Call a function that will perform the calculation only for those bars which are tagged as "buy bars". Now... the only way I can think of to do this is to just run a loop through the whole database and perform the appropriate calculations only for the bars that require them. This of course looks more efficient than the solution before, but I am not using the advantages of simultaneous array operation anymore, and not having a good idea of the speed advantage of array vs. loop operation I cannot really know whether it is a better solution.
> 
> I suppose many of you have gone through this kind of problem, so do you guys know which solution is better, or perhaps even have suggestions on how to do this in a cleaner and more efficient way?
> 
> Thanks again for your continued patience!
>




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

**** 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:
    amibroker-digest@xxxxxxxxxxxxxxx 
    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/