Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Entry bar

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

    Entry bar

    Hi,

    I know I can use

    Performance.AllTrades[Performance.AllTrades.Count-1].Entry.Time

    to get the entry time, is there a way to get the entry bar in a similar manner?

    Alternatively, I can get the bar information in OnExecution but then I have to equate a trade to the IExecution object. Being lazy here; what is the best way to do that (given there is no direct link as mentioned above)?

    Best Regards,
    Scott

    #2
    ScottB, you can also use the BarsSinceEntry() method to see how many bars ago the entry was - http://www.ninjatrader.com/support/h...sinceentry.htm.
    AustinNinjaTrader Customer Service

    Comment


      #3
      Austin,

      Thanks for getting back to me so quickly. I will look into using that.

      Best Regards,
      Scott

      Comment


        #4
        Is there anything within an order that can be used as a key for a dictionary collection such that I can save the CurrentBar when an order is executed the first time (this has to work with partial fills) and then match it up with the entry order from a trade object?

        It doesn't seem like I can use the IOrder object in OnExecution because of the partial fill issue but the entry order appears to be the only nexus between a trade object and an execution.

        Any advice will be appreciated.

        Best Regards,
        Scott

        Comment


          #5
          Hi Scott,

          You can for sure capture CurrentBar during an orders first partial fill, but not sure if that's exactly what you're looking for. To see all available properties: Print everything about the order that raises OnExecution. Use something like below to see all the properties associated with an order, or work with intellisense.

          protected override void OnExecution(IExecution execution)
          {
          if (entryOrder != null && entryOrder == execution.Order)
          {
          Print(execution.ToString());
          Print(execution.Order.ToString());
          }
          }
          Ryan M.NinjaTrader Customer Service

          Comment


            #6
            Ryan, thanks. I actually am looking for something like that. What I really want is something like Token or Order id that won't change and that will match what I can get in the trades list (via execution.order...).

            I have tried what you mentioned but was concerned because the documentation is pretty clear that there are no guarantees the order id or token won't change. It appears you are implementing something along the lines of an IComparable interface allowing the comparison of two IOrders.

            I am trying to avoid having to do a foreach loop through the entire order list using a compare statement to see if two orders are the same.

            I hope that makes sense.

            Best Regards,
            Scott

            Comment


              #7
              Scott, you are correct there no guarantess it would not change, hence we normally suggest keeping an own collection for reference. Here's another idea : since you get the entry Time info, why not work with GetBar() to know how many bars back that was?

              Comment


                #8
                Bertrand,

                Thinking about how brokers assign order id's I realize that although technically they are not guaranteed to be globally unique, they generally are guaranteed to be unique within a day and normally even over several days so that will work for my purposes.

                The reason I didn't do it the way you refer to is because this particular system will eventually morph into a pure directional scalping system operating on a tick level and given that NinjaTrader does not support millisecond (or better) timestamps I am out of luck there.

                From time to time, I forget what I know about exchange rules, etc. and how that information is useful under these types of circumstances.

                As always, thanks so much for your help.

                Best Regards,
                Scott

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by CarlTrading, 03-31-2026, 09:41 PM
                1 response
                67 views
                0 likes
                Last Post NinjaTrader_ChelseaB  
                Started by CarlTrading, 04-01-2026, 02:41 AM
                0 responses
                36 views
                0 likes
                Last Post CarlTrading  
                Started by CaptainJack, 03-31-2026, 11:44 PM
                0 responses
                59 views
                1 like
                Last Post CaptainJack  
                Started by CarlTrading, 03-30-2026, 11:51 AM
                0 responses
                62 views
                0 likes
                Last Post CarlTrading  
                Started by CarlTrading, 03-30-2026, 11:48 AM
                0 responses
                53 views
                0 likes
                Last Post CarlTrading  
                Working...
                X