Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

OCO From Strategy to Stratgey

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

    OCO From Strategy to Stratgey

    Hi all...

    I have two strategies running on the same chart. One puts in a sell limit at xPM, and the other puts in a buy limit at xPM.

    Is there anyway to have the sell and buy order from each strategy populate the "OCO" (order cancels order) field. This way, whichever strategy executes first (say... long) will cancel the other (short)?

    Brian

    #2
    Originally posted by heyligerb View Post
    Hi all...

    I have two strategies running on the same chart. One puts in a sell limit at xPM, and the other puts in a buy limit at xPM.

    Is there anyway to have the sell and buy order from each strategy populate the "OCO" (order cancels order) field. This way, whichever strategy executes first (say... long) will cancel the other (short)?

    Brian
    Hi Brian,

    Thank you for your post.

    Yes, please see the example below.

    BreakOut/FadeEntry:
    In order to do this you need to right click in the DOM and enable 'OCO Order' and do the following:
    - Select or set up your ATM Strategy
    - Submit Buy Stop order above the market
    - Re-select or change the ATM Strategy
    - Submit Sell Stop order below the market
    - After one of the orders is filled, disable 'OCO Order' via the right click menu

    Review OCO orders here: http://www.ninjatrader-support.com/H...ingOrders.html
    Ray S.NinjaTrader Customer Service

    Comment


      #3
      Oh... I'm sorry I wasn't clear. These are Ninja Script Strategies, not he ATM Strategies...

      I'm trying to accomplish this in Ninja Script.

      Brian

      Comment


        #4
        Unfortunately you CANNOT enter a long and short order at the same time using NinjaScript.
        Ray S.NinjaTrader Customer Service

        Comment


          #5
          Yea, you can, I've done it. It works fine. I'm not entering an buy/sell at the same limit price, it's a bracketed order. The logic is buy at 5 or sell at 10. Whichever comes first.

          So... all I have left to do, in order to complete my strategy, is have the "one order cancel other." I'm just not sure how to program that into the strategy, and I'm looking for pointers.

          Thanks,

          Brian

          Comment


            #6
            Brian,

            You cannot place a EnterLongLimit/Stop and EnterShortLimit/Stop orders simultaneously even at different prices on the same instrument from the same strategy.
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              Right, that is why I said in I have "two strategies running on the same chart."

              Is there a way to get fill in the OCO for those orders?

              Brian

              Comment


                #8
                Brian,

                Cross strategy communication is not supported. You can try searching the forums for global variables, but we do not support this technique.
                Josh P.NinjaTrader Customer Service

                Comment


                  #9
                  Thanks Josh. I appreciate the pointer. One question...

                  Is this not supported b/c the software has yet to reach the level of sophistication required to do this properly, or is there some other reason that could be detrimental to my wealth? :-)

                  Regards,

                  Brian

                  Comment


                    #10
                    Hi Brian, community members have been using the Global variable concept with success as it is also supported by C#. Josh just meant we can't offer coding support for it.
                    BertrandNinjaTrader Customer Service

                    Comment


                      #11
                      Actually, I don't even need to use a variable. This trade will only execute once per day, so I can program the same static string for the OCO in each strategy, and which ever order gets filled first will cancel the other. That is all I'm looking to accomplish.

                      That would be no different than entering the bracketed order though the Control Center manually.

                      But I don't even see anywhere in the NinjaScript reference where you can populate OCO when placing limit orders... or any orders for that matter. Perhaps I'm looking for the wrong thing?

                      Comment


                        #12
                        You could use IOrder - http://www.ninjatrader-support.com/H...V6/IOrder.html

                        and check the order states of your orders, when one of them reports filled just use CancelOrder() for the other one.

                        BertrandNinjaTrader Customer Service

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by adeelshahzad, Today, 03:54 AM
                        4 responses
                        25 views
                        0 likes
                        Last Post adeelshahzad  
                        Started by merzo, 06-25-2023, 02:19 AM
                        10 responses
                        823 views
                        1 like
                        Last Post NinjaTrader_ChristopherJ  
                        Started by frankthearm, Today, 09:08 AM
                        5 responses
                        17 views
                        0 likes
                        Last Post NinjaTrader_Clayton  
                        Started by jeronymite, 04-12-2024, 04:26 PM
                        3 responses
                        43 views
                        0 likes
                        Last Post jeronymite  
                        Started by yertle, Today, 08:38 AM
                        5 responses
                        16 views
                        0 likes
                        Last Post NinjaTrader_BrandonH  
                        Working...
                        X