Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Inserting historical data to NJ from text file using C#

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

    Inserting historical data to NJ from text file using C#

    Hi,

    I need to develop a C# program which insert the historical data (date, time, high, low, close, volume) from a txt or csv file to NJ. I tried to use Ninjatrader.Client.dll but unable to import historical data row. Please help.

    Regards,
    S.M.Yaseen.

    #2
    Hi smyaseen,
    Originally posted by smyaseen View Post
    Hi,

    I need to develop a C# program which insert the historical data (date, time, high, low, close, volume) from a txt or csv file to NJ. I tried to use Ninjatrader.Client.dll but unable to import historical data row. Please help.

    Regards,
    S.M.Yaseen.
    Are you wanting to import the data as historical data so that the data appears on your chart? Or are you just wanting to read the values into memory for use with an indicator without saving this as historical data?

    If you are wanting to import the data as historical data:
    You can manually import historical data as per the instructions at the link below.
    http://www.ninjatrader.com/support/h.../importing.htm

    Please note that the data needs to be in a certain format, see below.
    Tick Format
    Each tick must be on its own line and fields must be separated by semicolon (.

    The format is:
    yyyyMMdd HHmmss;price;volume
    Sample data:
    20061107 000431;1383.00;1
    20061107 000456;1383.25;25
    20061107 000456;1383.25;36
    20061107 000537;1383.25;14


    If you are wanting to read the data from the file to store in memory and use for an indicator without importing the data as historical data, you can do this with the StreamReader.

    Below is a link to an official reference sample on using StreamReader.
    http://www.ninjatrader.com/support/f...ead.php?t=3476

    Please let me know if I can be of further assistance.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Load History data into Ninjatrader - C#

      Is there a way to push csv/txt history data into NinjaTrader from a C# program? . I know there is a way to do it manually. Can you please tell me how to do it via code?

      Comment


        #4
        Hello globalscholar,

        If you are trying to add historical data to NinjaTrader (and not to a specific running instance of a script) this will not be possible.

        To import you must use the Historical Data Manager with an importable txt file.
        http://www.ninjatrader.com/support/h.../importing.htm
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Hi,

          You said it is not possible if it is not the current running script. So, do you mean that it is possible for me to push History for the current instance of script. If yes, can you please tell me how? . I need it to load the data easily without manual intervention, via code, to simplify things.

          Regards,
          GS

          Comment


            #6
            Hi globalscholar,

            You can read from a file, parse that information, and then add the data to a custom dataseries or an array.

            Below is a link to a reference sample that reads data from a file.
            http://www.ninjatrader.com/support/f...ead.php?t=3476

            Also, here is a link to a reference sample that uses a custom dataseries.
            http://www.ninjatrader.com/support/f...ead.php?t=7299
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Originally posted by NinjaTrader_ChelseaB View Post
              Hi globalscholar,

              You can read from a file, parse that information, and then add the data to a custom dataseries or an array.

              Below is a link to a reference sample that reads data from a file.


              Also, here is a link to a reference sample that uses a custom dataseries.
              http://www.ninjatrader.com/support/f...ead.php?t=7299
              Which of the two files do I download in the first link? Thanks.

              Comment


                #8
                Hello Farmer George,

                If you are running NinjaTrader 7 you would download the file SampleStreamReader_NT7.zip.

                Comment


                  #9
                  Originally posted by NinjaTrader_PatrickH View Post
                  Hello Farmer George,

                  If you are running NinjaTrader 7 you would download the file SampleStreamReader_NT7.zip.
                  Thanks. Still not sure what I'm doing. Essentially, I want to import a CSV file with data, not OHLC data, and then create an indicator from the data and view it on a chart with a given series (COT data has been used in certain example and I'd like to use inflation rates).

                  Comment


                    #10
                    Hello Farmer George,

                    Please let me know if you have any questions after reviewing the reference sample and attempt to implement this for your .csv file.

                    Comment


                      #11
                      Originally posted by NinjaTrader_PatrickH View Post
                      Hello Farmer George,

                      Please let me know if you have any questions after reviewing the reference sample and attempt to implement this for your .csv file.
                      Thanks, will do.

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by DavidHP, Today, 07:56 AM
                      1 response
                      5 views
                      0 likes
                      Last Post NinjaTrader_Erick  
                      Started by kujista, Today, 06:23 AM
                      3 responses
                      6 views
                      0 likes
                      Last Post kujista
                      by kujista
                       
                      Started by Mindset, Yesterday, 02:04 AM
                      2 responses
                      17 views
                      0 likes
                      Last Post NinjaTrader_RyanS  
                      Started by f.saeidi, Today, 08:03 AM
                      1 response
                      5 views
                      0 likes
                      Last Post NinjaTrader_Jesse  
                      Started by samish18, 04-17-2024, 08:57 AM
                      15 responses
                      52 views
                      0 likes
                      Last Post NinjaTrader_BrandonH  
                      Working...
                      X