Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Determining Original Order

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

    Determining Original Order

    Hi

    Suppose my strategy places two limit orders and they both get hit

    prc = 900.25

    EnterLongLimit(0,true,1,prc ,"BuyLimitOrder.1");
    EnterLongLimit(0,true,1,prc+TickSize,"BuyLimitOrde r.2");

    both have the same profit target but only 1 porfot target order gets hit

    I can catch the execution of a target fill but how do I determine which original longLimit order it is related too the execution.name = "Profit target" and does not hold any information regarding the originating order.

    Thanks

    Paul

    #2
    Paul,

    Please use the Trade class: http://www.ninjatrader-support.com/H...radeClass.html
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Josh View Post
      Josh

      Thanks so just to be clear

      so I can determine my original LimitPrice from a "profit target" execution (within OnExecution) by:

      original price = Performance.RealtimeTrades[0].Entry.Order.LimitPrice

      Where "Entry" is original opening execution
      and "Entry.Order" is the original limit order

      Thanks

      Comment


        #4
        That is correct.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_Josh View Post
          That is correct.
          Sorry Josh ... one last thing can you confirm that my OnExecution function will always get called in line with the update of the trade class so that if I reference Trade[0] it will always be the last trade and it is not possible that the trade class gets updated more than once before my OnExecution function gets called ... I am running a high frequency model and I need to be sure my OnExecution function is always called in line with the state of the Trade class

          Thanks

          Paul

          Comment


            #6
            Paul,

            Trade objects are updated at the completion of a trade (entry + exit). The completion of the trade may or may not be in line with OnExecution. Especially since there are entries as well as partial fills that can occur.
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              Originally posted by NinjaTrader_Josh View Post
              Paul,

              Trade objects are updated at the completion of a trade (entry + exit). The completion of the trade may or may not be in line with OnExecution. Especially since there are entries as well as partial fills that can occur.
              Sorry Josh I did not pose the question very well ... basically if the OnExecution is called with a "profit target" execution can I get the original entry price from

              lastTrade = Performance.RealtimeTrades[Performance.RealtimeTrades.Count - 1];
              entryExecution = lastTrade.Entry;
              entryOrder = EntryExecution.Entry.Order;
              entryLimitPrice = entryOrder.LimitPrice;

              Thanks

              Comment


                #8
                Provided that was the last and final execution, yes.
                Josh P.NinjaTrader Customer Service

                Comment


                  #9
                  Originally posted by NinjaTrader_Josh View Post
                  Provided that was the last and final execution, yes.
                  Josh

                  Sorry to be a real pain on this but it is very important to my strategy ... let me ask this question another way ... I get a call into my OnExecution function with a execution.Name = "profit target" how do I get the associated entry price regardless of whether this execution is associated with a total fill or a partial fill of my original opening order ...

                  Thanks again

                  Comment


                    #10
                    You cannot. If you are worried about this I suggest you to not use the Set() methods and take over full control with the Exit() methods. Then just submit with a string name that is unique enough for you to ID which entry it came from.
                    Josh P.NinjaTrader Customer Service

                    Comment


                      #11
                      Originally posted by NinjaTrader_Josh View Post
                      You cannot. If you are worried about this I suggest you to not use the Set() methods and take over full control with the Exit() methods. Then just submit with a string name that is unique enough for you to ID which entry it came from.
                      ok thanks .. so if i know my unique entry signal before i place my selllimit can i place my exitselllimit before i place my selllimit - i am only looking fot a couple of ticks so don't really want a delay beween placing the sell limit and the exitselllimit

                      Comment


                        #12
                        You can place whatever orders you want as long as they do not violate one of the order handling rules outlined at the bottom of this article: http://www.ninjatrader-support.com/H...tml?Overview36
                        Josh P.NinjaTrader Customer Service

                        Comment


                          #13
                          Originally posted by NinjaTrader_Josh View Post
                          You can place whatever orders you want as long as they do not violate one of the order handling rules outlined at the bottom of this article: http://www.ninjatrader-support.com/H...tml?Overview36
                          Hi again Josh

                          Ok I am trying to use the following to open a market order with a targt and stop

                          EnterLong open at market
                          ExitLongLimit my target for above order
                          ExitLongStop my stop for above order

                          EnterLong(0,1,"My Entry Signal");
                          ExitLongLimit(0,true,1,targetPrice,"my exit target signal","my entry signal");
                          ExitLongStop(0,true,1,stopPrice,"my stop exit signal","my entry signal");

                          but I am not seeing my target/stop orders in the dom or in the working orders ... what am i doing wrong ... and if you can help me with that should i be calling EntetLong first or last

                          Thanks

                          Comment


                            #14
                            You need to be mindful of capitalizations. You can't be capitalizing the string name in one and not in another.

                            Not sure what you mean by first and last.
                            Josh P.NinjaTrader Customer Service

                            Comment


                              #15
                              Originally posted by NinjaTrader_Josh View Post
                              You need to be mindful of capitalizations. You can't be capitalizing the string name in one and not in another.

                              Not sure what you mean by first and last.
                              sorry that was my typo in the question ... i am using a preset string so it must be the same ...?

                              i mean should i make the exit calls first to set up the stops/targets (like with the set functions) or after the call to EnterLong

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                              0 responses
                              558 views
                              0 likes
                              Last Post Geovanny Suaza  
                              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                              0 responses
                              324 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by Mindset, 02-09-2026, 11:44 AM
                              0 responses
                              101 views
                              0 likes
                              Last Post Mindset
                              by Mindset
                               
                              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                              0 responses
                              545 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by RFrosty, 01-28-2026, 06:49 PM
                              0 responses
                              547 views
                              1 like
                              Last Post RFrosty
                              by RFrosty
                               
                              Working...
                              X