Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Comparing orders does not work?

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

    Comparing orders does not work?

    In a strategy, starting from flat. i generate one order (unmanaged using SubmitOrder).
    On order updates and executions I use the == operator to compare orders (remember - I only have one so far)

    The comparison sometimes fails, even though the execution is positively for the order submitted. Following is the ToString() result for both orders (one from the parameter of OnOrderUpdate() and the other is the variable I previously stored on entry:

    Argument:
    Order='705e20ac8a5e40b4aefd10a52fbbbb8d/Sim02' Name='enter short HAL (Sim02)' State=Filled Instrument='HAL' Action=SellShort Limit price=0 Stop price=0 Quantity=2,600 Type=Market Tif=Day OverFill=False Oco='' Filled=2600 Fill price=38.1146153846154 Token='705e20ac8a5e40b4aefd10a52fbbbb8d' Gtd='1/1/0001 12:00:00 AM'

    Variable:
    Order='35f176909fed4d60aa032fe04ae626c4/Sim02' Name='enter short HAL (Sim02)' State=PendingSubmit Instrument='HAL' Action=SellShort Limit price=0 Stop price=0 Quantity=2,600 Strategy='MyTrendFollower1' Type=Market Tif=Day Oco='' Filled=0 Fill price=0 Token='35f176909fed4d60aa032fe04ae626c4' Gtd='12/1/2099 12:00:00 AM' @ 2/22/2012 8:41:12 AM

    I expected argument==variable to be true (as the documentation indicates), but it is false.

    What am I doing wrong?

    #2
    Hello,

    Thanks for the note.

    This was something we found in our own sample and resolved in our latest release. What is the version of NinjaTrader you are using? If not .9 please update and it should resolve the issue.

    -Brett
    BrettNinjaTrader Product Management

    Comment


      #3
      NT version 7.0.1000.9
      .NET/CLR Version: 2.0.50727.4963

      Apparently not fully resolved...

      Comment


        #4
        Hello,

        This could be a different issue as well.

        Can you please send me your code sample you are testing this with so I can make sure to get exact scenario into development to [email protected] so that I can get this sent in.

        The case that was fixed in .8 had to do with stop loss and profit targets, this looks like an entry order its possible there is something different there.

        -Brett
        BrettNinjaTrader Product Management

        Comment


          #5
          This would be hard as the code is quite complex. I'll have to cook up a simpler strategy and replicate this. I don't have time for that in this very moment.

          Note another symptom: it seems that sometimes I get some executions drawn on the chart, but if I manually intervene (e.g. disable the strategy and then press Close in the SuperDOM) then the executions go away along with any drawing objects that the strategy drew on the chart.

          Comment


            #6
            Hello,

            I might suggest using this sample. I tested this sample and it works, specifically the part where we check for Order Object equality to add the order to a List.



            As far as your second question this is expected, as the chart has two execution display modes. One when a strategy is enabled which will show only the strategy executions (historical and live) and a second mode which will only display execution markers for the account that is selected in the chart trade panel.

            -Brett
            BrettNinjaTrader Product Management

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            666 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            376 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            110 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            575 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            580 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X