Announcement

Collapse
No announcement yet.

Back Testing

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Back Testing

    this strategy goes long when price crosses above LSMA
    and should go to cash when price drops below LSMA.
    it only makes a single trade. eg. for NOV, entry is 1/4/10 and
    never exits, but runs to current date.

    if ( close() > LSMA_Array[0] ) {
    Strategy.doLong ("Long", Strategy.CLOSE, Strategy.THSBAR);

    }else{
    Strategy.doSell("Cash", Strategy.CLOSE,Strategy.THISBAR);
    }
    can anyone advise me where i'm going wrong?
    thanks,
    peter.

  • #2
    Re: Back Testing

    peter
    THSBAR in your Strategy.doLong() call should be THISBAR
    Alex


    Originally posted by peterjerome
    this strategy goes long when price crosses above LSMA
    and should go to cash when price drops below LSMA.
    it only makes a single trade. eg. for NOV, entry is 1/4/10 and
    never exits, but runs to current date.

    if ( close() > LSMA_Array[0] ) {
    Strategy.doLong ("Long", Strategy.CLOSE, Strategy.THSBAR);

    }else{
    Strategy.doSell("Cash", Strategy.CLOSE,Strategy.THISBAR);
    }
    can anyone advise me where i'm going wrong?
    thanks,
    peter.

    Comment

    Working...
    X