Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Errors when executing the stream reader.
Collapse
X
-
Hello ラリー,
Thank you for your post.
Are you trying to use the debugger in Visual Studio? If so, there are some specific steps that you need to follow in order to prevent error messages such as the one in your screenshot. The steps are listed in our help guide along with helpful images here:
After ensuring that Debug Mode is checked when you right-click in your NinjaScript Editor, please be sure to compile your scripts as well to create the debug DLL. From Visual Studio, you will need to open the debug menu and select "Attach to Process" to attach it to NinjaTrader. I suspect this is what the error you got is referring to; after attaching to NinjaTrader you should be able to run your indicator in NinjaTrader and utilize debugging tools within Visual Studio.
Please let us know if we may be of further assistance.Emily C.NinjaTrader Customer Service
-
Thank you for your reply.
I am not sure if you are trying to use the debugger in Visual Studio, but I am trying to do something like the link below.
After ensuring that Debug Mode is checked when you right-click in your NinjaScript Editor, please be sure to compile your scripts as well to create the debug DLL. From Visual Studio, you will need to open the debug menu and select "Attach to Process" to attach it to NinjaTrader. I suspect this is what the error you got is referring to; after attaching to NinjaTrader you should be able to run your indicator in NinjaTrader and utilize debugging tools within Visual Studio.
Please let us know if we may be of further assistance.
Comment
-
Hello ラリー,
Thank you for your reply and your patience.
The SampleStreamReader script won't work unless the file "MyTestFile.txt" already exists in the NinjaTraer 8 folder on your PC. The SampleStreamWriter script (found here) creates and writes OHLC data to the file, and the SampleStreamReader script will parse through that data and print it to the NinjaScript Output window. If you would like to test the SampleStreamReader script, you will have to import both the SampleStreamWriter and SampleStreamReader scripts into NInjaTrader and add the indicators to a chart. To Import:- From the Control Center window select the menu Tools > Import > NinjaScript Add-on.
- Select the downloaded .zip file
- NinjaTrader will then confirm if the import has been successful.
Critical - Specifically for some NinjaScripts, it will prompt that you are running newer versions of @SMA, @EMA, etc. and ask if you want to replace, press 'No'
Once installed, you may add the indicator to a chart by:- Right-click your chart > Indicators... > Select the Indicator from the 'Available' list on the left > Add > OK
Here is a short video demonstration of the import process:
I have created a video demonstrating how these scripts work together:
Please let me know if I may be of further assistance.Emily C.NinjaTrader Customer Service
Comment
-
Thank you for your reply.
I seem to have been able to output the same, thank you.
You also mentioned that both SampleStreamReader scripts need to be imported into NInjaTrader and the indicators added to the chart, is this possible in Market Analyzer as well?
As another question I would like to ask, I tried to import external CSV data (stocks) and it looks like the attached image, what could be the cause?
Comment
-
Hello ラリー,
Thank you for your reply.
You can certainly use StreamReader for an indicator column in the Market Analyzer, although you will most likely need to modify the script so that different instruments write to separate .txt files; if multiple instruments are updating and trying to access the file to edit it at the same time you could experience some errors that the file "is being used by another process." The file path uses a string, so you could do something like include the instrument name in the string for the path used. For more information about StreamWriter and StreamReader, please see the following publicly available Microsoft documentation:
For your additional question, data must be imported as a .txt file and follow the format as listed in the help guide here:
This means you may need to convert the CSV data you have to a .txt file and ensure it is formatted accordingly.
Please let us know if we may be of further assistance.Emily C.NinjaTrader Customer Service
Comment
-
Hello.
Thank you for your reply.
You can certainly use StreamReader for an indicator column in the Market Analyzer, although you will most likely need to modify the script so that different instruments write to separate .
I could not find which of the items in the link mentioned whether the script could be modified so that the different devices write to separate .
This means you may need to convert the CSV data you have to a .txt file and ensure it is formatted accordingly.
I tried the CSV conversion on the link, but I don't know which item is around which link, so I apologize for the trouble.
Comment
-
Hello ラリー,
Thank you for your patience.
I have modified the SampleStreamWriter and SampleStreamReader scripts to demonstrate one way you could change the file name in the path to include the instrument's name using Instrument.FullName. Please see the attached scripts.
SampleStreamWriterInstrumentNames.zip
SampleStreamReaderInstrumentNames.zip
I'm not sure which CSV conversion you are referring to. One simple way to save a CSV file as a text file is to open it in a program such as Microsoft Excel. Next, select File > Save As. In the folder that opens, change the file type dropdown menu to .txt then give your file a name. Once you click save, your newly saved file will be a .txt file. Otherwise, you may need to do additional research from outside resources regarding how to format your CSV data file into a .txt file that will comply with the requirements for NinjaTrader Historical Data imports.
Please let me know if I may be of further assistance.Emily C.NinjaTrader Customer Service
Comment
-
Thank you for your reply.
I have modified the SampleStreamWriter and SampleStreamReader scripts to demonstrate one way you could change the file name in the path to include the instrument's name using Instrument.FullName. Please see the attached scripts.
SampleStreamWriterInstrumentNames.zip
SampleStreamReaderInstrumentNames.zip
Thanks to your help, those seem to have worked.
I added them to the Market Analyzer, as it seems to have created a text file with multiple data and symbol names.
I'm not sure which CSV conversion you are referring to. One simple way to save a CSV file as a text file is to open it in a program such as Microsoft Excel. Next, select File > Save As. In the folder that opens, change the file type dropdown menu to .txt then give your file a name. Once you click save, your newly saved file will be a .txt file. Otherwise, you may need to do additional research from outside resources regarding how to format your CSV data file into a .txt file that will comply with the requirements for NinjaTrader Historical Data imports.Last edited by ラリー; 09-02-2022, 04:44 AM.
Comment
-
Hello ラリー,
Thank you for the follow-up.
Based on your screenshot, although the file is not in .txt format the formatting of the data itself within the document does not follow the required format for importing. This is specified in the help guide link I shared previously:
For example, if the data in the file is for daily bars, the format would need to be like this:
yyyyMMdd;open price;high price;low price;close price;volume
Sample data:
20061023;1377.25;1377.25;1377.25;1377.25;86
20061024;1377.25;1377.25;1377.25;1377.25;27
20061025;1377.25;1377.25;1377.25;1377.25;24
20061026;1377.50;1377.50;1377.25;1377.25;82
The historical data import tool is not able to read the data points unless they are in the specified formats from that help guide page.
I appreciate your patience. Please feel free to reach out with any additional questions or concerns.Emily C.NinjaTrader Customer Service
Comment
-
Hello ラリー,
Thank you for your note.
That is correct, historical trade data is stored in the database file and you would not be able to import that data aside from restoring a previously saved backup file that was exported from NinjaTrader:
Please let us know if we may be of further assistance.Emily C.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by algospoke, Yesterday, 06:40 PM
|
2 responses
19 views
0 likes
|
Last Post
by algospoke
Today, 07:04 PM
|
||
Started by ghoul, Today, 06:02 PM
|
3 responses
14 views
0 likes
|
Last Post Today, 06:43 PM | ||
Started by jeronymite, 04-12-2024, 04:26 PM
|
3 responses
45 views
0 likes
|
Last Post
by jeronymite
Yesterday, 10:10 PM
|
||
Started by Barry Milan, Yesterday, 10:35 PM
|
7 responses
20 views
0 likes
|
Last Post Today, 06:16 PM | ||
Started by AttiM, 02-14-2024, 05:20 PM
|
10 responses
181 views
0 likes
|
Last Post
by jeronymite
Today, 06:11 PM
|
Comment