Hi Howard,
                I just returned from the Alpine region of Victoria and 
downloaded the mass's of Amibroker emails ,i was lucky enough to spot your 
reply amongst them,thank you.

 I'll now make a cup of tea and have a play with the new code,
warm regards
Paul
      (ps thanks for fixing my Christian name up too, from my unfamilar 
cousin's.)


  ----- Original Message ----- 
  From: Howard B 
  To: [email protected] 
  Sent: Thursday, September 25, 2008 8:22 AM
  Subject: Re: [amibroker] backtesting



  Paul -- I meant Paul.




  On Wed, Sep 24, 2008 at 3:21 PM, Howard B <[EMAIL PROTECTED]> wrote:

    Hi Nick --

    I've taken the liberty of starting with your first code segment, adding 
some comments, and making
    some changes.  I may not have gotten all of your preferences correct, but 
try this
    and see if it helps.

    Thanks,
    Howard

    ////////////////////////////////////////////////////

    // radge1.afl

    //Day Trade

    InitEquity = 100000;
    SetOption("InitialEquity",InitEquity);

    SetTradeDelays (1,1,0,0); // Explore today trade tomorrow


    // Number of positions to hold
    MaxQty = 10;
    SetOption("maxopenpositions",MaxQty);


    //    Uncomment the way you want to set position size

    // $5000 for each trade
    // PositionSize = 5000;

    // positionsize is proportional to maximum number held
    PositionSize = -100 / MaxQty; 



    // PositionScore is the ratio of 1 day rate of change to 10 day rate of 
change 
    // unless the 1 day rate of change is zero, PositionScore will always be 
non-zero
    // that is, PositionScore will always be True
    PositionScore = ROC(C,1) / ROC(C,10); //looking for a big move compared to 
the last 2 weeks


    //  Since PositionScore is always True,
    //    Filter is True when Close > Open.
    // Filter = PositionScore AND Close > Open; //looking for the biggest move 
on an up day.
    Filter = Close > Open;

    // Set a buy signal
    BuySignal = Filter;


    // Buy whenever today's close is greater than 
    //    today's open.
    // But not two days in a row.
    Buy = BuySignal AND NOT(Ref(BuySignal,-1));

    // BuyPrice is tomorrow's Open
    BuyPrice = Open;
     

    // As it stands, the original statement says Sell whenever Close is not 
Zero.
    // You want to sell on the same day you bought.
    Sell = Buy;


    // You might mean SellPrice = Close?
    SellPrice = Close;
     
    AddColumn(PositionScore,"score"); //lets me see the score values in an 
exploration
     

    // if anyone could advise on the above idea i would appreciate the help,,,


     


    //////////////////////////////////////////////////////



    On Mon, Sep 22, 2008 at 4:04 AM, Paul Radge <[EMAIL PROTECTED]> wrote:


      Hi all,
               i recently read a few posts here in the forum and learnt about 
the function "positionscore".As a non programer i find the forum very usefull.

       From those posts i've tried to follow a similar line and test a day 
trading system,,,like many of my ideas and notions though it may bare no cash 
flow.

      What i tried to do was look for a break out and then buy the open next 
day and sell the close as a true day trade no money down.Here's what i attempted

      //Day Trade
      positionscore = ROC(c,1) / ROC(C,10); //looking for a big move compared 
to the last 2 weeks

      Filter = Positionscore and Close > Open; //looking for the biggest move 
on an up day.

      Buy = Filter;
      Buyprice = Open;

      Sell = close;

      settradedelays = (1,0,0,0); // Explore today trade tomorrow (?)
      positionsize = 5000;

      addcolumn(positionscore,"score"); //lets me see the score values in an 
exploration

      //I've got maxtrades set to 1 within settings 

      When i explore from 18/9/08 to 18/9/08 i get stock abc.asx for example 
but when i backtest from 19/9/08 to 19/9/08 i'm not getting the same ticker 
that i expected to see traded with the Buy delay set to 1.

       If anyone could advise on the above idea i would appreciate the help,,,

      i also tried this with no luck,,,,,,,,,,,

      positionscore = ROC(C,1) / ROC(C,10);

      cond1 = c > o;

      longsetup = postionscore and cond1;

      filter = ref(longsetup,-1);

      buy = filter ;
      buyprice = open;
      sell = close;

      settradedelays = (0,0,0,0);
      positionsize = 5000;

      addcolumn(positionscore,"score");





   

Reply via email to