Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

OCO entry orders

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

    OCO entry orders

    i want to put a long and short entry order at the high and low of a minute bar.
    What do i need to put in the code so that the entry orders are OCO

    if ( condition)

    {
    EnterLongStopLimit(.....High[0])
    EnterShortstopLimit(....Low[0])
    }

    #2
    Hello fiddy,

    Thanks for your post.

    This would not be possible in the "managed approach". Please see: http://ninjatrader.com/support/helpG...d_approach.htm specifically the section titled: "Internal Order Handling Rules that Reduce Unwanted Positions"

    To accomplish your goals you would need to use the Unmanaged approach keeping in mind that many of the protection layers of the Managed approach are not in place and would be your responsibility to account for. http://ninjatrader.com/support/helpG...d_approach.htm

    Comment


      #3
      Hi Paul

      Under the managed approached, can you submit both orders and then the one that isnt filled is cancelled .... or is it impossible to submit both orders?

      if ( condition)

      {
      EnterLongStopLimit(.....High[0])
      EnterShortstopLimit(....Low[0])
      }

      Comment


        #4
        Hello fiddy,

        Thanks for your reply.

        In the managed approach, according to the helpguide link previously provided shows that in the "Internal Order Handling Rules that Reduce Unwanted Positions" you will find under, "Methods that generate orders to enter a position will be ignored if:" ...
        • The strategy position is flat and an order submitted by an enter method (EnterLongLimit() for example) is active and the order is used to open a position in the opposite direction


        So that is saying that your strategy will enter the first order (Long) and then ignore the second order as it meets the criteria of, "is used to open a position in the opposite direction"

        You can of course verify this with a test using your sim101 account.

        Alternatively you could try something like:

        if (your condition to enter long or short)
        {
        if (Close[0] > High[1])
        {
        // enter long order here
        }
        if (Close[0] < Low[1])
        {
        // enter short order here
        }
        }

        In the above example you would only enter one way or the other based on your logic rather than than parking orders on either side.

        Comment

        Latest Posts

        Collapse

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