Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
Partner 728x90
Collapse
NinjaTrader
Mr C
Collapse
X
-
Mr C
Hello- Currently I have a strategy that dumps a bunch of data from my strategy directly into an Excel file. I'm referencing the Microsoft.Office.Interop.Excel file in my code. The problem I'm having is that the program reliably crashes during data transfer. I'm getting an HRESULT Busy exception which has to do with the fact that Excel only works from a single threaded condition whereas the strategy, through the interop program, sends multiple threads. I implemented an Imessagefilter in an attempt to fix this. That C# code is loaded in the strategy directory and appears to be working. The only thing left for me to do is to set the thread to single (Single Thread Apartment ) via the [STAthread] reference. But for some reason this doesn't appear to be working since I'm getting a message that the thread is still MTA (Multiple Thread Apartment) when I run the code. This error message is coming from my Imessagefilter code I mentioned earlier. Is there a way to properly set the thread to STA?
Tags: None
-
Hello,
Thank you for the post.
Update:
I modified the indicator so that it does not freeze the UI thread. I just put the Excel writing in OnTermination() so the UI thread will halt for the time it takes to write the entire bar array to the file.
I am going to do some testing and will be back with a reply shortly. If you can post a simple example of how you are doing this it will allow me to better assist.
I look forward to assisting further.Attached FilesChris L.NinjaTrader Customer Service
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by linkcou, Today, 07:01 AM
|
0 responses
1 view
0 likes
|
Last Post
by linkcou
Today, 07:01 AM
|
||
Started by brunoviveiros, 02-17-2020, 05:31 AM
|
4 responses
63 views
0 likes
|
Last Post Today, 06:25 AM | ||
Started by volIQ, 03-27-2024, 04:28 PM
|
3 responses
21 views
0 likes
|
Last Post
by RJay
Today, 05:41 AM
|
||
Started by Nickgiaco, 02-26-2024, 10:23 AM
|
2 responses
72 views
0 likes
|
Last Post Today, 05:12 AM | ||
Started by Johndc, Today, 04:39 AM
|
0 responses
8 views
0 likes
|
Last Post
by Johndc
Today, 04:39 AM
|
Comment