PDA

View Full Version : Reload Ninjascript via code


jriverac
04-04-2011, 09:31 AM
Hallo,

I wonder if there is a way to do a "reload ninjascript" (F5) on a chart programatically?

For a number of reasons, I sometimes need to do it on my charts, but to do it manually is virtually impossible, any suggestions on how to achieve this via code?

Thanks.

Juan

NinjaTrader_RyanM
04-04-2011, 09:57 AM
Hi Juan,

Unfortunately there is no supported technique for calling Reload NinjaScript programatically. Thank you for the suggestion. We have added this to our internal feature tracking system with ID # 830.

jriverac
04-04-2011, 10:12 AM
Ok.

Hopefully this gets implemented soon....

Meanwhile, someone has any hints on any unsupported technique???

Thanks

Juan

koganam
04-04-2011, 11:39 AM
Hallo,

I wonder if there is a way to do a "reload ninjascript" (F5) on a chart programatically?

For a number of reasons, I sometimes need to do it on my charts, but to do it manually is virtually impossible, any suggestions on how to achieve this via code?

Thanks.

Juan

Take a look at this thread: http://www.ninjatrader.com/support/forum/showthread.php?t=37514&highlight=refresh

mrlogik
04-04-2011, 11:40 AM
You can use the SendKeys() function in C#, and "send" and F5.

zweistein
04-04-2011, 12:34 PM
yes , I am also using SendKeys in several occasions including reload ninjascript.
It is working, but take care of Focus and such. Sometimes you must run a background thread with SendKeys()

regards
andreas www.zweisteintrading.eu (http://www.zweisteintrading.eu)

jriverac
04-05-2011, 01:14 AM
Thank you all for the help!!!

You pointed me on the right direction, I tested it on one chart and it worked!!!

But, now I am worried about the focus if I apply this technique to a few charts... will it work? How can I assure that each chart has the focus when the F5 is sent? Any hints?

Thanks again!!

Juan

neoikon
09-01-2012, 11:44 AM
I use the SendKeys() method as described, but my concern is that this hot key can be changed by the user.

I've used other SendKeys() in the past, but I've stopped and instead "clicked" (from within the code) the tools from the chart's toolbar. Unfortunately, there is no "refresh chart" anywhere on the toolbar for me to "click".

Has anyone come up with a better way to do this from within code?

Thanks!
Daniel

sledge
09-01-2012, 11:55 AM
I use the SendKeys() method as described, but my concern is that this hot key can be changed by the user.

I've used other SendKeys() in the past, but I've stopped and instead "clicked" (from within the code) the tools from the chart's toolbar. Unfortunately, there is no "refresh chart" anywhere on the toolbar for me to "click".

Has anyone come up with a better way to do this from within code?

Thanks!
Daniel

You can add your own button to the toolbar via ChartControl.

But, you'd have to map that callback to the SendKeys

neoikon
09-01-2012, 12:08 PM
You can add your own button to the toolbar via ChartControl.

But, you'd have to map that callback to the SendKeys

Right, that's exactly what I have, a toolbar with buttons, one of which performs some actions, then performs an "F5" to reload the chart. I am just looking for a way to NOT use SendKeys() due to the requirement that the hot key remains unchanged.

Daniel

koganam
09-02-2012, 01:22 AM
Right, that's exactly what I have, a toolbar with buttons, one of which performs some actions, then performs an "F5" to reload the chart. I am just looking for a way to NOT use SendKeys() due to the requirement that the hot key remains unchanged.

Daniel

Try using ChartControl() and Invalidate() the client rectangle.