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 Hwop38, 05-04-2026, 07:02 PM
|
0 responses
164 views
0 likes
|
Last Post
by Hwop38
05-04-2026, 07:02 PM
|
||
|
Started by CaptainJack, 04-24-2026, 11:07 PM
|
0 responses
318 views
0 likes
|
Last Post
by CaptainJack
04-24-2026, 11:07 PM
|
||
|
Started by Mindset, 04-21-2026, 06:46 AM
|
0 responses
246 views
0 likes
|
Last Post
by Mindset
04-21-2026, 06:46 AM
|
||
|
Started by M4ndoo, 04-20-2026, 05:21 PM
|
0 responses
350 views
0 likes
|
Last Post
by M4ndoo
04-20-2026, 05:21 PM
|
||
|
Started by M4ndoo, 04-19-2026, 05:54 PM
|
0 responses
179 views
0 likes
|
Last Post
by M4ndoo
04-19-2026, 05:54 PM
|

Comment