Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Unamanged Orders basics

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

    Unamanged Orders basics

    Using this example.
    https://ninjatrader.com/support/foru...roach-examples
    How can we do the opposite of what this is doing. This example places stops at the high and longs at the low. I would like to place the opposite of what it's doing , a Long at the Top of price and a Short at the bottom.

    I'm not sure how to change this line to make it place a long 10 ticks above current high:

    if (shortEntry == null)

    SubmitOrderUnmanaged(0, OrderAction.SellShort, OrderType.Limit, 100, High[0]+EntryDistance*TickSize, 0, oco, "Short limit entry");​

    Thanks!​

    #2
    Hello r3n3v,

    When using the unmanaged approach you would specify the order details in the SubmitOrderUnmanaged method. The code you copied is a sell short limit orer and the price being used is calculated by the High[0]+EntryDistance*TickSize

    To submit different types of orders you would need to change SellShort to whatever order type you wanted and then also change Limit if you are trying to submit a different type of order.

    To change the price you can specify different variables or do different math such as subtracting from the price. To place it above the high you can use the existing price logic that you have shown, you would just adjust EntryDistance to 10. That logic is already offsetting by a number of ticks from the High series.



    Comment


      #3
      I thought it was that simple but that doesn't work. It submits the order right away.

      Comment


        #4
        Hello r3n3v,

        To submit different kinds of orders you would update the SubmitOrderUnmanaged to the values you wanted. You would then have to verify the other logic being used is what you had intended to do and is working as expected.

        The targets and stops in that script are controlled in OnExecutionUpdate so you would need to go through the OnExecutionUpdate code and make the edits you wanted in relation to the targets. The code you had originally posted is part of the entry order logic, that submits two entry orders and then cancels whichever did not fill. After one of the entries fills then different parts of the logic in OnExecutionUpdate are called depending on which entry had filled.

        Comment


          #5
          I'm not trying to submit different orders. All I'm trying to do is submit an unmanaged long order at a certain distance above price that's it.

          SubmitOrderUnmanaged(0, OrderAction.Buy, OrderType.Limit, 1, High[0]+10*TickSize,0, oco, "Long limit entry");

          Using this line. It submits like a market order.


          Comment


            #6
            Hello r3n3v,

            The script already does that with the prices used with the orders. If you wanted to use a different price then you would change the price that the SubmitOrderUnmanaged is using. If you are editing the entries then it has an existing input called EntryDistance which you can change to change the distance those entries are submitted from the series programmed in their code.

            For the entries doing the opposite for pricing wouldn't make sense, the orders would fill immediately. A long entry needs to be lower than the current price so it works until the price hits the order price. A short order needs to be above the current price to work before being filled.



            Code:
            SubmitOrderUnmanaged(0, OrderAction.SellShort, OrderType.Limit, 100, High[0]+EntryDistance*TickSize, 0, oco, "Short limit entry");
            SubmitOrderUnmanaged(0, OrderAction.Buy, OrderType.Limit, 100, Low[0]-EntryDistance*TickSize, 0, oco, "Long limit entry");
            ​
            The existing orders are submitting below the Low for the long and above the high for the short which would make sense based on the entry direction for each order.

            Comment


              #7
              So I can't submit this using unmanaged orders?

              (I know this is for managed.)

              EnterLongStopMarket( InitialLotSize, Open[0] + 100 *A * TickSize , "Open Long");

              Comment


                #8
                Hello r3n3v,

                By "reversing" the prices for the existing limit orders you are putting the orders on the wrong side of the market.

                There is nothing you could do to reverse the prices for the limit orders the sample uses because a long Limit order needs to be below the current price so it doesn't fill immediately and the short Limit order needs to be above the price so it does not fill immediately.

                You can submit any other order types that you want but the pricing needs to make sense for the type of order you use. To change the order type you would update the values in SubmitOrderUnmanaged() to reflect the type of order you wanted to submit. You could submit a stop market order if you wanted but the price used needs to be on the correct side of the market for that type of order.

                If you are unsure on which type of order can be used above or below market price an easy way to tell is to use a chart and the chart trader. Open the chart trader and then Right click above or below the price, it will show the valid orders for above or below the price.


                Comment


                  #9
                  Ok so I'm trying to make a stop market order long using unmanaged. Can you give me an example or point me to an example were this is used?

                  Comment


                    #10
                    Hello r3n3v,

                    I would suggest looking at the help guide page for SubmitOrderUnmanaged, it shows the order types and how to use the method: https://ninjatrader.com/support/help...OrderUnmanaged

                    If you want a stop market order you need to use OrderType.StopMarket and then adjust the rest of the SubmitOrderUnmanaged values to match the order that you are submitting.

                    The parameters that SubmitOrderUnmanaged takes define the order that you are submitting.

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                    0 responses
                    647 views
                    0 likes
                    Last Post Geovanny Suaza  
                    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                    0 responses
                    369 views
                    1 like
                    Last Post Geovanny Suaza  
                    Started by Mindset, 02-09-2026, 11:44 AM
                    0 responses
                    108 views
                    0 likes
                    Last Post Mindset
                    by Mindset
                     
                    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                    0 responses
                    572 views
                    1 like
                    Last Post Geovanny Suaza  
                    Started by RFrosty, 01-28-2026, 06:49 PM
                    0 responses
                    573 views
                    1 like
                    Last Post RFrosty
                    by RFrosty
                     
                    Working...
                    X