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

Manual trade entered, then strategy should close the trade

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

    Manual trade entered, then strategy should close the trade

    Hi,

    I want to create a strategy that will close a position entered previously, most likely manually. Using Simulated Data Feed I shorted a contract, then enabled the script.

    I have log messages generated to let me know what's happening with the script's logic. The section asking to close a (short) position gets executed but the ExitShort() method is not working. The Dynamic SuperDom shows I still have a contract short.

    What do I need to do to get this running properly?

    Thanks in advance.

    mp

    #2
    Hello marcusplexus,
    A NinjaScript strategy can close any position created by itself only. It cannot close a position which was created manually (using SuperDom or ChartTrader etc).
    JoydeepNinjaTrader Customer Service

    Comment


      #3
      it should work with undocumented methods

      1.) get Position for instrument with Account.Positions
      2.) close position with Position.Close() method

      Comment


        #4
        Hello gplatis,

        Thank you for your post.

        In NinjaTrader 7 these functions are not supported. In NinjaTrader 8 you can refer to our Help Guide that goes into examples on the various functions. Please start at the Account section of the Add Ons in the Help Guide: http://ninjatrader.com/support/helpG...ount_class.htm

        Please let me know if you have any questions.

        Comment


          #5
          I have 2 questions in relation to this thread:

          if talking about NT8:
          1) Can strategy cancel position, opened manually using ATM mechanism?
          2) Can strategy get unique ID and template name of active manually opened ATM strategy?
          fx.practic
          NinjaTrader Ecosystem Vendor - fx.practic

          Comment


            #6
            Hello fx.practic,

            Thank you for your post.

            1. It is possible to close a position an ATM Strategy has opened. This is possible in NinjaTrader 7 as well. In both platforms submitting an order to close the position will close the position regardless of the ATM Strategy running.

            2. This is not possible as the id are generated specifically in the NinjaScript code for the NinjaScript submitted ATM functions and orders.

            Please let me know if you have any questions.

            Comment


              #7
              Excuse me, I want to clarify about bullet 1).


              In post#2, in this thread, NinjaTrader_Joydeep said:
              A NinjaScript strategy can close any position created by itself only. It cannot close a position which was created manually (using SuperDom or ChartTrader etc).
              So, if an ATM was selected in ShartTrader or DOM while manually open, this position can be closed by strategy.
              And, if "None" was selected when manually entered deal - strategy can't close it.

              Is that correct?
              Is that correct for both NT7 and NT8?
              fx.practic
              NinjaTrader Ecosystem Vendor - fx.practic

              Comment


                #8
                Hello fx.practic,

                Thank you for your response.

                The position can be closed by the orders submitted in the strategies in both NinjaTrader 7 and 8. However, the protective Stop Loss and Profit Target that were submitted through the manually submitted ATM strategy will remain.

                Managing manually submitted ATM Strategies is not possible in NinjaTrader 7 or 8 through a NinjaScript strategy that did not submit the ATM Strategy.

                Please let me know if you have any questions.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Christopher_R, Today, 12:29 AM
                0 responses
                6 views
                0 likes
                Last Post Christopher_R  
                Started by sidlercom80, 10-28-2023, 08:49 AM
                166 responses
                2,235 views
                0 likes
                Last Post sidlercom80  
                Started by thread, Yesterday, 11:58 PM
                0 responses
                3 views
                0 likes
                Last Post thread
                by thread
                 
                Started by jclose, Yesterday, 09:37 PM
                0 responses
                7 views
                0 likes
                Last Post jclose
                by jclose
                 
                Started by WeyldFalcon, 08-07-2020, 06:13 AM
                10 responses
                1,415 views
                0 likes
                Last Post Traderontheroad  
                Working...
                X