Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Visual Basic 6 COM interface errors

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

    Visual Basic 6 COM interface errors

    I amtrying to use the Ninja Trader COM interface with Visual Basic 6. I get an error message "ActiveX component can't create object" when trying to create object "Set NT = New NinjaTrader_Client.Client" (see code below). I followed the information in the help file and I added NinjaTrader client reference and it does show up in the object browser.

    VB Code:

    Code:
    Option Explicit
    Dim NT As NinjaTrader_Client.Client
    
    Private Sub Form_Load()
     Set NT = New NinjaTrader_Client.Client <-----ERROR OCCURS HERE
    End Sub
    
    
    Private Sub cmdBuy_Click()
     Dim RC As Integer
     RC = NT.Command("Place", "Sim101", "ER2", "Buy", 3, "Market", , , "Day", "", NT.NewOrderId, "ER2 Daytrade")
    End Sub
    
    
    
    Private Sub cmdSellShort_Click()
     Dim RC As Integer
     RC = NT.Command("Place", "Sim101", "ER2", "Sell", 3, "Market", , , "Day", "", NT.NewOrderId, "ER2 Daytrade")
    End Sub


    Has something changed in the latest version or am I doing something wrong? Any suggestions would greatly be approeciated. My NT version is 5.2.1000.4.



    Thank you, Steve
    Attached Files

    #2
    imported post

    Your post suggests, that your code worked fine with prior NT releases. Please try the following:

    - terminate any app
    - uninstall NT
    - manually remove file <windows>\system32\NtDirect.dll
    - reinstall NT

    Comment


      #3
      imported post

      Dierk,

      Thank you for the quick reply. No my code did not work with a prior release, this code was just created yesterday. I am using the DLL with Tradestion and it works fine.

      I followed your instructions, but I still have the same problem. I tried on two computers. Any other suggestions?Has the COM interface ever been tested in VB 6? I searched throught the forum, but did not find any information.

      Steve

      Comment


        #4
        imported post

        1) Yes, COM interface was tested as any NT feature is tested before publishing.
        2) However, we know that some users have issues with COM which are - for whatever reason - not resolvable.

        -> I suggest code against the DLL as you did from within TS.

        Comment


          #5
          imported post

          Hi Dirk, Hi MarlinTrader,

          I am using Visual Basic 6 - NinjaTraderSimulation (new customer)and have never used Tradestation. I have the same problem (run time error 429 - Cannot create the object) although the reference is set! Additonally, I don't see how the instance-setting will work:

          Dim nt as NinjaTrader_Client.CLIENT (but the functions are in ICLIENT)

          Set nt = new NinjaTrader_Client.CLIENT (triggers the error)

          I also don't know what this means "I suggest code against the DLL as you did from within TS"

          Please give me acode-sample that works and please explain itlike you do for a child that saves time!

          Thank you very much!

          Vlado


          Comment


            #6
            imported post

            Please consult the docs. If see provided COM sample does not work for you (see below), then I suggest trying the TradeStation DLL interface. There are samples in the docs as well.

            Comment


              #7
              imported post

              Hi Dierk,

              Thank you very much for your prompt answer!

              May I was not clear enough but I am not using TRADESTATION and I don't have it in mind to do it in the future!

              The problem is that that the COM interface (NinjaTrader_Client)is only addable and the file "NtDirect.dll" is not.

              I also searched in the "HELP system"(you call them docs) but I don't have an example that shows me how to cope with the problem in the Visual Basic (NOT Tradestation).

              Please help me because I'd like to trade as soon as possible. Thank you!

              Best Regards and I wish you a happy new year!

              Vlado


              Comment


                #8
                imported post

                Please check out the docs: Automated Tradig Interface -> COM interface and DLL interface.

                Samples are available:
                - in the docs (DLL and COM)
                - DLL interface: see TradeStation or eSignal wrapper code

                Other than that, there are no samples available.

                Happy New Year and all the best for you as well.

                Comment


                  #9
                  imported post

                  Hi Dierk,

                  I'm sorry but the docs doesn't help me. Both the COM interface and the DLL interface don't work in the VISUAL BASIC 6.0 environment!

                  Maybe it is not possible in the FREESIMULATION EDITION.

                  I'd like to trade with Visual Basic via Ninjatrader, nothing else, no Tradestation or Esignal. Please check it or tell me simply that it doesn't work and I have to look for another solution.

                  Thank you!

                  Best Regards!

                  Vlado


                  Comment


                    #10
                    imported post

                    Hi Vlado,

                    Unfortunately we do not have the internal resources to test in the VB environment. Theoretically it should work but obviously your experience suggests otherwise. You could alternatively use the File interface and have your VC app write out files and read files to interface with NT.

                    Ray
                    RayNinjaTrader Customer Service

                    Comment


                      #11
                      imported post

                      Vlado,

                      I was able to make the DLL work successfully with VB 6. Attached is a ZIP file with a simple order entry VB 6 application that I created that should get you started. There are no comments, but the code is should be easily understood.

                      Steve




                      Comment


                        #12
                        imported post

                        Marlin,

                        Thank you very much! Somehow, there were duplicate postings sodeleted one but that seem to have blown away the attachment. Would you beso kind to post the attachment again? Sorry for the inconvenience.

                        Ray
                        RayNinjaTrader Customer Service

                        Comment


                          #13
                          imported post

                          VB 6 Application Attached
                          Attached Files

                          Comment


                            #14
                            imported post

                            Hi MarlinTrader,

                            Thank you very much! I could see the light but it is still far away!

                            Positive: Your program showed me how to work with the DLL. I have successfully tested 2 functions, viz. Connected & command. I've placed market orders.

                            Negative: All other functions doesn't work.You can also see this by trying your Button"Get Order Id".And I miss the functions for receiving the real time tick data. I tried to define the functionGetDouble in the following way:

                            Private Declare Function GetDouble Lib "NTDirect.dll" (ByVal instrument As String) As Double

                            But it triggered an error! I also tried the functions Orders & OrderStatus and they doesn't work like the others, although it doesn't force an error.

                            Please help me, I'd like to trade as soon as possible!

                            Vlado

                            Comment


                              #15
                              imported post

                              The ATI does not provide market data. There are no functions designed for that. There are some functions forsetting market data from an external source. This is so external applications, such as a charting application can drive NT as a simulator.

                              Ray
                              RayNinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by jeronymite, 04-12-2024, 04:26 PM
                              3 responses
                              40 views
                              0 likes
                              Last Post jeronymite  
                              Started by bill2023, Today, 08:51 AM
                              2 responses
                              16 views
                              0 likes
                              Last Post bill2023  
                              Started by sidlercom80, 10-28-2023, 08:49 AM
                              167 responses
                              2,260 views
                              0 likes
                              Last Post jeronymite  
                              Started by warreng86, 11-10-2020, 02:04 PM
                              7 responses
                              1,362 views
                              0 likes
                              Last Post NinjaTrader_Manfred  
                              Started by Perr0Grande, Today, 08:16 PM
                              0 responses
                              5 views
                              0 likes
                              Last Post Perr0Grande  
                              Working...
                              X