Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Fill simulator is called several times

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

    Fill simulator is called several times

    While working towards a more accurate fill simulator, I've noticed that the Fill() method is often called more than once for the same order on the same bar. Why is that? Is there some way to distinguish between the calls?

    Thanks,
    Boaz

    #2
    Boaz, I will have someone get back to you tomorrow.
    AustinNinjaTrader Customer Service

    Comment


      #3
      Hello,

      Thanks for your patience.

      This feature is not supported therefor I'm very limited in resources to assist here.

      However I can try to point in right direction.

      Can you please print out information about the Order object that is passed in with the fill.

      I look forward to assisting you further.

      Comment


        #4
        Hi Brett,
        below is a printout of two such consecutive calls. As you can see, it is the exact same order:

        04/01/2008 11:30:00 Order='NT-00000/Backtest' Name='Entry' State=Working Instrument='6E 12-11' Action=SellShort Limit price=1.4794 Stop price=0 Quantity=1 Strategy='Tomcat' Type=Limit Tif=Gtc Oco='' Filled=0 Fill price=0 Token='1c875be10d554c35a0dbded47deb7ca2' Gtd='01/12/2099 00:00:00'
        04/01/2008 11:30:00 Order='NT-00000/Backtest' Name='Entry' State=Working Instrument='6E 12-11' Action=SellShort Limit price=1.4794 Stop price=0 Quantity=1 Strategy='Tomcat' Type=Limit Tif=Gtc Oco='' Filled=0 Fill price=0 Token='1c875be10d554c35a0dbded47deb7ca2' Gtd='01/12/2099 00:00:00'
        (Sorry about the clutter)

        Some more info:
        • When I run a simple strategy generated by the wizard, I don't see this happening.
        • I've created a base class which inherits from the Strategy class, and my strategy inherits from it.
        • Even when I transform the auto-generated strategy to inherit from my class, the above does not happen.

        Comment


          #5
          Hi Brett,

          After some digging, I found that this is a multi-timeframe issue, i.e. the Fill method is called for each bar period I add int the Initialize() method, thus for bars which match multiple time frames, the Fill() method will be called multiple times.

          What I find surprising is that this is the case, even though I only place orders in the main time frame, as my OnBarUpdate() method looks like this:

          Code:
          protected override void OnBarUpdate()
          {            
              if (BarsInProgress != 0)
                  return;
              ...
          }
          So in the Fill() method, the Strategy.BarsInProgress is always 0, even when it was called before for the same bar. So my update question is:
          How can I distinguish between repetitive calls for the same order on the same bar?

          Thanks,
          Boaz

          Comment


            #6
            Hello,

            This is expected with current design.

            No real way that I'm aware of to tell what fill is for what bar series.

            However you will simply get the fill call for all associated BarsInProgress.

            Let me know if I can be of further assistance.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by junkone, Today, 11:37 AM
            1 response
            9 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by frankthearm, Yesterday, 09:08 AM
            11 responses
            41 views
            0 likes
            Last Post frankthearm  
            Started by quantismo, 04-17-2024, 05:13 PM
            5 responses
            35 views
            0 likes
            Last Post NinjaTrader_Gaby  
            Started by proptrade13, Today, 11:06 AM
            1 response
            6 views
            0 likes
            Last Post NinjaTrader_Clayton  
            Started by love2code2trade, 04-17-2024, 01:45 PM
            4 responses
            34 views
            0 likes
            Last Post love2code2trade  
            Working...
            X