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.
    BertrandNinjaTrader Customer Service

    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.
            BertrandNinjaTrader Customer Service

            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()?
                BertrandNinjaTrader Customer Service

                Comment


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

                  Thanks

                  Comment


                    #10
                    Great you got it working!
                    BertrandNinjaTrader Customer Service

                    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 Max238, Today, 01:28 AM
                      1 response
                      22 views
                      0 likes
                      Last Post CactusMan  
                      Started by giulyko00, Yesterday, 12:03 PM
                      2 responses
                      10 views
                      0 likes
                      Last Post giulyko00  
                      Started by r68cervera, Today, 05:29 AM
                      0 responses
                      4 views
                      0 likes
                      Last Post r68cervera  
                      Started by geddyisodin, Today, 05:20 AM
                      0 responses
                      7 views
                      0 likes
                      Last Post geddyisodin  
                      Started by JonesJoker, 04-22-2024, 12:23 PM
                      6 responses
                      38 views
                      0 likes
                      Last Post JonesJoker  
                      Working...
                      X