• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

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.
              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
              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.
                Patrick H.NinjaTrader Customer Service

                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.
                    Patrick H.NinjaTrader Customer Service

                    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 Gregorian, Today, 02:05 PM
                      2 responses
                      12 views
                      0 likes
                      Last Post Gregorian  
                      Started by smf2005, Today, 01:49 PM
                      6 responses
                      17 views
                      0 likes
                      Last Post smf2005
                      by smf2005
                       
                      Started by punkiy2111, Today, 02:00 PM
                      2 responses
                      5 views
                      0 likes
                      Last Post punkiy2111  
                      Started by hunter7, Today, 12:44 PM
                      3 responses
                      17 views
                      0 likes
                      Last Post NinjaTrader_PatrickG  
                      Started by aaadetos, Today, 12:29 PM
                      2 responses
                      6 views
                      0 likes
                      Last Post aaadetos  
                      Working...
                      X