Amibroker formula language algorithms and questions

Discussion in 'App Development' started by Wach80, Jul 8, 2016.

  1. Wach80

    Wach80

    The amibroker library is not available to trial users and the manual is a bit too hard to follow , so i make this thread to ask for algorithms and examples who will improve my coding with this language.

    Ok lets begin with this example , for those of you who are skilled with this language , can you translate this H&S pattern into code? How would it look like?

    [​IMG]

    Another algorithms im interested in:

    1. how do i say *volume is x*

    2. how do i say *open interest is x*

    3. how do i say *price is trending over x period*

    4. how do i say *buy at low bollinger , sell above middle*

    5. on the H&S pattern above , how do i say *buy above neckline*?
     
  2. Hittfeld

    Hittfeld

    You have naturally checked with Howard Bandy`s free book or youtube for video lessons - right?
     
  3. Wach80

    Wach80

    not yet but thats why i made this thread , i will check that stuff though later on
     
  4. fxshrat

    fxshrat

    As for 1. and 2.

    What exactly do you mean there? Are you after an equality check?

    Like

    Code:
    volumecondition = V == 100000;
    oicondition = OI == 70000;
    As for 3.
    There are several ways to define trending.
    One out of quadrillions...

    Code:
    period = 20;
    someuptrendcondition = H >= Ref( HHV( H, period ), -1 );
    As for 4.

    Code:
    Periods = Param( "Periods", 20, 3, 30, 1 );
    Width = Param( "Width", 1, 0, 5, 0.1 );
    
    lowerbb = BBandBot( C, Periods, Width ); // lower BB band
    middlebb = MA( C, periods ); // middle bb band
    
    BuyPrice = Open;
    SellPrice = Open;
    
    Buy = Ref( Cross( C, lowerbb ), -1 );
    Sell = Ref( Cross( middlebb, C ), -1 );
    
    As for 5.

    Since it is a manually drawn trendline you just have to use Study() function to call it.
    Just take a look at the knowledge base of Amibroker http://www.amibroker.com/kb/index.php?s=study


    PS: The codes above may contain errors as I have written them off the top of my head without testing!
     
  5. Wach80

    Wach80

    nice thanks , looks a bit hard language and it sucks that i cant access the library.
     
  6. Metamega

    Metamega

    I can pretty much promise that access to the library won't hold you back from your trial of Amibroker. The manual and Amibroker knowledge base contains more then enough to learn.

    The libraries formulas would most likely confuse you more trying to figure them out lol
     
  7. M.ST.

    M.ST.

    Either you are heavily joking or you are an absolute beginner not having seen many codes of any language in your life if you think that those lines were hard to grasp.
     
  8. Wach80

    Wach80

    My only coding experience was with sql i think , i coded alot stuff but it was really easy because the owners of the program had tons of codes available and you could easily copy them to create your own , learning how to code based on a manual is probably harder and will take some time , i would like it more if i had tons of codes available to copy and simply merge the ones i want thats why i made this thread , anyway the post with the codes above is good and gives a lot of examples that will be usefull for me in the future.

    Studying the manual is something i may do in the future assuming i will want to follow a systematic trading approach until then , im still learning trading and i realize now that systematic backtests and trading is only one part of technical analysis trading style.
     
    Last edited: Jul 12, 2016
  9. fxshrat

    fxshrat

    AFL is similar to C but much easier. As Tomasz J. recommends in the quote of the 2nd post of this link http://amibrokerforum.proboards.com/thread/107/afl getting a C programming book i.e. by Kernighan & Ritchie might be a good idea.

    Other than that every function in the function reference guide of the user manual contains a basic example on how it is used, see alpahbetical list of functions https://www.amibroker.com/guide/AFL.html

    Here in the first post a quick summary of existing basics from official website
    http://amibrokerforum.proboards.com/thread/2/existing-official-3rd-party-tutorials

    And here are some other general basics (not just AFL)
    http://amibrokerforum.proboards.com/board/7/amibroker-basics

    It's just up to you what you are going to make out of it since there already exists lots of docu to get you going.
     
    Hittfeld likes this.
  10. Hittfeld

    Hittfeld

    Thanks fxshrat,

    great and very informative post!
     
    #10     Jul 13, 2016