Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

dll function orders.

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

    dll function orders.

    I have a question regarding the ATI DLL.

    Currently writing an external program that will connected to NinjaTrader every now and then, and thus thought that your ATI would do the thing. I am working in a C++ btw.

    At the moment I have got all the functions working, I can access individual orders, place them, etc. But the only thing that refuses to work is the function Orders.

    currently defined as const char* (__stdcall *OrdersFuncPtr)(char*), which seems to work for every other function.

    Can't find any reason why it shouldn't work, and havn't found any information regarding this in the forums or manual.

    best regards,
    Fredrik.

    #2
    imported post

    There is an oddity with functions returning strings (which ties into memory management consideration in C/C++ code): After calling the "Orders" function you need to copy the returned string to a seperate buffer, since the return buffer will be reused on subsequent calls of ATI functions.

    The same is true for any ATI function return a "string" (which is in fact a pointer to a char buffer).


    Comment


      #3
      imported post

      Currently running a system with TradeStation delivering orders to NinjaTrader, that passes it along to Interactive Brokers.


      I have checked the memory and the function Orders simply doesn't return anything, it doesn't matter which account I use (Sim101 or DU15231). All orders are put by the TS email interface, except for a few which I have place myself through the dll functions. Simply seems like nothing gets written to the memory at all.

      Maybe I use it the wrong way, it should generate a long string containing all the orderids of the API generated orders. I have pending orders, filled orders etc. Is it possible that it runs out of bufferspace or something?

      Afraid I am a bit at lost here :?

      best regards,
      Fredrik.

      Comment


        #4
        imported post

        Ahh, I guess I know the issue: You can't mix TS mail interface and calling ATI methods.

        "Orders" method only reports orders which are placed through ATI and not the TS mail interface. In fact none of the ATI methods works on orders places through TS mail interface.

        Comment


          #5
          imported post

          Tested to only enter orders by the DLL ATI early today but it still doesn't return anything.

          My program is very simple, it places one order that has been hardcoded into the program and then it runs the function Orders. But it is simply the only function that fails to return anything (returns a pointer to the memory allocated by the dll, but its all empty). I included a .zip with the source code just in case.


          The problem is that I want to have an external program to monitor what kind of orders that ninjatrader do everyday and then process and put that information on the web. I noticed that NT uses a microsoft access database, which maybe I could use to get the information out from NT, but somehow I rather do it by using the ATI.


          Attached Files

          Comment


            #6
            imported post

            This is a timing issue: you need to wait a bit until NT updated the "Orders" information through an NT internal callback.

            I suggest doing a "busy wait" (wait and check in a loop), in case you really need to wait until "Orders" returns info the just submitted orders.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by alifarahani, Today, 09:40 AM
            6 responses
            30 views
            0 likes
            Last Post alifarahani  
            Started by Waxavi, Today, 02:10 AM
            1 response
            17 views
            0 likes
            Last Post NinjaTrader_LuisH  
            Started by Kaledus, Today, 01:29 PM
            5 responses
            13 views
            0 likes
            Last Post NinjaTrader_Jesse  
            Started by Waxavi, Today, 02:00 AM
            1 response
            12 views
            0 likes
            Last Post NinjaTrader_LuisH  
            Started by gentlebenthebear, Today, 01:30 AM
            3 responses
            17 views
            0 likes
            Last Post NinjaTrader_Jesse  
            Working...
            X