• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Question on how to iterate on multiple entries

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

    Question on how to iterate on multiple entries

    Hi,
    I have a strategy where, at any point in time, might have multiple entries on a given instrument. I am trying to track the bars since entry of each entry. The problem I'm running into is that the Position object pools all the entries into one position. I'm not aware of a way to iterate through each entry that makes up a Position.

    Is there a way to check for a given entry if it is open and what bar it was executed on? The BarsSinceEntryExecution method lets me query how many bars ago a given entry executed but it doesn't let me check if that execution is still open or has it has already been closed.

    Any help would be appreciated.

    #2
    Originally posted by GrumpyTrader View Post
    Hi,
    I have a strategy where, at any point in time, might have multiple entries on a given instrument. I am trying to track the bars since entry of each entry. The problem I'm running into is that the Position object pools all the entries into one position. I'm not aware of a way to iterate through each entry that makes up a Position.

    Is there a way to check for a given entry if it is open and what bar it was executed on? The BarsSinceEntryExecution method lets me query how many bars ago a given entry executed but it doesn't let me check if that execution is still open or has it has already been closed.

    Any help would be appreciated.
    ref: http://ninjatrader.com/support/helpG...texecution.htm

    See the return value that you get if the trade has not yet exited? Check for it.
    Attached Files
    Last edited by koganam; 02-18-2016, 04:17 PM.

    Comment


      #3
      Thanks Koganam. I guess I should just loop back until I find all the entries, adding each quantity, until it equals my current position.

      Comment


        #4
        Hi Koganam,
        It seems as though BarsSinceEntryExecution doesn't filter for if the trade has been closed or not. So it won't return -1 when a trade has been exited by other means. So the -1 return value doesn't work as a filter.

        Any other ideas?

        Comment


          #5
          Originally posted by GrumpyTrader View Post
          Hi Koganam,
          It seems as though BarsSinceEntryExecution doesn't filter for if the trade has been closed or not. So it won't return -1 when a trade has been exited by other means. So the -1 return value doesn't work as a filter.

          Any other ideas?
          You must have misread what I wrote. I suggest that you click on the link and read what it actually says: not what you expect it to say.

          For the avoidance of doubt it is BarsSinceExitExecution, not BarsSinceEntryExecution.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by frankduc, Today, 07:26 AM
          0 responses
          1 view
          0 likes
          Last Post frankduc  
          Started by chnh1, Yesterday, 11:51 PM
          1 response
          16 views
          0 likes
          Last Post NinjaTrader_PaulH  
          Started by Jasper99, Yesterday, 10:29 PM
          1 response
          28 views
          0 likes
          Last Post NinjaTrader_ChrisSch  
          Started by Jasper99, Yesterday, 09:50 PM
          1 response
          12 views
          0 likes
          Last Post NinjaTrader_ChrisSch  
          Started by StevenNelson, Yesterday, 05:57 PM
          1 response
          15 views
          0 likes
          Last Post NinjaTrader_Marco  
          Working...
          X