Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Multiple positions in unmanaged strategy

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

    Multiple positions in unmanaged strategy

    Greetings,

    How are entry and exit orders matched by NT?

    Assume I have placed a long order:
    A: 1 @ 100.00
    It got filled and I placed its legs (Position: Long)
    A: PT @ 120.00, STP @ 80.00

    Now price goes 105.00 and I place a short order
    B: 1 @ 105.00
    It gets filled and I place its legs (Position: Flat)
    B: PT @ 100.00, STP @ 110.00

    Then prices goes to 110.00 and B.STP gets filled, position becomes Long again.
    Then price goes to 120.00 and A.PT gets filled, position becomes Flat.

    Since NT defines a trade as "a completed buy/sell or sell/buy transaction. It consists of an entry and exit execution" then strategy should now have 2 Trades.

    The first trade should have Entry == A

    The questions:
    1) What would be the Exit for this first Trade object?
    2) What would be Entry and Exit for the second (last) Trade object?

    Thank you

    #2
    Alex, in NT's unmanaged mode there is no signal tracking / matching by NT - you fire off trades via the SubmitOrder method and NT would submit / execute whatever you have coded in, it would not match of signal names to any open positions managed by the strategy - this provides more flexibility for programmers since the managed mode order handling rules are not effective here.

    Comment


      #3
      Hi Bertrand

      The following code does work in unmanaged case

      bool asEntry = true/false;
      ....
      Trade trade = Performance.AllTrades[i];
      bool me = (asEntry ? trade.Entry.Order : trade.Exit.Order) == order;
      if (me)
      {
      // Do something
      }

      Each Trade has Entry and Exit order. I can confirm that for unmanaged code. So the question was: how will Entry and Exit members of Trade objects be assigned in the aforementioned case?

      Or, in generic form: what is the rule, according to with Entry and Exit members of Trade objects get assigned?

      Thanks.

      Comment


        #4
        Thanks for the clarification Alex, I think you're looking for this example for our helpguide on the Trade object - http://www.ninjatrader.com/support/h.../nt7/trade.htm

        Comment


          #5
          Nope, I am not looking for that example

          I am looking for an answer to my initial question, where I explicitly made an example.

          Comment


            #6
            I would suggest you add prints to your strategy to see how the Trade object would get handling in your specific case. In the unmanaged mode signal names would not matter, you get execution A and then execution B follows, this would be considered a trade.

            Comment


              #7
              Print statements would illustrate a particular result, that may be biased by such things like broker/Sim vs Live/Sim vs Replay Mode etc

              I would like to understand the general rule for matching between Entry and Exit for particular Trade in collection. I realize it may be complex but I would appreciate if you could at least give us some rough idea.

              If I had 2 long entries followed by a double short, how many Trades would I get? Will they share Exit order?

              Thank you.

              Comment


                #8
                Alex, in this case, I would expect to see 4 trades, so 2 longs and 2 shorts. I assume you reverse with the first short, so the longs would share the same exit order name, since it's this order that took those entry executions flat.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                0 responses
                647 views
                0 likes
                Last Post Geovanny Suaza  
                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                0 responses
                368 views
                1 like
                Last Post Geovanny Suaza  
                Started by Mindset, 02-09-2026, 11:44 AM
                0 responses
                108 views
                0 likes
                Last Post Mindset
                by Mindset
                 
                Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                0 responses
                571 views
                1 like
                Last Post Geovanny Suaza  
                Started by RFrosty, 01-28-2026, 06:49 PM
                0 responses
                573 views
                1 like
                Last Post RFrosty
                by RFrosty
                 
                Working...
                X