Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Best practice for multiple AtmStrategyChangeEntryOrder() entries

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

    Best practice for multiple AtmStrategyChangeEntryOrder() entries

    Hello All,

    I have a script that enters the market using the AtmStrategyCreate() method. Each tick, information from some of the ATM Strategy Monitoring methods (MarketPosition, PositionQuantity, etc.) are saved to a new line of a generated .xls file, along with print statements to the output window throughout the course of the open position. It handles one open position at a time well, but how would I approach handling multiple entries per direction?

    I've seen recommendations like this where a counter is used to control how many positions are open at a given time, but how can I call on each unique ATM Strategy ID to get the ATM Strategy Monitoring information for my .xls file (ideally a new .xls file should be made for each ATM ID) and the output window?

    I'm thinking I'll need a for loop to save the information for every existing ID, but I'm kinda stumped on how to go about it.


    Thanks!

    #2
    Hello nnwakaihe,

    Where you have asked:
    "how would I approach handling multiple entries per direction?"

    With multiple entries scaling into a single position and changing the position quantity, use the GetAtmStrategyPositionQuantity() on each bar update to see what the current position and quantity of that position is.



    Where you have stated:
    "I've seen recommendations like this where a counter is used to control how many positions are open at a given time"
    For multiple positions these would be on different instruments. You could use the name of the instrument (Instrument.Name) in the file name to separate out the different instrument positions.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      ChelseaB,

      GetAtmStrategyPositionQuantity() is for finding the current position size, but if I wanted to add to a position I would have to use AtmStrategyCreate(), no? Is there a good way to save IDs generated using GetAtmStrategyUniqueId() that I can then call on later for adding to open positions; assuming I want to use the same ATM ID from the initial entry?

      Comment


        #4
        Hello nnwakaihe,

        Are you wanting to add contracts to the existing single position to scale in (there is only one position per instrument per account), or do you want separate positions on separate accounts, or do you want multiple positions on different instruments?

        AtmStrategyCreate will create a new entry order with an Atm Strategy template attached. This can be used to scale in to a position and will work as a separate working atm strategy.

        The IDs generated by GetAtmStrategyUniqueId are strings. You can save this to a string variable or string array (string[]) or in a list (List<string>).
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by NullPointStrategies, Yesterday, 05:17 AM
        0 responses
        54 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        131 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        73 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        44 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        49 views
        0 likes
        Last Post TheRealMorford  
        Working...
        X