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, 05: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 kevinenergy, 02-17-2023, 12:42 PM
          118 responses
          2,778 views
          1 like
          Last Post kevinenergy  
          Started by briansaul, Today, 05:31 AM
          0 responses
          9 views
          0 likes
          Last Post briansaul  
          Started by traderqz, Yesterday, 12:06 AM
          11 responses
          28 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Started by PaulMohn, Today, 03:49 AM
          0 responses
          8 views
          0 likes
          Last Post PaulMohn  
          Started by inanazsocial, Today, 01:15 AM
          1 response
          10 views
          0 likes
          Last Post NinjaTrader_Jason  
          Working...
          X