• Australian (ASX) Stock Market Forum

Hello and welcome to Aussie Stock Forums!

To gain full access you must register. Registration is free and takes only a few seconds to complete.

Already a member? Log in here.

Document - AmiBroker's Custom Backtester Interface

Discussion in 'Software and Data' started by GreatPig, Jun 17, 2007.

  1. GreatPig

    GreatPig Pigs In Space

    Posts:
    2,368
    Likes Received:
    8
    Joined:
    Jul 9, 2004
    Attached is a document I've written covering use of the AmiBroker custom backtester interface. It covers the interface's object model, and the high-level, mid-level, and low-level backtester interfaces, with examples of the use of each. There's also an appendix on using DebugView to debug AFL code.

    As the custom backtester interface relies heavily on looping, except for the high-level interface, this document is aimed at AFL programmers who are already comfortable with standard AFL, arrays, indexing, and looping. If you don't understand looping, it's highly unlikely that you'll be able to understand use of the mid-level and low-level backtester interfaces. You may be able to use the high-level interface without a knowledge of looping though.

    This document may be freely distributed. It's also been uploaded to the AmiBroker Yahoo forum files area.

    Cheers,
    GP
     

    Attached Files:

  2. Shane Baker

    Shane Baker

    Posts:
    114
    Likes Received:
    0
    Joined:
    Mar 14, 2006
    GP,

    Once again many thanks. This is great stuff.

    Cheers

    Shane
     
  3. GreatPig

    GreatPig Pigs In Space

    Posts:
    2,368
    Likes Received:
    8
    Joined:
    Jul 9, 2004
    Updated to version 2 to fix a few errors. Main change relates the the mid-level example using the volume EMA array, where it needs to be passed from the main AFL code using the AddToComposite function.

    Cheers,
    GP
     

    Attached Files:

  4. theasxgorilla

    theasxgorilla Problem solved... next bubble.

    Posts:
    2,343
    Likes Received:
    0
    Joined:
    Dec 7, 2006
    Brilliant document GP! Also got your one on looping. I haven't coded for about 10 years, so its going to come is uber handy as a refresher of sorts.
     
  5. theasxgorilla

    theasxgorilla Problem solved... next bubble.

    Posts:
    2,343
    Likes Received:
    0
    Joined:
    Dec 7, 2006
    In AFL I keep tripping myself up on the IF and IIFs!

    I'll write wonderful code and then find that in half a dozen places I have to go and rewrite IFs into IIFs...and nested IIFs are not as neat and intuitive to construct.
     
  6. GreatPig

    GreatPig Pigs In Space

    Posts:
    2,368
    Likes Received:
    8
    Joined:
    Jul 9, 2004
    Thanks AG.

    Don't worry about the IF/IIF thing, I still do that all the time too. With the way numbers and arrays can look identical, it's very easy to temporarily forget when writing something like "if (myvar > 10)" whether myvar is an array or a number.

    Cheers,
    GP
     
  7. GreatPig

    GreatPig Pigs In Space

    Posts:
    2,368
    Likes Received:
    8
    Joined:
    Jul 9, 2004
    I've attached and uploaded another version of the document to the Yahoo forum files area with a few more examples. Specifically, I've added a couple of small examples to the high-level interface section to demonstrate adding metrics to the Trade objects, and also added another appendix with a more complex example implementing the Lichello AIM algorithm using the low-level interface.

    Cheers,
    GP
     

    Attached Files:

  8. GreatPig

    GreatPig Pigs In Space

    Posts:
    2,368
    Likes Received:
    8
    Joined:
    Jul 9, 2004
    I've uploaded another version of the document to the Yahoo forum files section to fix the mid-level example using the AddToComposite function.

    It seems that to use this function in backtests, the "atcFlagEnableInBacktest" flag needs to be added to the defaults:

    Code:
    AddToComposite(EMA(Volume, 100), "~evol_"+Name(), "V",
                            atcFlagDefaults | atcFlagEnableInBacktest);
    
    I'm a little confused with this though, as sometimes it seems to work without that flag and sometimes not.

    GP
     
  9. edman79

    edman79

    Posts:
    81
    Likes Received:
    3
    Joined:
    Mar 9, 2010
    I know its old but what a great help.
    Saved me a day of searching!
    Thanks a lot.
     
  10. Gringotts Bank

    Gringotts Bank

    Posts:
    6,175
    Likes Received:
    602
    Joined:
    Jun 30, 2007
    Great Pig made so many useful contributions.

    Seems like quite a while since he has been around. Would like to shoot him a few questions on this stuff.
     
Loading...

Share This Page