Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Bug in Performance.AllTrades?

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

    Bug in Performance.AllTrades?

    Hi guys,

    When I access Performance.AllTrades[ myIndex ].Entry.Price, the actual price returned seems incorrect. First of all, it does not tally with the corresponding prices shown in the Strategy Analyzer. The prices moreover are impossible - as they are not integral multiples of the tick size. They are however, within less than half a tick of the correct execution price.
    There is no such problem with Exit.Price - all the prices correspond exactly with what I am seeing in the Strategy Analyzer and are integral multiples of the tick size.

    I presume this is a bug.

    regards

    #2
    Could you please provide detailed on how to reproduce what you experienced? Thanks

    Comment


      #3
      if( Performance.AllTrades.Count > tradeCount )
      {
      lastTrade = Performance.AllTrades[ tradeCount++ ];
      entryTrade = lastTrade.Entry;
      exitTrade = lastTrade.Exit;
      sw.WriteLine(
      entryTrade.Instrument + ";" +
      entryTrade.Time +";" +
      entryTrade.MarketPosition +";" +
      entryTrade.Quantity +";" +
      entryTrade.Price +";" +
      exitTrade.Time +";" +
      exitTrade.MarketPosition +";" +
      exitTrade.Quantity +";" +
      exitTrade.Price +";" +
      );
      }

      entryTrade and exitTrade have been properly declared as of type IExecution.
      sw is a StreamWriter I opened earlier.
      The output produced is 100% correct apart from entryTrade.Price as mentioned in my earlier post.

      The strategy I am running is on ES 06-08, using 1 hours' worth of minute data.

      Here is the output produced by the above code;

      ES 06-08 Globex;28/04/2008 09:18:00;Long;1;1400.81666666667;28/04/2008 09:18:00;Short;1;1400
      ES 06-08 Globex;28/04/2008 09:31:00;Short;1;1400.13333333333;28/04/2008 09:33:00;Long;1;1400.5
      ES 06-08 Globex;28/04/2008 09:34:00;Short;1;1401.425;28/04/2008 09:35:00;Long;1;1402.5
      ES 06-08 Globex;28/04/2008 09:42:00;Long;1;1401.665;28/04/2008 09:45:00;Short;1;1401.5
      ES 06-08 Globex;28/04/2008 09:52:00;Long;1;1400.31666666667;28/04/2008 09:52:00;Short;1;1399.75
      ES 06-08 Globex;28/04/2008 09:56:00;Short;1;1400.65;28/04/2008 09:56:00;Long;1;1401.25

      Here is the corresponding output from the Trades tab of the Strategy Analyzer;

      Trade-#,Instrument,Account,Strategy,Market pos.,Quantity,Entry price,Exit price,Entry time,Exit time,Entry name,Exit name,Profit,Cum. profit,Commission,MAE,MFE,ETD,Bars,
      1,ES 06-08,Back101,Methodv0x1,Long,1,1400.75,1400.00,28/04/2008 09:18:00,28/04/2008 09:18:00,DRES_E_BUY_16,Stop loss,-0.06%,-0.06%,0.00,0.06%,0.00%,0.00%,1,
      2,ES 06-08,Back101,Methodv0x1,Short,1,1400.25,1400.50,28/04/2008 09:31:00,28/04/2008 09:33:00,DRES_E_SELL_29,DRES_DEACT_BUY_31,-0.03%,-0.08%,0.00,0.04%,0.05%,0.07%,3,
      3,ES 06-08,Back101,Methodv0x1,Short,1,1401.50,1402.50,28/04/2008 09:34:00,28/04/2008 09:35:00,DRES_E_SELL_32,Stop loss,-0.08%,-0.16%,0.00,0.08%,0.01%,0.09%,2,
      4,ES 06-08,Back101,Methodv0x1,Long,1,1401.75,1401.50,28/04/2008 09:42:00,28/04/2008 09:45:00,DRES_E_BUY_40,DRES_DEACT_SELL_43,-0.01%,-0.17%,0.00,0.03%,0.04%,0.05%,4,
      5,ES 06-08,Back101,Methodv0x1,Long,1,1400.25,1399.75,28/04/2008 09:52:00,28/04/2008 09:52:00,DRES_E_BUY_50,Stop loss,-0.04%,-0.21%,0.00,0.04%,0.00%,0.00%,1,
      6,ES 06-08,Back101,Methodv0x1,Short,1,1400.75,1401.25,28/04/2008 09:56:00,28/04/2008 09:56:00,DRES_E_SELL_54,Stop loss,-0.04%,-0.26%,0.00,0.04%,0.00%,0.00%,1,

      As you can see, the entry prices are out by less than half a tick (a tick is 0.25 for this contract).

      Hope this helps,

      regards

      Comment


        #4
        Trade prices on SA are rounded to tick size your print out is not.

        a) to resolve you would need to code something like
        Code:
        entryTrade.Instrument.MasterInstrument.Round2TickSize(entryTrade.Price)
        b) curious: I suspect your strategy sets odd stop/limit prices, correct?

        Comment


          #5
          a) Yes, I have since compensated for this by rounding to tick size.

          b) Yes, you are correct, my strategy as is generates non-rounded stops and limits but orders are still submitted rounded by NT.

          thanks for looking at this,

          regards

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by frankthearm, Today, 09:08 AM
          8 responses
          31 views
          0 likes
          Last Post frankthearm  
          Started by NRITV, Today, 01:15 PM
          2 responses
          9 views
          0 likes
          Last Post NRITV
          by NRITV
           
          Started by maybeimnotrader, Yesterday, 05:46 PM
          5 responses
          26 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by quantismo, Yesterday, 05:13 PM
          2 responses
          20 views
          0 likes
          Last Post quantismo  
          Started by adeelshahzad, Today, 03:54 AM
          5 responses
          33 views
          0 likes
          Last Post NinjaTrader_BrandonH  
          Working...
          X