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

Start my strategy when my account has existing bought stocks.

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

    Start my strategy when my account has existing bought stocks.



    My goal is, when my strategy starts, it can sell my existing bought stocks in my account. This stock could be bought manually.
    I don't need to handle pending orders. All previous pending orders are cancelled. I only need to handle existing bought stocks.

    It seems all available options for "Syncing Account Positions" don't fit my needs:
    1) Wait Until Flat
    This option doesn't work as my Account position is not flat

    2) Wait Until Flat, Sync account
    This option doesn't work, because the strategy needs to submit a market order to flat my account. I need sell my stock using the strategy.

    3) Immediately submit
    4) Immediately submit, Sync account
    Without using EnterLong() first, I cannot use ExitLongLimit() to sell my existing stock from my account.

    5) Adopt account position
    This option handles orders only. So it doesn't resolve my needs.


    Currently I can only use unmanaged method to sell my existing stocks, is there a way to use managed method to sell? Thanks.




    #2
    Hello localappleseed,

    Thank you for your post.

    Adopt account position doesn't only handle active orders, it causes the strategy to adopt whatever the current position is for the account/instrument combination. I'm attaching a simple example that can be applied to an instrument on which you have an open position. Depending on whether the account is long or short when the strategy is started, it submits protective orders for that position. This could be modified to instead exit the open position. The attached example strategy my colleague created uses the managed approach as well.

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

    Comment


      #3
      Kate, thank you so much for your reading my requests and providing the exact what I needed for so long. I will try what the sample code has done and resolve my issue. I may bother you later for this.
      Again, your help is greatly appreciated!

      Comment


        #4
        It is amazingly working when I use your provided sample code. This indeed resolves my problem. I am very happy for this!

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by DJ888, 04-16-2024, 06:09 PM
        6 responses
        18 views
        0 likes
        Last Post DJ888
        by DJ888
         
        Started by Jon17, Today, 04:33 PM
        0 responses
        1 view
        0 likes
        Last Post Jon17
        by Jon17
         
        Started by Javierw.ok, Today, 04:12 PM
        0 responses
        6 views
        0 likes
        Last Post Javierw.ok  
        Started by timmbbo, Today, 08:59 AM
        2 responses
        10 views
        0 likes
        Last Post bltdavid  
        Started by alifarahani, Today, 09:40 AM
        6 responses
        41 views
        0 likes
        Last Post alifarahani  
        Working...
        X