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

ShortStop and ShortLimit at the same time

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

    ShortStop and ShortLimit at the same time

    hey guys

    in my very simple strategy i just want to place a shortstop and a shortlimit order at the same time

    like this:

    EnterShortLimit(entryLevel+20*TickSize,"Shortlimit ");
    EnterShortStop(entryLevel-20*TickSize,"Shortstop");

    sadly the strategy only places the first Order
    any help?

    regards, Deorn

    #2
    Deorn, thanks for the post - this would be unfortunately expected in the managed mode as this approach with competing orders would be caught by the Internal Order Handling Rules -

    http://www.ninjatrader.com/support/h...d_approach.htm (bottom section here).

    For more flexibility we have the Unmanaged mode as well in NT7, where those 'guards' would not be effective - http://www.ninjatrader.com/support/h...d_approach.htm

    Yet another approach would be monitoring price and only submitting one order in managed mode then as needed.
    BertrandNinjaTrader Customer Service

    Comment


      #3
      thanks for your response Bertrand

      sadly it still doesnt place the second order




      Code:
      protected override void Initialize()
      {
      
           CalculateOnBarClose = false;
          Unmanaged = true;
      }
      
      protected override void OnBarUpdate()
      {
          // Entries
      			SubmitOrder(0,OrderAction.Sell,OrderType.Limit,1,entryLevel+50*TickSize,0,"ocoshort","s1");
      			SubmitOrder(0,OrderAction.Sell,OrderType.Stop,1,entryLevel-50*TickSize,0,"ocoshort","s2");
      
      }
      please help
      i want that both orders are placed on the chart

      redards, deorn
      Last edited by Deorn; 03-11-2013, 03:35 AM.

      Comment


        #4
        I would suggest you check via the TraceOrders what exactly is happening on the hood with your order submission - http://www.ninjatrader.com/support/f...ead.php?t=3627

        Wouldn't the first order fill pretty much instantly and then cancel the second as they are OCO?
        BertrandNinjaTrader Customer Service

        Comment


          #5
          giving them different ocoid doesnt fix the problem

          the traceorders command gives me this

          Code:
          08.03.2013 08:02:04 Entered internal SubmitOrder() method at 08.03.2013 08:02:04: Action=Sell OrderType=Limit Quantity=1 LimitPrice=7980,0 StopPrice=0 OcoId='ocoshort' Name='s1'
          08.03.2013 08:02:04 Entered internal SubmitOrder() method at 08.03.2013 08:02:04: Action=Sell OrderType=Stop Quantity=1 LimitPrice=7930,0 StopPrice=0 OcoId='ocoshort1' Name='s2'
          but i only see the limit order (the first order) been placed on a different fdax chart where the charttrader is enabled
          it also makes no difference if there is a open position in the fdax or not

          Comment


            #6
            Right, they are both submitted - but one would fill instantly, as you place it as marktable limit order, not a StopLimit / Stop order.

            Wouldn't the script show a strategy position then for you, with the one remaining stop order placed?
            BertrandNinjaTrader Customer Service

            Comment


              #7
              can you write me the solution please

              Comment


                #8
                I guess I'm not exactly clear what you're trying to achieve - bracket the market with a limit order above the market to sell and below the market to buy?
                BertrandNinjaTrader Customer Service

                Comment


                  #9
                  no i just want to achieve a OCO TP and SL Order for a already opened long position

                  Comment


                    #10
                    Ok, then I would suggest not using the unmanaged mode, but just either working via :

                    1. The Set() methods (the generated stop / targets would be OCO'ed per se) -



                    2. Use the Exit() methods to submit your Limit target and Stop exit order, like shown here -

                    The OnOrderUpdate() and OnExecution() methods are reserved for experienced programmers. Instead of using Set() methods to submit stop-loss and profit target orders, you can submit and update them manually through the use of IOrder and IExecution objects in the OnOrderUpdate() and OnExecution() methods. The OnOrderUpdate()
                    BertrandNinjaTrader Customer Service

                    Comment


                      #11
                      thanks but that does not display the opened sl and tp orders onto the other chart where the charttrader is enabled, and I need that

                      my scenario is like that:
                      i have manually opened a long position, then I manually delete the inital sl and tp, start the ninja strategy, which put the sl and tp for the long position on the chart
                      and I want to see these two orders

                      I hope you understand that

                      Comment


                        #12
                        Thanks, but this would unfortunately not be possible with a NinjaScript strategy in general, if you had ChartTrader enabled. NinjaScripts are run as self contained instances managing the entry and exit conditions as programmed in your code.

                        If you wanted to manually adjust resulting orders, then you could for example call ATM Strategy Templates for exit management - however then the entry would have to come from the script as well.
                        BertrandNinjaTrader Customer Service

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by ScottWalsh, Today, 04:29 PM
                        0 responses
                        4 views
                        0 likes
                        Last Post ScottWalsh  
                        Started by rtwave, 04-12-2024, 09:30 AM
                        2 responses
                        21 views
                        0 likes
                        Last Post rtwave
                        by rtwave
                         
                        Started by tsantospinto, 04-12-2024, 07:04 PM
                        5 responses
                        69 views
                        0 likes
                        Last Post tsantospinto  
                        Started by cre8able, Today, 03:20 PM
                        0 responses
                        7 views
                        0 likes
                        Last Post cre8able  
                        Started by Fran888, 02-16-2024, 10:48 AM
                        3 responses
                        49 views
                        0 likes
                        Last Post Sam2515
                        by Sam2515
                         
                        Working...
                        X