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 cmtjoancolmenero, Yesterday, 03:58 PM
            11 responses
            42 views
            0 likes
            Last Post cmtjoancolmenero  
            Started by FrazMann, Today, 11:21 AM
            0 responses
            5 views
            0 likes
            Last Post FrazMann  
            Started by geddyisodin, Yesterday, 05:20 AM
            8 responses
            52 views
            0 likes
            Last Post NinjaTrader_Gaby  
            Started by DayTradingDEMON, Today, 09:28 AM
            4 responses
            27 views
            0 likes
            Last Post DayTradingDEMON  
            Started by George21, Today, 10:07 AM
            1 response
            22 views
            0 likes
            Last Post NinjaTrader_ChristopherJ  
            Working...
            X