NinjaTrader.exe logging on

A while back a forum member (old forums) devatechnologies, posted some code to automate logging on to NinjaTrader.exe.

I think it worked only once or twice on my system so, I moved on.

Some time became available and I looked into the failure to reliably log on and found a couple of reasons.

Based on devatechnologies’ example I created a new program that reliably logs on for me. I posted it to GitHub (GitHub - EverestSoftwareLLC/NJLogon: Ninja-Trader-Logon).

The source code and a compiled and signed exe are included.

1 Like

Hello MarkMarks,
I use Deva’s daily, reliably (except when NT login servers down - more common than should be).

Don’t know if you’re aware they updated the first iteration which used mouse position to enter pw field, to using login screen window handle which I’ve found eradicates problems related to first.

But, I’m always interested in ‘better’ esp if likely preempts possible problems down the road

Could you kindly elaborate what advantages your’s introduces over Deva’s latest.
I see the addition of clock sync, have read Readme etc but still not sure (I’m not a programmer)

Thanks to you, Deva & any and all who benevolently share this stuff. Simply using a program should not be as hard as NT make it

A timeout was added. Deva was a fixed time and I noticed sometimes, it timed out before NJT was to the point of displaying the window. NJT also did not always return the correct window handle. I iterate all window handles until I find the correct window handle name. Has verbose debugging data in the console window, if needed. And the user name, if needed. For me, the timeout, wrong window handle and sync the clock are the major points.

Thanks for that - actually all are indeed issues I’ve also seen with Deva v2 but ‘good enuff’ & does the job. But this looks like being the complete solution. Thanks for doing & explaining, I appreciate on both counts :+1:

“If any parameter value has a space character, wrap the data in double quotes “this has spaces”” - this appears to apply to any special characters i.e. exclamation “!” for example. I didn’t test extensively, just popped “” around myPassword which does not contain spaces but does include !
Maybe just instructing to include the password inside “” whatever its’ composition would simplify, being ‘all encompassing’. Which was the case for Deva’s source project I believe.
So far so good! :grinning_face:

Thanks for the update.

Minor wish - it adds a taskbar shortcut to the Console. Any way to prevent?

I do not know that that means. There is nothing added to the taskbar. “Taskbar console”, don’t know what that is. Picture?

screenshots attached
‘Taskbar’ - taskbar at DuckDuckGo
"There is nothing added to the taskbar. " - capture1 - 2x NT icons, LH is shortcut to Console, Terminal Window, whatever you may prefer to call it. RH is NT
““Taskbar console”, don’t know what that is” - not a quote “”, not my words
"The program is a console application (64 bit). " - yours
““Taskbar console”, don’t know what that is” - me neither, not a quote, not my words
See capture6 -
When I first used, iirc it failed. Oh well, thought due to pw ‘special characters’ bug, tried again, worked and thereafter.
Today, fresh pc boot, same again on first run. 2nd run and thereafter, works
iirc msgs in Terminal window have been Address 1, sync 1 (or something to do with clock), Time 1
I’ve increased timeout to 60, makes no difference

So, it ‘fails’ on first iteration and the taskbar shortcut is simply because having failed the debug window is running but not visible

It launches NT then the login screen ‘just sits there’ - no evidence of entering pw etc
On second run and thereafter, it enters pw within a second max 2

Capture1



Capture5

“Nothing added to the taskbar” means “I” do not add anything to the taskbar. The OS might display an icon of the console window in the taskbar. That it has the icon of NJT is odd.

Today, fresh pc boot, same again on first run. 2nd run and thereafter, works

Yes, I have noticed a few times a “DLL failed to load message”. Not sure what that is about, will need to investigate who is generating the message.

So, it ‘fails’ on first iteration and the taskbar shortcut is simply because having failed the debug window is running but not visible

Not sure that that means. Only one window, from me. The console window.

It launches NT then the login screen ‘just sits there’ - no evidence of entering pw etc On second run and thereafter, it enters pw within a second max 2

Yes, I have discovered a third issue with NJT. At times, it will create the login window but, not show it, make it visible. I assume it has something to do with accessing a server. It is on my list to add some code to try an detect the issue.

Please enable verbose “/verbose” and let me know what is displayed.

The “Timer X” line in the console window is just a method to show the program is running and not frozen. Plus, it indicates when the window will close due to timeout. It increments once per second. If is stops incrementing and the window does not close, something is stuck. Verbose will display the message. Failures should log something and wait for key press to continue.

“I” vs “Your” as in yes - the shortcut in the taskbar is to the NJLogon Console window. I ‘wondered’ why NTIcon, but only a short while, above my paygrade
a “DLL failed to load message” - haven’t seen ref to DLL. Howqever if it is during running of Logon it executes too quickly for me to see.

“Please enable verbose “/verbose” and let me know what is displayed.”
will do

A new NJLogon.exe has been uploaded to the GitHub link.
Handled an issue with logging when verbose is enabled.
When verbose is enabled and the program is about to close, closing is paused until a key is pressed in the console window.

Is that a capture with the current version (1.1.01) and was logon successful?

First screenshot is fail, second is success

Thanks, need to add more debug logging.

A new version has been uploaded with more logging information.