Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 Belfortbucks, Today, 09:29 PM
        0 responses
        3 views
        0 likes
        Last Post Belfortbucks  
        Started by zstheorist, Today, 07:52 PM
        0 responses
        7 views
        0 likes
        Last Post zstheorist  
        Started by pmachiraju, 11-01-2023, 04:46 AM
        8 responses
        150 views
        0 likes
        Last Post rehmans
        by rehmans
         
        Started by mattbsea, Today, 05:44 PM
        0 responses
        6 views
        0 likes
        Last Post mattbsea  
        Started by RideMe, 04-07-2024, 04:54 PM
        6 responses
        33 views
        0 likes
        Last Post RideMe
        by RideMe
         
        Working...
        X