Announcement

Collapse
No announcement yet.

BackTesting Bug ?

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

  • BackTesting Bug ?

    I have the attached EFS code that does 2 buys (at 10:30 and 10:35) and then 2 sells (at 10:40 and 10:45), for one contract each.
    When run the Strategy Analyzer, however, it never does an exit for the 2nd sell.

    I ran this on YM #F, 1min charts.

    Can anyone explain to me what is wrong in this code that the 2nd lot is never getting sold? Or is there a problem with doing scale-out and scale-in's ?
    Attached Files

  • #2
    The code

    Here's the code, in case you can't read the attachment.. as you can see, it's VERY simple... No clue why that second sell is never executed.

    /*
    This program will buy 1 lot at 10:30 and another lot at 10:35.
    It will then sell one lot at 10:40 and then the 2nd lot at 10:45.
    */


    function preMain() {

    setComputeOnClose();
    }


    function main() {


    if (getHour()==10 && getMinute() == 30) {
    Strategy.doLong("FirstBUY", Strategy.LIMIT, Strategy.THISBAR, 1, open(0));
    }
    if (getHour()==10 && getMinute() == 35) {
    Strategy.doLong("FirstADD", Strategy.LIMIT, Strategy.THISBAR, 1, open(0));
    }
    if (getHour()==10 && getMinute() == 40) {
    Strategy.doSell("SellFirstLot", Strategy.LIMIT, Strategy.THISBAR, 1, open(0));
    }
    if (getHour()==10 && getMinute() == 45) {
    Strategy.doSell("Sell2ndLot", Strategy.LIMIT, Strategy.THISBAR, 1, open(0));
    }


    return ;
    }

    Comment


    • #3
      Hello f1sh7,

      This appears to be a bug in the Strategy Analyzer report. The code is actually doing what it is supposed to but the Strategy Analyzer report is not properly organizing the results. There isn't a work-around for this one as it's not a code problem. I'll report these finding to our development team.

      The specific issue is with strategies that scale into a position and out of the position. Strategies that perform scaling only on one side are reported properly in the Strategy Analyzer as expected. You can enter a position with one entry trade and then scale out with multiple exit trades. Or, you can scale into a position with multiple entry trades and close the position with a single exit trade.
      Jason K.
      Project Manager
      eSignal - an Interactive Data company

      EFS KnowledgeBase
      JavaScript for EFS Video Series
      EFS Beginner Tutorial Series
      EFS Glossary
      Custom EFS Development Policy

      New User Orientation

      Comment


      • #4
        Jason,

        Thnx for your reply... that's really too bad. I hope the fix for this comes soon!

        JOHN

        Comment

        Working...
        X