• 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

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).


    DierkNinjaTrader Customer Service

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

        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.

            DierkNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Branpo, Today, 01:25 PM
            2 responses
            5 views
            0 likes
            Last Post Branpo
            by Branpo
             
            Started by aslane, Today, 12:47 PM
            1 response
            5 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by HavasuTrader, Today, 12:30 PM
            1 response
            10 views
            0 likes
            Last Post NinjaTrader_PatrickG  
            Started by Boonfly8, Today, 12:20 PM
            1 response
            3 views
            0 likes
            Last Post NinjaTrader_PaulH  
            Started by RedDuke, Today, 11:40 AM
            1 response
            6 views
            0 likes
            Last Post NinjaTrader_PatrickG  
            Working...
            X