Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

ChartToCSV reversion > CSVtoChart to plot stored data in Excel file into a NT8 chart

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    ChartToCSV reversion > CSVtoChart to plot stored data in Excel file into a NT8 chart

    Good afternoon Paul

    First of all, thanks to you and the NinjaTrader team for sharing the ‘ChartToCSV’ script. I think it will be helpful for many users.

    Now, If possible, I would like to request to have the opposite version of this script that would be one that when you previously have the data in a CSV or Excel document (.XLSX/.XLS) it would plot the data in a chart, i.e. a kind of ‘CSVtoChart’ script that makes something like the inverse process that ChartToCSV actually makes.

    For example in actual my case, I have supplementary data in CSV or even in .XLSX files that I need to get it plotted in a chart to complement a main graph that is in a NT8 chart.

    The data in the Excel file could come for example from an indicator not available in NinjaTrader 8 or similar situations about data that comes outside NT8, data in a similar format like the one you show in the video tutorial of ChartToCSV, or as the 1st attached picture below.

    As reference, I tried to get a solution with the posted in the next old thread with the ‘ExcelToNT.cs’ but the NT8 NinjaScript Editor does not even allowed me to compile the code into that .cs file (2nd attached picture below), and I couldn’t tried that script, however it doesn’t seem a clean easy-to-follow solution as the user says in the post:
    https://ninjatrader.com/support/foru...827#post838827

    I also know there are alternatives like ‘SampleStreamReader_NT8.zip’ but that would be more focused to import data for calculation purposes and not to plot the data into a chart as seems that ‘ExcelToNT.cs’ could be able to do.
    https://ninjatrader.com/support/help...o_read_fro.htm

    I hope it would be possible to develop a so useful tool like this

    Thank you in advance!




    Click image for larger version

Name:	CSVtoChart - Excel Format.png
Views:	551
Size:	54.4 KB
ID:	1180715


    Click image for larger version

Name:	CSVtoChart - ExcelToNT.cs compilation error.png
Views:	452
Size:	79.9 KB
ID:	1180716

    #2
    Hello futurenow,

    Thanks for your post.

    My recommendation would be to use the SampleStreamReader to pull in any data that you wish to use in your script. Once the data is pulled in you should be able to process it like any other data including plotting it.

    If you would like something created for you, we can provide a link to programmers in the NinjaTrader Ecosystem that would be able to meet your needs.
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_PaulH View Post

      My recommendation would be to use the SampleStreamReader to pull in any data that you wish to use in your script. Once the data is pulled in you should be able to process it like any other data including plotting it.
      Thank you for your recommendation Paul, I understand the process to pass from external data to a chart can be worked with SampleStreamReader, and I just would suggest maybe as future development to have a more direct way to chart the data from a CSV/Excel file, in a similar fast way as ‘ChartToCSV’, without the need to code.


      Comment


        #4
        About the ChartToCSV itself, I’ve tried using the script in some different charts to get the chart data into a CSV file, but in all the cases the script top-right green button in the chart doesn’t pass from the status “Writing data”, and I always wait for everything is fully loaded/calculated in the chart, so I don’t understand why it is not working.


        As reference:

        - I tried with different charts, with and without indicators loaded, even with just a simple chart with the ES 03-22 with daily bars and 20 days of data, to try with something as simple as possible, but no exported data.

        - I tried in 2 different PCs with the last 2 NT8 platform version updates, one PC with the 8.0.25.0 64-bit and the other PC with the 8.0.24.3 64-bit.

        - I tried to restart NT8 after the script import process.

        - I tried adding, removing, re-adding the script in multiple times.

        And after try all this, what I see is that as soon the script is loaded in the chart it instantly creates an empty CSV file in the ‘…Documents\NinjaTrader 8’ folder with the name format of “ES Sunday 1551.csv” but always with 0 KB size, and the empty file is created before to press the “WriteData” button, i.e. the empty file is created right after click in OK after being added in the chart. Finally I tried to leave the script running in the “Writing data” status for more than 1 hour and it never passed from that status, i.e. it never showed the button gold status as “Done” as you show in your tutorial and of course the file kept in 0 KB (empty).

        As extra reference, I don’t know if maybe the PC clock/calendar format could affect to this, because I don’t use US format, however I quickly tried to use the US date format, but the exact same null result.

        What could be happening here? Because in your tutorial I see the “Writing data” status takes around 2 seconds as much but in my case, in 2 different PCs I haven’t gotten any single chart data in a CSV file.

        Thank you

        Click image for larger version

Name:	CSVtoChart script keeps in ''Writing data'' status - Not doing the writing process to the CSV file.png
Views:	493
Size:	34.9 KB
ID:	1181390

        Comment


          #5
          Same here, worked a couple times, and now not working. Hopefully this can be fixed because this would be an extremely helpful indicator.

          Comment


            #6
            Hello futurenow,

            Thanks for your post.

            The ChartToCSV indicator should perform as demonstrated in the video in that it would only be a few moments after clicking the button to write the data and then the button would show Done and the file would be closed.

            You've done a good job testing/covering all of the considerations I would have asked (trying in a simple chart, ensuring that you wait until the chart/indicators complete the loading process, removing from chart and trying again) so thanks for that.

            One last check you might try, if you haven't already, is to open a New>Ninjascript output window and then apply the indicator to a chart and advise if you see any information printed there. Also, once you click the button, go ahead and remove the indicator from the chart, then check to see if the CSV file has been populated or partially populated.

            Please send your log and trace file to ScriptingSupport[at]Ninjatrader[dot]com (replace [at] and [dot] with the correct symbols).
            Mark the e-mail subject as "Atten: Paul Ticket # 3385839". In the e-mail, please include a link to this thread for reference.

            Please follow the steps below to manually attach your log and trace files to your e-mail:
            • Open your NinjaTrader folder under, "Documents" (sometimes called, "My Documents")
            • Right click on the 'log' and 'trace' folders and select Send To> Compressed (zipped) Folder.
            • Send the 2 compressed folders as attachments to the email.
            • Once complete, you can delete these compressed folders.


            Paul H.NinjaTrader Customer Service

            Comment


              #7
              Hello tunabomb,

              Thanks for your post.

              1) Please make sure that after you add the indicator to the chart that you do wait until the chart bars and indicators have finished loading/calculating and then press the button.
              2) If that does not work, please create a simple chart and add a single indicator such as an EMA or SMA and test again.

              If neither of these produces results, please send your log and trace file to ScriptingSupport[at]Ninjatrader[dot]com (replace [at] and [dot] with the correct symbols).
              Mark the e-mail subject as "Atten: Paul Ticket # 3385839". In the e-mail, please include a link to this thread for reference.

              Please follow the steps below to manually attach your log and trace files to your e-mail:
              • Open your NinjaTrader folder under, "Documents" (sometimes called, "My Documents")
              • Right click on the 'log' and 'trace' folders and select Send To> Compressed (zipped) Folder.
              • Send the 2 compressed folders as attachments to the email.
              • Once complete, you can delete these compressed folders.
              Paul H.NinjaTrader Customer Service

              Comment


                #8
                Originally posted by NinjaTrader_PaulH View Post

                1) Please make sure that after you add the indicator to the chart that you do wait until the chart bars and indicators have finished loading/calculating and then press the button.
                2) If that does not work, please create a simple chart and add a single indicator such as an EMA or SMA and test again.
                Today I tried one last thing, that was restarting the PC, and after that suddenly the script seems to be working but not for all kind of instruments.

                I see for Futures the script creates and writes the data into a CSV file, but when I try with a Stock/ETF/Index like AAPL, SPY etc. or also with Forex like ‘EURUSD’ then the script doesn’t work and it keeps stuck in the “Writing data” status for minutes and more minutes with an empty 0 KB CSV file. In the last attempt with the '
                AUDUSD' ticker, it started creating the CSV file around half hour ago but still saying "Writing data" as you see in the picture below.

                And yes, I always wait for bars and indicators have finished loading/calculating. All this tried with a new simple chart with only the instrument and an EMA, keeping the process as simple as possible.

                So, for now what I notice is after import/install the script a Windows restart could be needed, however it seems not to be working for other kind of instruments others than Futures, which coincidentally is exactly what I’m needing.

                I don't know if maybe it could be something about the ticker name string format the script is waiting to receive by default

                I hope the indicator can be updated fixing this part


                Thank you for your time Paul!

                Click image for larger version

Name:	CSVtoChart script keeps in ''Writing data'' status with Stock-ETF-Index instruments - Not doing the writing process to the CSV file.png
Views:	459
Size:	86.7 KB
ID:	1181505


                Last edited by futurenow; 12-13-2021, 12:18 PM.

                Comment


                  #9
                  Hello futurenow,

                  Thanks for your reply.

                  I can assure you I tested with Futures, Stocks, and Forex and had no issues and repeated some tests today just as a quick check, again no issues. I've tested with time-based bars and non time-based bars.

                  Interesting that you say it works after a restart. If you could send in your log and trace files that may help to see what the issue might be on your end.

                  Paul H.NinjaTrader Customer Service

                  Comment


                    #10
                    Originally posted by NinjaTrader_PaulH View Post
                    I can assure you I tested with Futures, Stocks, and Forex and had no issues and repeated some tests today just as a quick check, again no issues. I've tested with time-based bars and non time-based bars.
                    For Stocks and ETFs is being used Kinetick EOD data, but I don't think it could be an issue because the chart loads those non-futures instruments as normal without problems.


                    Interesting that you say it works after a restart. If you could send in your log and trace files that may help to see what the issue might be on your end.
                    Files already sent.

                    Thank you for your fast response

                    Comment


                      #11
                      Hi, does this generate a CSV file when the trading hours are set to RTH or other trading hour templates. Seems to do it with instrument settings, but not RTH. Thanks

                      Comment


                        #12
                        Hello tunabomb,

                        Thanks for your reply.

                        Working with member futurenow, I can advise that in order for the indicator to work as expected, the chart needs to be connected to live data. The indicator works within the OnBarUpdate() method so when the button is clicked, on the next incoming tick that triggers the OnBarUpdate() the indicator then reads and writes.

                        If the chart is RTH and you attempt to use the indicator after RTH hours, it will not run until the next RTH session.

                        I will be updating the description to include this critical note.
                        Last edited by NinjaTrader_PaulH; 12-14-2021, 08:24 AM. Reason: Specifically answered the RTH example.
                        Paul H.NinjaTrader Customer Service

                        Comment


                          #13
                          Originally posted by NinjaTrader_PaulH View Post

                          Working with member futurenow, I can advise that in order for the indicator to work as expected, the chart needs to be connected to live data. The indicator works within the OnBarUpdate() method so when the button is clicked, on the next incoming tick that triggers the OnBarUpdate() the indicator then reads and writes.

                          If the chart is RTH and you attempt to use the indicator after RTH hours, it will not run until the next RTH session.

                          Thank you for keep following the thread Paul

                          About "the chart needs to be connected to live data", I have 3 very frequent situations where:

                          - Sometimes I only can make analysis for Equities/ETFs during the weekends or in the evening exactly like at this moment when I writing this message, so no live data in the chart even with a live datafeed because those markets are closed.

                          - For Equities most of time I'm using EOD data with 1D bars because live data is not necessary in those cases for daily bars, so no live data in the chart because there is a delay.

                          - Many other times I want to work in past date ranges like from Jan 2020 to Jan 2021 or any other date range, so no live data in the chart because those are past dates.


                          And some minutes ago I tried to use this indicator again with Equities/ETFs/Indices and I can see it doesn't work in any of these 3 important scenarios, so my question is, wouldn't it be much much much practical and simplified for the users if this ChartToCSV indicator just simply writes what is currently loaded in the chart and done without these kinds of complications? because yes, if you use it as maybe you have tested during standard market hours in the day and with full live data, of course the normal would be it works fine, but what about when you need to work doing analysis during weekends or in the evening where the market is closed for Equities/ETFs i.e. no live data? or even also for Futures but during the weekends/holydays...?


                          In my case I have been trying with this indicator since this past weekend and no way to get Equity/ETF/Index data in a CSV, and exactly around 1 hour ago was when I could work with a datafeed with live data for Equities/ETFs/Indices, and once again the indicator doesn't pass from "Writing data", i.e. the only time where I could see data written in CSVs was yesterday because it was with Futures when the market was open, but Futures is another different topic.


                          As I said, I just tried with a datafeed that have live data for Equities/ETFs/Indices and maybe as the bars are not getting new real-time information because those markets are currently closed at this time of the day, then I see the same problem with the indicator being stuck in "Writing data" in a never-ending status.

                          If the indicator just writes what is in the chart independently of the time, or if live or in the past, or if the last bar is closed or running in live, etc. only and simply working with what is currently in the chart, then it would be perfect.


                          Thank you for your help




                          Last edited by futurenow; 05-10-2022, 12:39 PM.

                          Comment


                            #14
                            Hello futurenow,

                            Thanks for your reply.

                            The reason for live data relates to a technical issue I ran into trying to pull the data from all of the other indicators on the chart. It was not my intent starting out to use live data or a button but in order for the correct functionality, I needed to have the user observe for all indicators to finish calculating and then press the button to write the data and then needed the next tick of data in order to trigger the data writing.



                            Paul H.NinjaTrader Customer Service

                            Comment


                              #15
                              Hey Paul! fist of all thak you very much for this script, is very useful... I wonder if tehre's a way to download the data automatically, for instance every week at the same hour?

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by RookieTrader, Today, 09:37 AM
                              1 response
                              7 views
                              0 likes
                              Last Post NinjaTrader_ChelseaB  
                              Started by alifarahani, Today, 09:40 AM
                              0 responses
                              3 views
                              0 likes
                              Last Post alifarahani  
                              Started by Gerik, Today, 09:40 AM
                              0 responses
                              1 view
                              0 likes
                              Last Post Gerik
                              by Gerik
                               
                              Started by KennyK, 05-29-2017, 02:02 AM
                              3 responses
                              1,283 views
                              0 likes
                              Last Post NinjaTrader_Clayton  
                              Started by AttiM, 02-14-2024, 05:20 PM
                              11 responses
                              184 views
                              0 likes
                              Last Post NinjaTrader_ChelseaB  
                              Working...
                              X