Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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
    Paul H.NinjaTrader Customer Service

    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.
        Paul H.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Rapine Heihei, 04-23-2024, 07:51 PM
        2 responses
        30 views
        0 likes
        Last Post Max238
        by Max238
         
        Started by Shansen, 08-30-2019, 10:18 PM
        24 responses
        943 views
        0 likes
        Last Post spwizard  
        Started by Max238, Today, 01:28 AM
        0 responses
        9 views
        0 likes
        Last Post Max238
        by Max238
         
        Started by rocketman7, Today, 01:00 AM
        0 responses
        4 views
        0 likes
        Last Post rocketman7  
        Started by wzgy0920, 04-20-2024, 06:09 PM
        2 responses
        28 views
        0 likes
        Last Post wzgy0920  
        Working...
        X