Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

NtDirect.dll Command function in Delphi

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

    NtDirect.dll Command function in Delphi

    I initiate orders in NinjaTrader directly but want to change the target limit order from my compiled Delphi code. The NinjaTrader function is defined:
    Code:
    FUNCTION Command ( Command, account, instrument, action: pchar; 
      quantity: Integer; OrderType: pchar; limitPrice, stopPrice: double;
      timeInForce, oco, orderID, strategy, strategyID: pchar): integer; stdcall;
      external 'NtDirect.dll';
    I have the order ID so I call the function:
    Code:
    J := Command (pchar('Change'), pchar(''), pchar(''), pchar(''), 
      0, pchar(''), OrderPrice, 0, 
      pchar(''), pchar(''), pchar(OrderID), pchar(''), pchar(''));
    After the call J is zero, but no change has happened to the order.

    I am running with Sim101 as the default NinjaTrader account.

    #2
    Hi Pasado, did yuo check the log tab in the Control Center for any errors?

    Is your OrderPrice is US decimal format?

    Try also 'CHANGE' as the the command value.

    Comment


      #3
      The log tab in the Control Center shows no errors.

      OrderPrice is in US decimal format.

      Changing the command value to 'CHANGE' made no difference.

      Comment


        #4
        Sorry Pasado, we are not Delphi experts, but you need to submit it with CHANGE as the command. Please ensure your order ID is accurate. You can try using OrderStatus() to check it.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          OrderStatus() returns an empty string. My orderID is the same string that appears in the Log tab: 2d9cdc7e00bf44a3a9828462512f6562/Sim101

          Is the API disabled for non paying users?
          Last edited by Pasado; 02-13-2009, 11:47 PM.

          Comment


            #6
            No, test execution to the Sim101 account should work.

            Check into your OrderID, since OrderStatus() returns empty.

            You can also try the OrderID with the /Sim101 portion.

            Comment


              #7
              Using just key part of the orderID produces the same result.

              This time I initialized the return string with some text so I could determine if the string was being set at all. The orderID (both with the account and not) don't set the return string; what I put into the string before the call did not change.

              Comment


                #8
                Do you have the ATI enabled? File > AT Interface?

                Have your tried the a normal PLACE command with the NewOrderId()?

                Comment


                  #9
                  Oh good grief. AT Interface was not active. Now everything works just fine.

                  Thanks

                  Comment


                    #10
                    Great you got it working!

                    Comment


                      #11
                      Pasado,

                      You've probably already got a good working unit interface for Delphi for NT. But, I'm going to post mine in the Automated Trading forum, if it is of use to anybody.

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by NullPointStrategies, Today, 05:17 AM
                      0 responses
                      50 views
                      0 likes
                      Last Post NullPointStrategies  
                      Started by argusthome, 03-08-2026, 10:06 AM
                      0 responses
                      126 views
                      0 likes
                      Last Post argusthome  
                      Started by NabilKhattabi, 03-06-2026, 11:18 AM
                      0 responses
                      69 views
                      0 likes
                      Last Post NabilKhattabi  
                      Started by Deep42, 03-06-2026, 12:28 AM
                      0 responses
                      42 views
                      0 likes
                      Last Post Deep42
                      by Deep42
                       
                      Started by TheRealMorford, 03-05-2026, 06:15 PM
                      0 responses
                      46 views
                      0 likes
                      Last Post TheRealMorford  
                      Working...
                      X