How to remove forward looking error from this basic BTST system

Discussion in 'AmiBroker' started by abcpankaj, Dec 30, 2011.

  1. abcpankaj

    abcpankaj Active Member

    Joined:
    Jul 24, 2008
    Messages:
    112
    Likes Received:
    97
    Trophy Points:
    28
    hi
    I was trying to test a very basic BTST system.
    it has a buy condition (say if 1 day ROC > 2%),then buy at today's CLOSE & sell tomorrows OPEN.

    BuyPrice = Close;
    SellPrice = Open;
    Buy=ROC(C,1)>2;
    sell = barssince(Buy)==1 ; works fine
    but when buy condition is true for many consecutive days , system do not sell the next day, But the day next to day buy was true last time.

    which makes it a forward looking system, hence useless.
    How can this be avoided.
    I tried exrem/Flip/for loop , but with little success, as of now.

    Thanks in advance.

    Best regards,
     
  2. colion

    colion Active Member

    Joined:
    Jun 26, 2007
    Messages:
    202
    Likes Received:
    108
    Trophy Points:
    43
    What is in the rest of the code? Do you have future looking functions such as zig-zag?
     
  3. abcpankaj

    abcpankaj Active Member

    Joined:
    Jul 24, 2008
    Messages:
    112
    Likes Received:
    97
    Trophy Points:
    28
    Thanks colion for your reply
    There is no other future looking functions in the system.

    The future looking part creeps in when original buy condition (ROC(C,1)>2)is true for many consecutive days .
    System do not sell next day if that days ROC(C,1)>2 {amibroker considers Buy as true for this day}
    But practically trader cannot know at the open if closing ROC will be greater than 2.
    AB keeps the position open for these days & shows profits for these days which trader will never get in real life , since he has already sold in the open.

    Best Regards,
     
  4. abcpankaj

    abcpankaj Active Member

    Joined:
    Jul 24, 2008
    Messages:
    112
    Likes Received:
    97
    Trophy Points:
    28
    any clues...
     
  5. rpc

    rpc Active Member

    Joined:
    Aug 19, 2005
    Messages:
    488
    Likes Received:
    38
    Trophy Points:
    28
    got confused between roc and ref functions
     
    Last edited: Jan 16, 2012
Loading...

Share This Page