• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Entries per Direction and Exits

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

    Entries per Direction and Exits

    Hi -

    I have a strategy that creates up to 4 orders per signal in a direction (long or short), a trade set for long or short signals. Each order (trade) has its own unique identifier (i.e. BarNumber+n+L or BarNumber+N+S where "n" is 1, 2, 3 or 4).

    A trade "closes" when it's stopped out, profit target hit, or a counter signal is generated.

    Ok, so here's my question...

    Is there a way to identify the individual trade when it "closes"? I've noticed that closed trades are either individually closed (i.e. stopped out or profit target achieved) -- and/or closed out together in one bundle, on one trade order (i.e. if 4 long trades then all 4 are closed out -- or sometimes 3 of 4, etc...).

    I've looked into OnExecutionUpdate and OnOrderUpdate to see if I can identify the entry signals to the exit signals, but trades can be individually closed or closed in a group.

    I have an external database that I've setup to log all entries and exits and I'm trying to tie the trade pairs together for reporting purposes.

    Thanks,

    Big Surf
    Last edited by bigsurftrader; 03-08-2017, 09:36 AM.

    #2
    More information:
    1) A trade set gets triggered by a signal. So, all orders are sent on the same bar on bar open
    2) It appears that NT submits orders individually, so if there are 3 "market" long orders NT treats them as 3 separate orders; however...
    3) When all three trades get closed out at the same time they are closed as a single order

    I have working solution for this by using OnOrderUpdate where I can filter "orderState=Filled" and then determine which trades, individually, got closed -- but, was wondering if there was a cleaner solution to what I"m looking for.

    Comment


      #3
      Hello bigsurftrader,

      Thank you for writing in.

      I have put together a sample strategy which assigns an order object to 3 different enter long methods, then within OnOrderUpdate, assigns a order object to the profit target and stop loss submitted as part of each entry. Then within OnBarUpdate you can check the OrderState of each order object to determine specificly if an entry position is open or closed.

      After putting this together I realized it sounds like you already found this solution. I am unaware of another alternative to this approach.

      Please let us know if you need further assistance.
      Attached Files
      Alan P.NinjaTrader Customer Service

      Comment


        #4
        ah!!!!! Thank you. I was doing something else :-)

        BigSurf

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by edmata1109, Today, 12:40 PM
        0 responses
        2 views
        0 likes
        Last Post edmata1109  
        Started by ballboy11, Today, 11:57 AM
        1 response
        6 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by swcooke, Today, 09:41 AM
        1 response
        9 views
        0 likes
        Last Post NinjaTrader_Jim  
        Started by Catalon, Today, 10:02 AM
        1 response
        9 views
        0 likes
        Last Post NinjaTrader_Jim  
        Started by pel11, Yesterday, 06:25 PM
        1 response
        11 views
        0 likes
        Last Post NinjaTrader_ChrisL  
        Working...
        X