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 RideMe, 04-07-2024, 04:54 PM
        6 responses
        31 views
        0 likes
        Last Post RideMe
        by RideMe
         
        Started by tkaboris, Today, 05:13 PM
        0 responses
        2 views
        0 likes
        Last Post tkaboris  
        Started by GussJ, 03-04-2020, 03:11 PM
        16 responses
        3,281 views
        0 likes
        Last Post Leafcutter  
        Started by WHICKED, Today, 12:45 PM
        2 responses
        19 views
        0 likes
        Last Post WHICKED
        by WHICKED
         
        Started by Tim-c, Today, 02:10 PM
        1 response
        10 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Working...
        X