Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Esignal NT dll integration re: dll.call functions

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

    Esignal NT dll integration re: dll.call functions

    I am running NT 6.0.1000.1 and esignal 8.0 (build 782). I am using an EFS on the NT sim account now. ATI is active in NT.

    I can call and retrieve values with NTNewOrderId() and NTConnected(). I am also able to place orders in the Sim with NTBuyLimit(orderId, quantity, limitPrice). But when I use the NTFilled(orderId, account) or NTOrderStatus(orderId, account) I run into problems.

    Relevant code:
    PreMain

    dll.addFunction("Filled", DLL.INT, DLL.STDCALL, "Filled", DLL.STRING, DLL.STRING);

    dll.addFunction("OrderStatus", DLL.STRING, DLL.STDCALL, "OrderStatus", DLL.STRING, DLL.STRING);

    Main
    myFilled = NTFilled(orderId);

    function NTFilled(orderId){
    return dll.cal("Filled", orderId, "");
    }

    myOrderStatus = NTOrderStatus(orderId, account); // where account is set globally to "Sim101"

    function NTOrderStatus(orderId, account) {
    return dll.call("OrderStatus", orderId, "");
    }

    I set them up differently to test if adding account made a difference. I have tested both with "Sim101" and "" in the account position for the dll.call

    I first send a call for an NewOrderId with the NT function then send in a limit buy with that ID with the NTBuyLimit function. In NT Control Center I see the order filled (although with a different ID).

    Then I call for information with then above code. "myFilled" shows up as 0 in esignal's log (100 in NT CC) and "myOrderStatus" actually causes the EFS to stall out and esignal to crash.

    I am not sure what I am doing wrong here. Why I can't call any info requiring arguments or parameters and why esignal crashes at NTOrderStatus has me stumped. My being new to programming probably doesn't help.

    Does it have to do with the different orderID's in esignal and NT? Or is it something else?

    Thanks in Advance
    Rich
    Last edited by New2This; 06-06-2007, 12:32 PM. Reason: poor grammar

    #2
    I suggest starting simple:
    - please update to NT6R2 (6.0.1000.2)
    - try the sample NTSample.efs and tweak it step by step until it breaks to isolate the issue

    Comment


      #3
      Ok, done that - still stumped.

      Hey Dierk,

      I downloaded the new version of NT and loaded up the NTSample file. It got to : debugPrint("realizedPnL:" + NTRealizedPnL(''") + "\r\n"); then esignal promptly crashed. Remming that statement out allowed it to work as intended (granted without the ability to call the above function).

      Then I noticed that my EFS code (which is based off the esignal sample code in the NT V6 Help Guide online) is different than the NTSample.efs code. Basically the guide includes another parameter for "account". I understand that unless I want to run multiple accounts this parameter isn't necessary. But I do, so I added it in. So the relevant code goes from:

      dll.addFunction("Filled", DLL.INT, DLL.STDCALL, "Filled", DLL.STRING); //in preMain()
      return dll.call("Filled", orderId); //in Main()

      to become

      dll.addFunction("Filled", DLL.INT, DLL.STDCALL, "Filled", DLL.STRING, DLL.STRING);
      return dll.call("Filled", orderId, "");

      I tested NTSample.efs again and it worked same as before the changes. So far so good. Then I do it again with NTOrderStatus.

      So the lines ...
      dll.addFunction("OrderStatus", DLL.STRING, DLL.STDCALL, "OrderStatus", DLL.STRING);
      return dll.call("OrderStatus", orderId);

      become ...
      dll.addFunction("OrderStatus", DLL.STRING, DLL.STDCALL, "OrderStatus", DLL.STRING, DLL.STRING);
      return dll.call("OrderStatus", orderId, "");

      respectively. Mirroring exactly how NTFilled is now set up. Despite NTFilled working fine this change to NTOrderStatus once again crashes esignal.

      The only difference between the two that I can see is one is returned as an Integer and the other as a String.

      What in your opinion (or your colleagues' opinions) is the problem here? And how do I go about fixing it?

      Again I can call for and receive DLL.INT (NTMarketPosition, NTFilled, NTConnected) and DLL.DOUBLE (a number to 2 decimal places?- NTAvgEntryPrice, NTAvgFillPrice). But when I try to call for a DLL.STRING in which I have to pass a parameter esignal crashes.

      As I said before I can use NTNewOrderId fine (no parameters passed to NT Control Center) but when I use NTRealizedPnL or NTOrderStatus esignal crashes.

      Am I the first one to ever have this problem? It seems like such a quirky anomaly. It has to be something I'm missing.

      Thanks in Advance
      Rich

      Comment


        #4
        Several issues:
        1) >>> I downloaded the new version of NT and loaded up the NTSample file. It got to : debugPrint("realizedPnL:" + NTRealizedPnL(''") + "\r\n"); then esignal promptly crashed.

        This needs to work seamlessly. I just tried again here (NT 6.0.1000.2 and eSignal 8.0 build 872) and it worked. I suggest:
        - uninstalling NT6
        - scanning your harddrive for any occurance of NTDirect.dll and remove
        - reinstalling NT6

        2) There is a documentation bug which will be fixed. Thanks for pointing this out. Please follow the code in NTSample.efs.

        Comment


          #5
          And yet again

          Hey Dierk,

          Thanks for the help so far. I appreciate it. Unfortunately I haven't found where I am going wrong yet. As per your advice, I uninstalled NT, searched for NTDirect.dll to verify it was no longer on my computer, rebooted, then reinstalled NT. No change. Esignal crashed at the same point in NTSample.efs.

          I agree that it has to be some sort of software configuration problem if you have it working on your end. So I made sure I had all updates for .Net 2.0 and even installed 3.0 and tried it with each change. No luck.

          Next to be absolutely sure that I had covered all bases I wiped my computer. Deleted the partition, created a new one (to ensure a clean slate as it were). I then loaded Windows XP Pro SP2, updated through windows update, loaded dotnetfx (version 2.0.50727.42 - this is from the link on your website), and re-updated windows through their site (there were .Net specific updates available this time).

          Next I installed NT (ver 6.0.1000.2), confirmed that NTDirect appeared in windows\systems32 directory, then installed esignal (version 8.0 build 782). After turning on the AT Interface and connecting NT with esignal, I then tried NTsample again. Once again esignal crashed when it called the NTRealizedPnL("") function.

          Literally the only software I am running on this computer are: WindowsXPsp2 (and standard programs that are imbedded or updated via microsoft), dotnetfx 2.0, esignal 8.0, and NT 6.2. I am once again at a loss as to what I am missing. I assume that when you said you use esignal 8.0 build 872 that was a typo. But if there is a newer build than 782 please advise and I will use it. I wonder, do I need .net 1.0 as well for some reason or a different version of 2.0? I am just trying to think of what software may be on your system that a) I do not have on mine and b) could have some affect on all this.

          Once again thanks in advance.

          Rich

          Comment


            #6
            1) >>> esignal 8.0 build 872 that was a typo
            Correct. Sorry, should be 782

            2) Are you connected to any other broker/feed than external as you try to through NTSample.dll on a eSignal chart? If so, which one?

            3) I suppose you installed latest Windows updates, no?

            4) .NET 2.0 is not required by NT6.

            5) Any indication which DLL is effected as eSignal crashes? Any screenshot available?

            6) Guessing: ("non-standard") drivers might have an impact on this scenario...

            Comment


              #7
              I don't get it.

              Hey Dierk,

              Let me try to answer your questions.

              2) Are you connected to any other broker/feed than external as you try to through NTSample.dll on a eSignal chart? If so, which one?

              No just eSignal. I created a specific account connection for eSignal (as per your website) but even if I use the generic "External Data Feed" account connection I get the same result.

              3) I suppose you installed latest Windows updates, no?
              Yes all updates provided by "Microsoft Windows Update" website up to Sunday, June 10, 2007.


              4) .NET 2.0 is not required by NT6.
              I assume this is a typoand you meant 1.0. For me NT won't even install without .NET 2.0. A dialogue box pops up that says "This setup requires the .NET Framework version 2.0.50727. Please install....Would you like to do this now?"
              I am running .NET 2.0.50727.
              But it's good to know I don't need any other versions of .NET for NT.


              5) Any indication which DLL is effected as eSignal crashes? Any screenshot available?
              Yes, it crashes whenever it tries to call for a String variable in which parameters are passed to NT first. RealizedPnL DLL for the NTSample.efs and OrderStatus DLL for my efs. I can successfully use NewOrderId which calls for a String but passes no parameters.

              I am attaching a screenshot. I had to crop it to fit you KB requirement but it shows where esignal is hanging up. After I get to this point if I click on the advanced chart, eSignal will either close itself or bring up a crash dialogue box. The dialogue box simply asks if I want to send eSignal information so they can fix the problem sometime in the future. I have sent the data but it could be year/s for anything to come of it.

              Although the values retrieved are all zeroes, had I waited and run this on NYSE during active hours I would have got actual values. It's just that for some reason NT calls EUR A0-FX an "unknown instrument" when the order is placed (despite it showing up in the Instrument Manager under the Instrument Editor for EUR/USD). In any case, if this were the cause of my problem it would crash before it even got to the printlines on the NTSample.efs, which it doesn't.


              6) Guessing: ("non-standard") drivers might have an impact on this scenario...
              No I don't think so. I basically did an Fdisk on my hard drive which to my understanding erases everything on it. Then I installed the following:

              Windows XP Pro service pack 2
              All Windows updates
              .Net 2.0.50727
              New Windows updates (.Net specific)
              NinjaTrader 6.0.1000.2 (confirmed NTDirect.dll is in WINDOWS\system32 directory)
              Esignal 8.0 (Build 782)

              That's all. Any software or drivers came standard on the Windows XP CD.
              As far as I can tell my system matches the software you are using successfully. My system meets or exceeds the hardware requirements for NT and eSignal.

              Any further suggestions for resolving this issue would be appreciated.

              Rich
              Attached Files

              Comment


                #8
                Weird...

                4) Sorry, typo again. Should read: .NET 1.0 is not required by NT6.

                I created a custom version of NtDirect.dll to get more information . Please:
                - terminate eSignal and NT
                - save existing NtDirect.dll from windows/system32 dir
                - overwrite by attachment
                - create a simple EFS script which only (!) calls RealizedPnL
                - execute script and and post first ~5 messages boxes you'll see
                - restore
                NtDirect.dll in windows/system32
                Attached Files

                Comment


                  #9
                  Ok, here it is

                  Hey Dierk,

                  So you know what I am doing on my end. I closed all programs, rebooted computer, replaced NTDirect.dll in the windows\system32 directory with the one you created.

                  I took NTSample and basically just deleted all but the relevant line in main so the code is as follows:

                  function main (){
                  debugPrint("RealizedPnL:" + NTRealizedPnL("") + "\r\n");
                  }

                  I ran this and used printscreen for each new message box. To save space and save you some time I compiled all the message boxes on as a single jpg which is attached.

                  Then I replaced your NTDirect.dll with the original one in windows\system32.

                  Hope this helps find the problem.
                  Rich
                  Attached Files

                  Comment


                    #10
                    So you do get the "Failed to initialize..." box.

                    You should have got this box even with the original NTDirect.dll, no? Please confirm, thanks.

                    This basically means that the COM interface could not be created, which is the cause for all trouble.

                    Comment


                      #11
                      Ok, next try. I created a new version of NTDirect.dll. Please proceed as per below and let me know which error box(es) you get. Thanks in advance.
                      Attached Files

                      Comment


                        #12
                        Here are the results for the latest dll

                        Dierk,

                        Sorry for the delay on this.

                        To answer your first question. No, I don't get the "Failed to Initialize" box with the original NTDirect.dll file. I only get the eSignal crash box (same as #2 in attached).

                        I redid everything with the latest NTDirect.dll file you created and only got one message before the eSignal crash dialogue box.

                        I attached a jpg with both.

                        NT Control Center says it's conected to eSignal and the ATI box on the bottom right of the screen is green as well. Just to clarify.

                        Thanks for all the help with this.

                        Rich
                        Attached Files

                        Comment


                          #13
                          Ok, next try: Please install new NTDirect.dll as before:
                          - terminate eSignal and NT
                          - save existing NtDirect.dll from windows/system32 dir
                          - overwrite by attachment
                          - create a simple EFS script which only (!) calls RealizedPnL
                          - execute script and and post first ~5 messages boxes you'll see
                          - restore
                          NtDirect.dll in windows/system32

                          Please post the message box(es) you'll see. Thanks
                          Attached Files

                          Comment


                            #14
                            no luck

                            Dierk,

                            I replaced the NTDirect.dll with the latest you created. This time though I only got the esignal crash dialogue box.

                            I actually went through all the steps you listed twice in case I had made a mistake the first time through.

                            Rich
                            Attached Files

                            Comment


                              #15
                              Strange...this is not expected.

                              Could you please retry the NTDirect.dll version before and see if you still get the "Failed to initialize..." box.

                              Thanks

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by funk10101, Today, 12:02 AM
                              1 response
                              10 views
                              0 likes
                              Last Post NinjaTrader_LuisH  
                              Started by GLFX005, Today, 03:23 AM
                              1 response
                              6 views
                              0 likes
                              Last Post NinjaTrader_Erick  
                              Started by nandhumca, Yesterday, 03:41 PM
                              1 response
                              13 views
                              0 likes
                              Last Post NinjaTrader_Gaby  
                              Started by The_Sec, Yesterday, 03:37 PM
                              1 response
                              11 views
                              0 likes
                              Last Post NinjaTrader_Gaby  
                              Started by vecnopus, Today, 06:15 AM
                              0 responses
                              1 view
                              0 likes
                              Last Post vecnopus  
                              Working...
                              X