It would be a good to add one button in toolbar of Visual Studio (here is a sample of it), so clicking on that button, should trigger the "compile" of NinjaScript Editor (exactly when we click F5 in NS editor).
So, we could work on indicators in VS, without need to use NinjaScript editor, which lacks many simples notepad functionalities even (requested many timed, but they will never been implemented as i see), so we could work in Visual Studio, and changes would reflect quicker, without need of Restart of Ninjatrader.
I've tried this code, but fails in Visual Studio:
bool ShowErrors = true; bool ShowWarnings = false; try { var result = NinjaTrader.Code.Compiler.Compile(true, false, null, null); for (var i = 0; i < result.Errors.Count; i++) { if ( (ShowErrors && ! result.Errors[i].IsWarning) || (ShowWarnings && result.Errors[i].IsWarning) ) { string msg = (result.Errors[i].IsWarning ? "Warning" : "Error") + " ::: " + result.Errors[i].ErrorText; Console.WriteLine(msg); } } } catch(Exception e) { Console.WriteLine(e.ToString()); }
neither this worked:
NinjaTrader.Gui.HotKeys.NinjaScriptEditorHotKeys x= new NinjaTrader.Gui.HotKeys.NinjaScriptEditorHotKeys(); x.Compile();
var x=new RoutedUICommand("Compile", "Compile", typeof(NinjaTrader.Gui.Tools.NTWindow)); x.Execute(this, null );
Comment