I'm facing an annoying problem concerning the start up of NT8.
After starting the application, I see the following exception with in immediate shutdown without having the chance to react.
I added my own implementation of an indicator which is using the system clipboard to store some price data. The following function does the job:
private void setClipboard()
{
try{
int multiply = BarsPeriod.BarsPeriodType == BarsPeriodType.Day ? 24 * 60 * 60 : 1;
int timeframeMin = multiply * BarsPeriod.Value;
string text = "" + timeframeMin + "; " + sequenzen.Last().sigHochTiefList.Last().high + "; " + sequenzen.Last().sigHochTiefList.Last().low + "; "
+ ATR(Close, 14)[1];
Thread thread = new Thread(() => Clipboard.SetText(text));
thread.SetApartmentState(ApartmentState.STA); //Set the thread to STA
thread.Start();
thread.Join();
} catch (Exception ex) {
Print(ex.Message.ToString()+"\\n" + ex.StackTrace.ToString());
}
}
I'm a Java guy without experience in the C# universe. To me, catching an exception should not cause an app to crash. Obviously in the C# world things are a little different.
My questions are:
1. How do I (unharmfully) recover NT to perform a normal startup?
- to me it seems, that all the script compiling is resulting in the "NinjaTrader.Custom.dll" file - is that correct?
- my naive thoughts are that deleting this file might NT force to do a complete recompile - didn't try so far
2. How can I modify my code to use the system clipboard in an safe way?
- just looking at the code in this second, maybe I have to place the try - catch around the Lamba expression ;-) could make sense...
Thanks in advance,
Martin
Comment