• 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 Question: Buy 5 days after Buy Signal if price is higher

Discussion in 'Software and Data' started by dari08ab, Feb 26, 2013.

  1. dari08ab

    dari08ab

    Posts:
    4
    Likes Received:
    0
    Joined:
    Feb 26, 2013
    Hi guys,

    I am new to Amibroker, so pardon me if this question is stupid :)

    I would like to implement a system which enter long in a stock 5 days after a simple moving average cross-over only if the closing price that day is higher than the closing price of the day of the cross-over.

    I can handle the simple part :

    FastMA = MA (C, FastMALenght);
    SlowMA = MA (C, SlowMALenght);

    // BUY SETUP
    BUYSetUP1 = Cross(FastMA,SlowMA);

    // Execute
    Buy = BUYSetUP1;

    Any suggestion on how could I implement the trick for the check of the price after 5 days?

    Thanks for the help.

    Br
    Davide
     
  2. rnr

    rnr

    Posts:
    487
    Likes Received:
    226
    Joined:
    Jul 1, 2007
    See if this works:-

    Code:
    // BUY SETUP
    BUYSetUP1 = Ref(Cross(FastMA,SlowMA),-5) AND
    Cross(H,Ref(H,-5));
     
  3. AlterEgo

    AlterEgo

    Posts:
    500
    Likes Received:
    7
    Joined:
    May 24, 2008
    or try

    BUYSetUP1 = Ref(Cross(FastMA,SlowMA),-5) AND
    H > Ref(H,-5);
     
Loading...

Share This Page