• 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.

Amibroker Help

Discussion in 'Trading Strategies/Systems' started by Steve C144, Jun 21, 2019.

  1. Steve C144

    Steve C144

    Posts:
    19
    Likes Received:
    0
    Joined:
    Jun 17, 2019
    Hello,
    First ever post here, so if I am in the wrong place - apologies.
    Just started with Amibroker...
    Here is my code which buys and sells on same day for every trade. Why? Well that's the question...any thoughts appreciated.
    _SECTION_BEGIN("AD Price");

    function AdvDecWilliams()
    {
    C1 = Ref( C, -1 );
    trhi = IIf( C1 > High, C1, High );
    trlo = IIf( C1 < Low, C1, Low );

    //return MA(Cum( IIf( C > C1, Close - trlo, Close - trhi ) ),80)/c;
    return MA((Cum( IIf( C > C1, Close - trlo, Close - trhi ) )/c),80);
    }

    //Plot( AdvDecWilliams(), _DEFAULT_NAME(), ParamColor("Color", ColorCycle ) );
    _SECTION_END();
    Buy = Ref(AdvDecWilliams(), -1) < .01;
    //Sell = C > MA(C,55);
    //Buy = ExRem(Buy,Sell);
    //Sell = ExRem(Sell,Buy);
    Sell = 0;
    ApplyStop(stopTypeTrailing, stopModePoint, 3*ATR(14), True, True );
    shape = Buy * shapeUpArrow;
    PlotShapes( shape, IIf( Buy, colorGreen, colorGreen ), 0, IIf( Buy, Low, High ) );
    PlotShapes( shape, IIf( sell, coloryellow, coloryellow ), 0, IIf( sell, high, low ) );
    GraphXSpace = 5;
     
  2. jjbinks

    jjbinks

    Posts:
    231
    Likes Received:
    153
    Joined:
    May 14, 2013
    Seems to work for me. (Average trade length 18 days)
    I wonder if your backtest setting are the cause?
     
  3. Steve C144

    Steve C144

    Posts:
    19
    Likes Received:
    0
    Joined:
    Jun 17, 2019

    Thanks, will investigate...
     
  4. Steve C144

    Steve C144

    Posts:
    19
    Likes Received:
    0
    Joined:
    Jun 17, 2019
    There you go...copied it into a new formula editor session and it works for me too!!???
     
Loading...

Share This Page