Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

EasyLanguage to NinjaScript

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

    yes, and I am referring to the dll commands.

    Comment


      Originally posted by RobinT View Post
      Calling any function in the DLL will automatically initiate a connection to the server, but that doesn't seem to happen with Last.
      When you use the Command for the Last price, what is occurring?

      Comment


        when I have connected manually to external the Last is passed through to NT correctly.
        when I am not connected the last is ignored and nothing happens. It does not connect automatically.

        Comment


          Originally posted by RobinT View Post
          when I have connected manually to external the Last is passed through to NT correctly.
          when I am not connected the last is ignored and nothing happens. It does not connect automatically.
          Correct, it would not be expected to connect automatically based on a Command.

          Comment


            the guide says

            int Connected(int showMessage)

            Returns a value of zero if the DLL has established a connection to the NinjaTrader server (application) and if the ATI is currently enabled or, -1 if it is disconnected. Calling any function in the DLL will automatically initiate a connection to the server. The parameter showMessage indicates if a message box is displayed in case the connection cannot be established. A value of 1 = show message box, any other value = don't show message box.

            "Calling any function in the DLL will automatically initiate a connection to the server"

            if that does not work, how do I do it?

            Comment


              Hello RobinT,

              Thank you for your response.

              Please provide the full lines of code used to verify this on your end.

              Comment


                [DllImport("NTDirect.dll")]
                public static extern int Last(string instrument, double price, int size);

                sets up the dll,

                if (Last(sym, close, 100) == -1)
                {
                System.Console.WriteLine("There was an error calling ninja - terminating execution");
                FileOK = false;
                }

                sends the data.

                if there is no connection, one is not established.

                Comment


                  also,

                  [DllImport("NTDirect.dll")]
                  public static extern int TearDown();

                  if (TearDown() == 0)
                  {
                  if (File.Exists(localFilePath + fileName))
                  {
                  try { File.Delete(localFilePath + fileName); }
                  catch { Console.WriteLine("Cannot Delete " + fileName); }
                  }
                  }

                  doesn't work either, so I cant disconnect and reconnect the interface.

                  TearDown() returns 0, but does not disconnect.

                  Comment


                    I would be grateful if you could look at this as I cannot control the datastream without being able to connect and disconnect.

                    Comment


                      Originally posted by RobinT
                      if (Last(sym, close, 100) == -1)
                      This does not return 0 if successfully connected, it returns 0 if setting the last price was successful.
                      Code:
                      int Connected(int showMessage)
                      This returns 0 if connected successfully.

                      Originally posted by RobinT
                      TearDown() returns 0, but does not disconnect.
                      I am guessing but you are determining it is not successful by looking to the Control Center of NinjaTrader and seeing that the External Data Feed is connected, correct?
                      If so, the External Data Feed will always show connected and in green. Even after you call TearDown(). TearDown() returns 0 when your application has successfully disconnected from NinjaTrader, not if the External Data Feed is disconnected in NinjaTrader.

                      Please let me know if you have any questions.

                      Comment


                        yes you are connected, I am looking at the control center. I will look at the response.

                        Comment


                          I understand that the response from Last is if the post was successful, but Last does not seem to connect automatically.

                          Comment


                            Is there anyway of connecting to external automatically on NT startup. I am trying to cutdown user intervention.

                            Comment


                              Hello Robin T,

                              There is not a means in code to automatically connect. You could edit the user's Config but this would not be recommended.

                              Comment


                                Users config? where would I find that?

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                                0 responses
                                605 views
                                0 likes
                                Last Post Geovanny Suaza  
                                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                                0 responses
                                351 views
                                1 like
                                Last Post Geovanny Suaza  
                                Started by Mindset, 02-09-2026, 11:44 AM
                                0 responses
                                105 views
                                0 likes
                                Last Post Mindset
                                by Mindset
                                 
                                Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                                0 responses
                                560 views
                                1 like
                                Last Post Geovanny Suaza  
                                Started by RFrosty, 01-28-2026, 06:49 PM
                                0 responses
                                561 views
                                1 like
                                Last Post RFrosty
                                by RFrosty
                                 
                                Working...
                                X