Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Unmanaged Null Problem

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

    Unmanaged Null Problem

    I am trying to reset my iorder variable back to null after an entrance has been filled so additional orders can be executed without 10's of submit orders being placed. Here is the simple code i am working with and i am getting an Object Ref Not Set...I read through the tips on this but i must be missing something.

    if (Position.MarketPosition == MarketPosition.Flat
    && d1SeriesClose[0] > d1SeriesClose[1]
    && entryOrder == null )
    {

    entryOrder = SubmitOrder(0,OrderAction.Buy,OrderType.Limit,Defa ultQuantity,GetCurrentBid(),0,"oco1", "LE1");
    entry1=GetCurrentBid();

    }

    if (entryOrder != null && entryOrder.OrderState == OrderState.Filled)
    {
    entryOrder = null;
    }

    #2
    Where are you doing the reset then exactly? In the OnExecution() after the execution is received from the entry submitted?

    Comment


      #3
      Thats a good question, right now the code is under the Onbarupdate, i looked at OnExecution, is that where i should be working with this type of unmanaged entrance.

      My system is simple. This is a long only system, the reason i switched to unmanaged is my exits are complex. Long Entrance 1 contract, Exit 1 contract. With Only one entrance at a time, i dont want 2 entrance orders active at the same time in case they both fill.

      Thanks for all your help.....

      Comment


        #4
        Yes, unmanaged will provide you more flexibility as the order handling rules are not effective here - you would submit the entry on your indicator condition in the OnBarUpdate(), the first feedback of the fill you get is seen in the OnExecution(), thus you would then nullify the IOrder object handling the entry here if the fillstate is confirmed to have changed - you review a full sample of working with OnOrderUpdate() and OnExecution() here - http://www.ninjatrader.com/support/f...ead.php?t=7499

        Comment


          #5
          Is there a sample strategy that shows unmanaged exits along with the onexecution method?

          I have coded this up and i can debug myself but i was wondering if there was a sample to work from?

          Thanks,

          Comment


            #6
            Unfortunately there's no such sample available, for working in OnExecution() the sample I gave you is as relevant for managed as it is for the unmanaged mode.

            Comment


              #7
              Ok, thanks for all your help. This is helping a lot.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
              0 responses
              648 views
              0 likes
              Last Post Geovanny Suaza  
              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
              0 responses
              369 views
              1 like
              Last Post Geovanny Suaza  
              Started by Mindset, 02-09-2026, 11:44 AM
              0 responses
              108 views
              0 likes
              Last Post Mindset
              by Mindset
               
              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
              0 responses
              572 views
              1 like
              Last Post Geovanny Suaza  
              Started by RFrosty, 01-28-2026, 06:49 PM
              0 responses
              573 views
              1 like
              Last Post RFrosty
              by RFrosty
               
              Working...
              X