• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

ntDirect.dll Close a position

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

    ntDirect.dll Close a position

    Good Morning @all,

    I need a bit advice because I don't understand this issue:

    I placed an order via NTDirect.Dll, using a strategy. This works fine, but if I like to close this via the Command(CLOSESTRATEGY) the response is 0 (No Error) but in the Log Tab I see
    the following message:
    OIF, 'CLOSESTRATEGY;;;;0;;0;0;;;;;669ADE6DD50E4EC6BEDF5 B62A59235F5' unknown strategy
    using the following line of code:

    _ntClient.Command("CLOSESTRATEGY", null, null, null, 0, null, 0, 0, null, null, null, null, _ntClient.Strategies(_currentAccount));

    Very interessting at this point, using the same "unkown strategy" ID by _ntClient.StrategyPosition(_uuid) I receive the correct position size....

    Any suggestions?

    Thx for your advice
    Markus

    #2
    Hello Markus,

    Are you supplying the account name and instrument name?

    From the help guide:
    "CLOSEPOSITION COMMAND
    This command will close a position and requires an account name value and an instrument name value. The instrument name value is the name of the NinjaTrader instrument including the exchange name. For equities, the symbol is sufficient. This command will cancel any working orders and flatten the position."
    https://ninjatrader.com/support/help...ingTheCommands
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hello Chelsea,

      as you can see I like to close the position by CLOSESTRATEGY, this is because I opened this by a strategy.
      In the description you wrote, the only 2 parameters I need to fill is the command and the strategieId... this should work. If this is wrong then the description is confusing.

      When I'm using the CLOSEPOSITION command all the open positions are closed within the account and instrument.

      Or I'm wrong?

      Thx
      Markus

      Comment


        #4
        Hello Chelsea,

        once again me...
        I tried the CLOSEPOSITION command, this works. How I get the fill price of the closing command? I have no idea how to get this value.

        Cheers
        Markus

        Comment


          #5
          Hello Markus,

          My apologies, I focused on the wrong command when I went to the help guide.

          In trying to test the CLOSESTRATEGY command I'm finding there may be an issue with the Strategies() method that returns the list of IDs.

          If you Console.WriteLine() the string returned from Strategies() are you finding this is working on your end and properly returning the instance IDs?
          Last edited by NinjaTrader_ChelseaB; 10-10-2019, 08:39 AM.
          Chelsea B.NinjaTrader Customer Service

          Comment


            #6
            Hi Chelsea,

            yes.
            As I wrote in my first post, _ntClient.StrategyPosition(_uuid) gets the right position size of the current running strategy. But using this _uuid by CLOSESTRATEGY the retutn value of the command function is zero, which suggesting everthing is fine, but nothing happens....
            In the LOG tab the id is the same as I'm using and it should work, obviously there is an issue with this command.

            Comment


              #7
              Hello Markus,

              I'm finding if the order is submitted by the external app, the Atm ID is returned but does not if the order is made within NT.

              Once I was retrieving the Atm ID I was able to produce behavior where the position, stop, and target are not closed, but the Active Atm is turned off.

              I've reported this behavior to our development. Once I have a tracking ID for this behavior I will post in this thread.
              Chelsea B.NinjaTrader Customer Service

              Comment


                #8
                Hello Markus,

                I've received tracking ID# NTEIGHT-14090 for this behavior where an active Atm is not fully closed through the API with the CLOSESTRATEGY command.

                As new releases of NinjaTrader become available, please check the release notes for this ID.
                Once the ID is listed, please update and confirm the behavior is corrected.
                Chelsea B.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by DrDave, Today, 04:40 AM
                0 responses
                1 view
                0 likes
                Last Post DrDave
                by DrDave
                 
                Started by AldricJC, Today, 04:24 AM
                0 responses
                3 views
                0 likes
                Last Post AldricJC  
                Started by pman777, Today, 03:37 AM
                0 responses
                3 views
                0 likes
                Last Post pman777
                by pman777
                 
                Started by tff2011, Today, 02:58 AM
                0 responses
                3 views
                0 likes
                Last Post tff2011
                by tff2011
                 
                Started by GrossBitZeCoinTrader, Today, 02:15 AM
                0 responses
                3 views
                0 likes
                Last Post GrossBitZeCoinTrader  
                Working...
                X