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 cmtjoancolmenero, Yesterday, 03:58 PM
        9 responses
        36 views
        0 likes
        Last Post cmtjoancolmenero  
        Started by DayTradingDEMON, Today, 09:28 AM
        4 responses
        23 views
        0 likes
        Last Post DayTradingDEMON  
        Started by geddyisodin, Yesterday, 05:20 AM
        9 responses
        50 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by George21, Today, 10:07 AM
        1 response
        15 views
        0 likes
        Last Post NinjaTrader_ChristopherJ  
        Started by Stanfillirenfro, Today, 07:23 AM
        9 responses
        24 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Working...
        X