Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

unique entries - position.quantity

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

    unique entries - position.quantity

    Hello,

    I do uniquely named entries so that I can scale out. But I have a problem to get total quantity. How can I get the sum of all positions please eg when there are 3 entries in a direction with L1, L2, L3 I need to have the sum of 3. (I get 1 instead of 3)

    Thank you.
    Tony

    #2
    Hello,

    You would need to create a tracking variable to store/track the total quantity per each of your IOrders.

    In my opinion the simplest way to do this would be to monitor order fills in on execution. Each time you have an order that gets filled you increment your variable based on the size filled.


    Let me know if I can further assist.
    LanceNinjaTrader Customer Service

    Comment


      #3
      Hello,

      thank you for your reply.

      The reason for doing so (referring to the NT sample "'ScaleOut") is to have different exits but not to scale in. So, when all 3 (or more) entries will be at the same moment of time wouldn´t this cause some troubles maybe when all happens at the same time time?

      If so, how would you grab the sum the next bar with onbarupdate? (if this idea makes sense)

      Or another idea: when I do the 3 entries all with same name, so in onexecution I have this instantly with one order filled, can I scale out then (or if one stop is triggered/or one exit-condition true then all 3 positions will be closed (or can I take off 1 by 1 this way)?

      Thank you.
      Tony

      Originally posted by NinjaTrader_Lance View Post
      Hello,

      You would need to create a tracking variable to store/track the total quantity per each of your IOrders.

      In my opinion the simplest way to do this would be to monitor order fills in on execution. Each time you have an order that gets filled you increment your variable based on the size filled.


      Let me know if I can further assist.

      Comment


        #4
        There are several different ways you could code a scale in or scale out system however I think you'll find it simplest to use separate IOrders for each of your position. In other words for each of your different exit use a different entry IOrder. This way you can individually manage all of the orders.



        Having the three different IOrders will allow you to individually track the fill amounts of each to know the total filled.


        Let me know if I can further assist.
        LanceNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by funk10101, Today, 12:02 AM
        1 response
        10 views
        0 likes
        Last Post NinjaTrader_LuisH  
        Started by GLFX005, Today, 03:23 AM
        1 response
        6 views
        0 likes
        Last Post NinjaTrader_Erick  
        Started by nandhumca, Yesterday, 03:41 PM
        1 response
        12 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by The_Sec, Yesterday, 03:37 PM
        1 response
        11 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by vecnopus, Today, 06:15 AM
        0 responses
        1 view
        0 likes
        Last Post vecnopus  
        Working...
        X