Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to have strategy adopt account position

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

    How to have strategy adopt account position

    Hi NT 8 support,

    I am trying to automate my exits. I want a strategy to be enabled when I enter a trade, adopt my account position as I buy/short contracts, and then when exit conditions are met, the strategy exits my account position. I rememeber I used to be able to see "adopt account position" as an option in the strategy builder, but I can't find it now. How do I change this in the code. an example of my starting point in the strategy builder is attached for Long exits. thank you!
    Attached Files

    #2
    Hello Austiner87,

    Thank you for your post.

    Adopt Account Position will only be able to adopt the initial position when the strategy is started - you would not be able to just submit orders manually for entries after the strategy has been started and have the strategy manage them. You'd have to stop and restart the strategy every time you make a new entry.

    You could consider programming an indicator using add-on code that monitors the account for newly opened positions and uses Add-on code to submit an exit order when your conditions for exit are met, however, this would require more advanced programming skill and would not be something that could be done with the Strategy Builder.



    You can also contact a professional NinjaScript Consultant who would be eager to create or modify this script at your request or assist you with your script. The NinjaTrader Ecosystem has affiliate contacts who provide educational as well as consulting services. Please let me know if you would like our business development follow up with you with a list of affiliate consultants who would be happy to create this script or any others at your request.

    Please let us know if we may be of further assistance to you.
    Kate W.NinjaTrader Customer Service

    Comment


      #3
      Hi Kate,

      can you please tell me how to adopt account position when enabled? I can't find that on the strategy builder, do i just change this text in the code? Why was this taken out of the startegy builder?

      thank you!

      Comment


        #4
        Also, can you help me with this code: does this give me my total position size for this account: Thank you

        Convert.ToInt32(TotalAccountPosition.Quantity)

        Comment


          #5
          Hello Austiner87,

          Thank you for your reply.

          The ability to select Adopt Account Position in the Strategy Builder was removed in version 8.0.22.0 because the Strategy Builder was unable to set IsAdoptAccountPositionAware, which must be set to true in order to use it. https://ninjatrader.com/support/help...itionaware.htm

          It would not be possible to create a strategy that can adopt the account position in the Strategy Builder, you would have to unlock your code and manually add the necessary logic.

          Here's a relatively simple example that will adopt an existing account position and add a stop and target for the adopted position that one of my colleagues created. Note that when imported, it can be found in a folder at the top of the list called "AlanStrategies".

          Please let us know if we may be of further assistance to you.
          Attached Files
          Kate W.NinjaTrader Customer Service

          Comment


            #6
            Hello Austiner87,

            Thank you for your reply.

            Originally posted by Austiner87 View Post
            Also, can you help me with this code: does this give me my total position size for this account: Thank you

            Convert.ToInt32(TotalAccountPosition.Quantity)
            No, you'd want to use PositionAccount.Quantity, which will give you the position size for the instrument/account combination on which the strategy is running. PositionsAccount[0].Quantity would be used if you have multiple data series in use within the strategy and wish to get the position for the primary series the strategy is running on.



            Please let us know if we may be of further assistance to you.
            Kate W.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by jaybedreamin, Today, 05:11 PM
            0 responses
            2 views
            0 likes
            Last Post jaybedreamin  
            Started by giogio1, 10-30-2024, 02:27 AM
            8 responses
            58 views
            0 likes
            Last Post giogio1
            by giogio1
             
            Started by owen5819, Today, 04:51 PM
            0 responses
            4 views
            0 likes
            Last Post owen5819  
            Started by samish18, Today, 03:57 PM
            1 response
            6 views
            0 likes
            Last Post NinjaTrader_Jesse  
            Started by owen5819, Today, 09:48 AM
            2 responses
            11 views
            0 likes
            Last Post owen5819  
            Working...
            X