Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Negative average time in market

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

    Negative average time in market

    Hi,
    how/why can NinjaTrader report a negative time for Average Time In Market? I've looked through the trades and found many that manage to exit prior to entry! This is with v31 of NT7.
    See pic attachments.

    Here is logging from the output window, which shows first the fill registering as 6:01PM (the first bar of the next session) with the trade's exit 10 hours earlier at 8:00AM (the last bar of this session). Ninja doesn't seem to like orders placed on the final bar of a session...

    Cheers,
    saltminer

    15/01/2016 8:00:00 AM on bip 2, short signal, current position is Flat
    15/01/2016 6:01:00 PM * OnExecution() : Execution='NT-01093' Instrument='FDAX ##-##' Account='Backtest' Name='SE1' Exchange=Default Price=9786 Quantity=1 Market position=Short Commission=0 Order='NT-01824' Time='15/01/2016 6:01:00 PM'

    etc, then

    15/01/2016 8:00:00 AM * OnExecution() : Execution='NT-01097' Instrument='FDAX ##-##' Account='Backtest' Name='Exit on close' Exchange=Default Price=9889.5 Quantity=2 Market position=Long Commission=0 Order='NT-01833' Time='15/01/2016 8:00:00 AM'
    Attached Files

    #2
    Hello saltminer,

    Thank you for writing in.

    Are you able to reproduce this behavior with the SampleMACrossOver strategy?

    Can you please provide a sample script duplicating this behavior so I may test on my end?
    Zachary G.NinjaTrader Customer Service

    Comment


      #3
      Hi,
      I'll bet you $100 that SampleMACrossover won't exhibit this behaviour. The strategy being used has multiple additional bar series, all of the same instrument but different BarsPeriods, and I think this would be at the root of the problem. Even so, I would expect the strategy should still work without these crazy executions. The loading of additional bar series is officially supported.
      In another thread I am reporting executions in OnExecution that are from the future. Perhaps this is a related behaviour from a problem regarding fills with multiple bar series.



      The particular strategy I am discussing is a large work belonging to a client, and I cannot send it to you, alas. But the culprit of this behaviour I reckon is the over-eager ExitOnClose combined with multiple bar series, and an order submission on the final bar of a session.

      Cheers,
      saltminer

      Comment


        #4
        Hello saltminer,

        Can you provide a sample script that can exhibit this behavior so we may test on our end? We do not need the actual script itself, just a sample that can reproduce the behavior.
        Zachary G.NinjaTrader Customer Service

        Comment


          #5
          Script illustrating the problem

          Here you go. There is an input for the time in HHMM which you should set to the end of the session. Run this on a 5 minute chart, on a future.

          Cheers,
          saltminer
          Attached Files

          Comment


            #6
            Hello saltminer,

            Thank you for your example script. I was able to reproduce this behavior on my end.

            Testing on my end, it looks like this behavior is not reproducible in NinjaTrader 8. NinjaTrader 8 prevents this from occurring. In fact, no entries are made due to end of session handling.

            Are you able to reproduce this behavior if you switch the "Exit on close" parameter to false? With this set to false, the behavior no longer occurs on my end.
            Zachary G.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by judysamnt7, 03-13-2023, 09:11 AM
            4 responses
            57 views
            0 likes
            Last Post DynamicTest  
            Started by ScottWalsh, Today, 06:52 PM
            4 responses
            36 views
            0 likes
            Last Post ScottWalsh  
            Started by olisav57, Today, 07:39 PM
            0 responses
            7 views
            0 likes
            Last Post olisav57  
            Started by trilliantrader, Today, 03:01 PM
            2 responses
            19 views
            0 likes
            Last Post helpwanted  
            Started by cre8able, Today, 07:24 PM
            0 responses
            9 views
            0 likes
            Last Post cre8able  
            Working...
            X