Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Unmanaged approach and FromEntrySignal

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

    Unmanaged approach and FromEntrySignal

    I have more or less successfully implemented a framework for using ATM strategies in backtesting. My custom class "BAtm" (for "backtestable ATM") uses the unmanaged approach to simulate the behavior of ATM strategies for historical data, and automatically switches over to live ATM strategies on live data. The intent here is to give me the best of both worlds: simulated ATM strategies for backtesting, and live ATM strategies for trading and modifying in the DOM ladder.

    My problem for the moment relates to identifying the entry order associated with exit order fills in OnExecution().

    It would be great if the read-only IOrder attribute FromEntrySignal had a Set() method so that I could set it and later refer to it in OnExecution().

    Currently I am tying the exits and entries together by using the Token property of the exit order, and maintaining a Dictionary of exit tokens associated with my entry orders. Unfortunately I can't actually create unique order names for my exit orders because they need to match what ATM strategies use (TARGET1, STOP2, etc.). The Token is therefore the only unique identifier available in an exit order.

    This works. However, the documentation warns that Token is not constant and can change when transitioning to live data. This is worrisome. It's fine for my own use, but not if I want to distribute this BAtm package to others.

    If I had a Set() method for an exit order's FromEntrySignal field, that would provide me with a combination of attributes guaranteed to be unique, because all my entry signal IDs are unique. Then combining FromEntrySignal with the exit order name, I'd have a unique "token" for my token dictionary, and this token it wouldn't change when switching over to live orders.

    I know a set method for FromEntrySignal must already exist internally, since the managed approach sets it. All you guys need to do is expose it for the rest of us, and it would help simplify bookkeeping in the unmanaged approach.

    Consider exposing this method a feature request. Alternately, consider adding a read-write custom string to the IOrder class for programmers to use. Thanks.

    Alex
    Last edited by anachronist; 06-27-2012, 07:28 PM.

    #2
    Originally posted by anachronist View Post
    I have more or less successfully implemented a framework for using ATM strategies in backtesting. My custom class "BAtm" (for "backtestable ATM") uses the unmanaged approach to simulate the behavior of ATM strategies for historical data, and automatically switches over to live ATM strategies on live data. The intent here is to give me the best of both worlds: simulated ATM strategies for backtesting, and live ATM strategies for trading and modifying in the DOM ladder.

    My problem for the moment relates to identifying the entry order associated with exit order fills in OnExecution().

    It would be great if the read-only IOrder attribute FromEntrySignal had a Set() method so that I could set it and later refer to it in OnExecution().

    Currently I am tying the exits and entries together by using the Token property of the exit order, and maintaining a Dictionary of exit tokens associated with my entry orders. Unfortunately I can't actually create unique order names for my exit orders because they need to match what ATM strategies use (TARGET1, STOP2, etc.). The Token is therefore the only unique identifier available in an exit order.

    This works. However, the documentation warns that Token is not constant and can change when transitioning to live data. This is worrisome. It's fine for my own use, but not if I want to distribute this BAtm package to others.

    If I had a Set() method for an exit order's FromEntrySignal field, that would provide me with a combination of attributes guaranteed to be unique, because all my entry signal IDs are unique. Then combining FromEntrySignal with the exit order name, I'd have a unique "token" for my token dictionary, and this token it wouldn't change when switching over to live orders.

    I know a set method for FromEntrySignal must already exist internally, since the managed approach sets it. All you guys need to do is expose it for the rest of us, and it would help simplify bookkeeping in the unmanaged approach.

    Consider exposing this method a feature request. Alternately, consider adding a read-write custom string to the IOrder class for programmers to use. Thanks.

    Alex
    Can you not just make a struct that consists of the IOrder and a writeable field, creating a composite IOrder, so to speak, that matches what you want?

    Comment


      #3
      Originally posted by koganam View Post
      Can you not just make a struct that consists of the IOrder and a writeable field, creating a composite IOrder, so to speak, that matches what you want?
      I basically do that already, with my BAtm class and the dictionary of tokens. The problem is, any struct or class I wrap around IOrder isn't visible from OnExecution().
      -Alex

      Comment


        #4
        Thanks for the input Alex and glad to see this BAtm project come to fruition for you.

        One basic trait of the Unmanaged Approach not govered by any 'under the hood' rules is the absense of signal tracking, so we could not expose this unfortunately.

        I like though the idea to provide a custom string for 'get / set' in the IOrder object and have added to our product management tracking list under # 1858.

        Comment


          #5
          Thanks. It would be good to have something user-settable in IOrder, because currently nothing there is guaranteed to be a constant unique identifier. And it would be so useful to have user-defined property like this for using in OnOrderUpdate() or OnExecution().
          -Alex
          Last edited by anachronist; 06-28-2012, 09:19 AM.

          Comment


            #6
            Originally posted by NinjaTrader_Bertrand View Post
            I like though the idea to provide a custom string for 'get / set' in the IOrder object and have added to our product management tracking list under # 1858.
            Along the same line, it would be great if there were a custom 'double' property that I could set/get in Performance.AllTrades.TradePerformance. Then it would be trivial for my strategy to generate a custom performance measure on the fly for optimization, and it would eliminate the need to write custom code in Documents\NinjaTrader7\bin\Custom\Type -- unsupported code that can't be edited easily because there's no IntelliSense showing what's exposed and available, and can't be debugged easily unless you have Visual Studio.
            -Alex

            Comment


              #7
              Thanks again Alex, have added those thoughts in as well to our enhancement tracking here.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
              0 responses
              653 views
              0 likes
              Last Post Geovanny Suaza  
              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
              0 responses
              370 views
              1 like
              Last Post Geovanny Suaza  
              Started by Mindset, 02-09-2026, 11:44 AM
              0 responses
              109 views
              0 likes
              Last Post Mindset
              by Mindset
               
              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
              0 responses
              574 views
              1 like
              Last Post Geovanny Suaza  
              Started by RFrosty, 01-28-2026, 06:49 PM
              0 responses
              577 views
              1 like
              Last Post RFrosty
              by RFrosty
               
              Working...
              X