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 trilliantrader, Yesterday, 03:01 PM
          3 responses
          30 views
          0 likes
          Last Post NinjaTrader_Clayton  
          Started by cmtjoancolmenero, Yesterday, 03:58 PM
          4 responses
          26 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by Brevo, Today, 01:45 AM
          1 response
          14 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by rjbtrade1, 11-30-2023, 04:38 PM
          2 responses
          74 views
          0 likes
          Last Post DavidHP
          by DavidHP
           
          Started by suroot, 04-10-2017, 02:18 AM
          5 responses
          3,022 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Working...
          X