1

I've been able to launch this program (ninjatrader) from within my C# Forms program.

enter image description here

private Process process;
process = System.Diagnostics.Process.Start(@"C:\Program Files (x86)\NinjaTrader 8\bin64\NinjaTrader");

I would like to also enable the checkbox named "Enabled". So far I haven't found a way to do this. I have access to Ninjatrader directly through witing indicators in C# but there is no documentation on how / if you can enable a checkbox. Anybody have any Ideas? - Thanks so much!

Westsider
  • 145
  • 12
  • You can only do this if NinjaTrader exposes some sort of programming interface. Most trading apps do, go check that out. – Ian Ray Sep 27 '17 at 17:52
  • Have you already searched their help? Might be something under [Automated Trading Interface Commands and Valid Parameters](https://ninjatrader.com/support/helpGuides/nt7/zordertype.htm?commands_and_valid_parameters.htm) or [NinjaScript Strategy Language Refrence](https://ninjatrader.com/support/helpGuides/nt7/zordertype.htm?strategy.htm). If that doesn't help, you might search in the [Strategy Development Forum](https://ninjatrader.com/support/forum/forumdisplay.php?f=69) (or ask a question there). – Rufus L Sep 27 '17 at 18:03
  • With SendMessage and PostMessage is possible to do it, but the code is too long for StackOverflow. This example may help you: https://www.codeproject.com/Articles/487938/Re-Active-Disabled-Controls – Gusman Sep 27 '17 at 18:04
  • Thanks for the ideas, I have searched the Help and the question has been asked before. Ninja trader says this cannot be done from within ninjascript... I’m going to do some more digging. Since ninjascript is C#, I’m sure there is some way. – Westsider Sep 27 '17 at 18:06

1 Answers1

1

You'd most likely want to go down the path like so:

  1. Get the handle of the check box

    • Use something like spy++ (or an equivalent tool) to get the handle of the check box. Check out this link
  2. Once you have the handle you'll need to send a windows message to it. There are various ways to do it. The article I mentioned already has one way. This post has some sample code once you have the handle as well.

There are also various libraries out there that help out with native functions. https://github.com/AArnott/pinvoke

https://github.com/prasannavl/WinApi

You can also go down the code-only route of enumerating through all of the handles of that process and finding the check box.

Cory
  • 1,794
  • 12
  • 21