Announcement

Collapse
No announcement yet.

Fill Type Constants in BackTesting formula

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

  • Fill Type Constants in BackTesting formula

    I'm referring to BTMovingAverage.efs

    Strategy.CLOSE – uses the closing price as the fill price.
    Strategy.MARKET – uses the open price as the fill price.

    Can it be made possible to use the MA value as the fill price?

    I tried to add 3 Cents to the open price when open a long, and subtracting 3 Cents when open a short position, like:

    if(close() >= v) {
    if(!Strategy.isLong()) {
    Strategy.doLong("Crossing Up", Strategy.MARKET+0.03, Strategy.THISBAR);
    }

    } else {
    if(!Strategy.isShort()) {
    Strategy.doShort("Crossing Down", Strategy.MARKET-0.03, Strategy.THISBAR);
    }
    }

    It didn't work.
    Is there another way to modifiy the fill price?

    Thanks for suggestions.

  • #2
    Linus
    You may want to try using

    Strategy.doLong("Crossing Up", Strategy.LIMIT, Strategy.THISBAR,null,v);

    and

    Strategy.doShort("Crossing Down", Strategy.LIMIT, Strategy.THISBAR,null,v);

    If I run the backtest this way the fills are at the corresponding MA values.
    Using Strategy.LIMIT should ensure that prices actually traded at the MA in case of gap on the Open of the bar.

    Alex
    Last edited by ACM; 02-15-2003, 08:37 AM.

    Comment

    Working...
    X