Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
EasyLanguage to NinjaScript
Collapse
X
-
Correct, it would not be expected to connect automatically based on a Command.Originally posted by RobinT View Postwhen 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
-
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
-
[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
-
This does not return 0 if successfully connected, it returns 0 if setting the last price was successful.Originally posted by RobinTif (Last(sym, close, 100) == -1)
This returns 0 if connected successfully.Code:int Connected(int showMessage)
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?Originally posted by RobinTTearDown() returns 0, but does not disconnect.
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
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
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
351 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
105 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
560 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
561 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment