• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

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.

                        http://www.ninjatrader-support.com/H...ncelOrder.html
                        BertrandNinjaTrader Customer Service

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by Captain_Qwark, Today, 10:55 AM
                        2 responses
                        14 views
                        0 likes
                        Last Post Captain_Qwark  
                        Started by kmpc1, Today, 11:03 AM
                        1 response
                        10 views
                        0 likes
                        Last Post NinjaTrader_PatrickG  
                        Started by jransom, Today, 09:08 AM
                        1 response
                        16 views
                        0 likes
                        Last Post NinjaTrader_Kate  
                        Started by mtamaku, Today, 09:19 AM
                        0 responses
                        21 views
                        0 likes
                        Last Post mtamaku
                        by mtamaku
                         
                        Started by traderMNQ, Today, 09:00 AM
                        4 responses
                        19 views
                        0 likes
                        Last Post traderMNQ  
                        Working...
                        X