Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Target Price

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

    #16
    Please take a look at the code sample in post # 6. The way that I had it laid out in the prior post, we were checking for the limit price before ExitLongLimit() had returned and assigned a value to the IOrder. We just need to check to ensure the object reference is not null before trying to access its properties.
    Dave I.NinjaTrader Product Management

    Comment


      #17
      The example in #6 doesn't show how to retrieve the target price of the order. Does the IOrder object have such a property?

      Comment


        #18
        Originally posted by reynoldsn View Post
        When I debug this code, t=0.0 and not tgtPx - what am I doing wrong?

        Code:
        iOrderL1 = EnterLong(iQuantity1, sENTRY1L);
        ExitLongLimit(tgtPx, sENTRY1L);
        double t = iOrderL1.LimitPrice;
        If I may interject, why would you expect t = tgtPx? They have nothing to do with each other. You placed an Exit order at a Limit price of tgtPx. That has nothing to do with your Entry order iOrderL1, so why would they have anything in common other than by happenstance?

        If you are looking for the price at which your entry order was filled, then use OnExecution() to capture the iOrderL1.AvgFillPrice. You already know the Limit Price of your exit: you specified it as tgtPx.

        Comment


          #19
          Originally posted by reynoldsn View Post
          When I debug this code, t=0.0 and not tgtPx - what am I doing wrong?

          Code:
          iOrderL1 = EnterLong(iQuantity1, sENTRY1L);
          ExitLongLimit(tgtPx, sENTRY1L);
          double t = iOrderL1.LimitPrice;
          Yes, I stand corrected on that. When asking for the LimitPrice, what I really want is target price of the order. I still don't have the answer.

          Thank you

          Comment


            #20
            Originally posted by reynoldsn View Post
            Yes, I stand corrected on that. When asking for the LimitPrice, what I really want is target price of the order. I still don't have the answer.

            Thank you
            Target price of what order? An entry order has no target price; albeit it may have an order price and always has a fill price. For a Market Order, there is no order price because you are giving the market permission to sell to you at whatever price is current. The only thing that you can do is determine later at what price you were filled: the fill price. You can only know the fill price after you are filled. You get that using the OnExecution() event and its handler.

            The target price for your exit order is the price that you specified. The target price is always the price at which you want to be filled, and has to be explicitly specified if you want to use a Limit Order. So you always have preknowledge of a target price: you specify it at where you want it to be.

            You must understand the clear distinction between your entry price and your exit price. You cannot get any exit parameters from the entry order. You must specify your exit parameters: your entry price cannot contain said parameters.
            Last edited by koganam; 06-26-2015, 01:06 PM.

            Comment


              #21
              OK, very well said - there are some semantics going on and adjustments I need to make on my part to "think" how NinjaScript thinks.

              The original question was that after an order is placed and filled, to simply be able to "query" for that order's exit (target) price. Yes, you are 100% percent correct, of course, that I specify this as an exit parameter, as you call it. But I was debugging my strategy and during market replay, orders eventually hit a target different than what I thought were specified (by me in my strategy). (not much different but still different). Thus, I want to be able to ask the order object, "what exit price are you set at?" I may have a bug somewhere so I want to check if my expected target value is in fact what the exit price is set at.

              It's really no different from doing something like:

              int a=8;
              ?a //console will show "8" , thank you for confirming that I set 'a' to 8

              This is all I am really asking.

              Thanks again for your time and patience

              Comment


                #22
                Originally posted by reynoldsn View Post
                OK, very well said - there are some semantics going on and adjustments I need to make on my part to "think" how NinjaScript thinks.

                The original question was that after an order is placed and filled, to simply be able to "query" for that order's exit (target) price. Yes, you are 100% percent correct, of course, that I specify this as an exit parameter, as you call it. But I was debugging my strategy and during market replay, orders eventually hit a target different than what I thought were specified (by me in my strategy). (not much different but still different). Thus, I want to be able to ask the order object, "what exit price are you set at?" I may have a bug somewhere so I want to check if my expected target value is in fact what the exit price is set at.

                It's really no different from doing something like:

                int a=8;
                ?a //console will show "8" , thank you for confirming that I set 'a' to 8

                This is all I am really asking.

                Thanks again for your time and patience
                Well, that means that you are looking for the fill price of the exit order, and want to see how that relates to what you intended to set it at as the target for exiting the trade. The "trade", not the "entry order": you exit at the trade's target with an exit order; the entry order cannot logically or physically have a target.

                So use OnExecution() to query the fill price for the exit order. That means that you are best off assigning the exit order to an IOrder, so that it is easier to query.
                Last edited by koganam; 06-26-2015, 02:27 PM.

                Comment


                  #23
                  In addition to what koganam said, here is a link that includes a code snippet that will show you exactly how to check the state of an IOrder's properties within the OnExecution() event:

                  http://ninjatrader.com/support/helpG...nexecution.htm
                  Dave I.NinjaTrader Product Management

                  Comment


                    #24
                    OK, thanks for all the clarification - helps a lot.

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by pechtri, 06-22-2023, 02:31 AM
                    9 responses
                    122 views
                    0 likes
                    Last Post NinjaTrader_ChelseaB  
                    Started by frankthearm, 04-18-2024, 09:08 AM
                    16 responses
                    64 views
                    0 likes
                    Last Post NinjaTrader_Clayton  
                    Started by habeebft, Today, 01:18 PM
                    1 response
                    5 views
                    0 likes
                    Last Post NinjaTrader_ChelseaB  
                    Started by benmarkal, Today, 12:52 PM
                    2 responses
                    13 views
                    0 likes
                    Last Post benmarkal  
                    Started by f.saeidi, Today, 01:38 PM
                    1 response
                    7 views
                    0 likes
                    Last Post NinjaTrader_BrandonH  
                    Working...
                    X