• 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
      Hi,

      My requirement is that I have an excel file in which I put data, and run a macro which in return generates a CSV file. This file is in a particular format which can be imported in NJ manually. But now I want to develop a service in C# which takes that CSV file, parse it and insert the data in NJ programatically, instead of the manual process.

      I tried using Ninjatrader.Client.dll, but it has only 3 methods to send data, i.e. Ask, Bid, and Last which takes (instrument name, price, size) parameters only. I want to send (Date, Time, High, Low, Close, Volume) parameters.

      I want that data to see in Historical Data and also refresh the chart I have made in NJ.

      Please help.


      Regards,
      S.M.Yaseen.

      Comment


        #4
        Hello,

        Thank you for clarifying.

        Unfortunately, there are no supported ways to programmatically import historical data that can be viewed in the Historical Data Manager.

        While it would be possible to read data from a cvs file (see link below), this would be directly into memory for use with the script but would not be added to the historical data that is seen on the chart.

        Read/write excel file: - http://www.ninjatrader.com/support/f...36938&page=7#1

        If you would like to import the cvs data into NinjaTrader you will need to convert the cvs file to a text file with the proper formatting for import into NinjaTrader. Then you will need to follow the import instructions to import the data.

        See post #2 for the proper format and import instructions.

        Also, I've created a short video for another client for instructions converting a cvs to a txt for import.
        http://screencast.com/t/uJSNRl7GSr
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Simple Moving Average

          Hi,

          Is it possible to import bids from real time data provider like CQG and draw a simple moving average? If so, how to go about doing this task? This is similar to the question originally posted by Yasmeen.

          Comment


            #6
            Hi agassi,
            Originally posted by agassi View Post
            Hi,

            Is it possible to import bids from real time data provider like CQG and draw a simple moving average? If so, how to go about doing this task? This is similar to the question originally posted by Yasmeen.
            CQG does offer historical Bid/Ask Minute/Tick data. Yes, you are able to create a simple moving average of this, however, this data will not need to be imported with the import instructions.

            Instead you will want to set your chart to load the Bid or Ask data and the add the SMA indicator.
            • Right-click your chart -> select Data Series...
            • In the parameters on the right, change the value for 'Price based on' to Bid (or Ask)
            • Click OK
            • Right-click the chart -> select Indicators... -> search for SMA -> click the New button -> click OK
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Import historical bids and asks

              Hello,

              I need to create a simple moving average of historical bids and asks. Is there a way to do this in ninjatrader? I have a lifetime license and get data from CQG. I am aware that the bids and the asks keep on changing every millisecond. Given the scenario, how can some one

              1) Import the historical bid
              2) Then chart a simple moving average of those historical bids
              3) Import the historical Ask
              4) Then chart a simple moving average of those historical asks

              Does the exchange only give 5 bids and asks? Is that the reason why Ninjatrader only displays the best 5 bids as well as the best 5 asks? I know that in other trading platforms like Trading Technologies etc. the ladder i.e. DOM is more than 5 best bids and 5 asks. How are they able to display more than 5? Please shed some light on this. Thanks again.

              Agassi

              Comment


                #8
                Thanks. This is kind of what I was looking for.

                Why does NT show only best 5 bids and best 5 asks? Limitation on software or limitatoin from data provider or exchange? This is still unclear to me.

                Comment


                  #9
                  Hi Chelsea,

                  Thanks for your prompt reply. If I draw the moving average of bids and asks, i shut down NT and then open it again, would NT save all this historical bids and asks? or just like other market profile indicators etc., i loose this?

                  Comment


                    #10
                    Hi agassi,

                    The SuperDOM is limited to the 5 closest rows of bid and ask prices. However, the Level II window is not limited in this way.

                    Yes, the exchange does control the levels of Level II data. Also, the connection technology can also limit the number of levels of the Level II data.

                    The Level II window will need the number of price levels set in the properties. By default this is set to 10.

                    To change this right-click the Level II Window -> select Properties... -> increase the value for '# of price levels' (Summary) (and details if you like).

                    As an example, if you have Kinetick most stocks will have up to 20 levels such as AAPL.
                    Chelsea B.NinjaTrader Customer Service

                    Comment


                      #11
                      Originally posted by NinjaTrader_ChelseaB View Post
                      Hi agassi,

                      The SuperDOM is limited to the 5 closest rows of bid and ask prices. However, the Level II window is not limited in this way.

                      Yes, the exchange does control the levels of Level II data. Also, the connection technology can also limit the number of levels of the Level II data.

                      The Level II window will need the number of price levels set in the properties. By default this is set to 10.

                      To change this right-click the Level II Window -> select Properties... -> increase the value for '# of price levels' (Summary) (and details if you like).

                      As an example, if you have Kinetick most stocks will have up to 20 levels such as AAPL.
                      Hi Chelsea,

                      Thanks again. By level II window, are you referring to NT's Ladder also known as DOM (Depth of the Market)? I am aware of the level II windows on various equities / stock platforms.

                      If I want to chart 2 moving averages on the same screen panel, is there a way to do that? i.e. i want a moving average of bid and moving average of ask on the same chart. is there a way to do this? Thanks again for your prompt response.

                      Comment


                        #12
                        Hi agassi,

                        By Level II window I am not referring to the ladder on the SuperDOM. I am referring to the Level II window.
                        (File -> New -> Level II...)

                        Below is a link to the help guide on the Level II window.
                        http://www.ninjatrader.com/support/h..._ii_window.htm

                        To add a second SMA to your chart using Ask data, you will need to first add a secondary data series of Ask data to your chart.
                        • Right-click chart -> select Data Series... -> on the left select / search for the same instrument -> click the New button to add a second instance
                        • On the right, change the value for 'Price based on' to Ask
                        • Click OK
                        • Right-click the chart again -> select Indicators...
                        • Find SMA again -> click the New button to add a second instance
                        • On the right click the value for 'Input series' -> click the ellipses button '...' that appears
                        • Click the plus to expand the data set '<instrument name> (<interval> - Ask)'
                        • Select the Close
                        • Click OK -> click OK


                        A video that explores something similar to this can be found on the link below.
                        https://www.youtube.com/watch?v=x_6B...A14C398CA140D7
                        Chelsea B.NinjaTrader Customer Service

                        Comment


                          #13
                          Can i graph 2 charts in 1?

                          Hi Chelsea,

                          Is there a way to draw 2 charts on the same page i.e. a graph showing moving average of bids and another graph showing the moving average of ask on the same chart / page? If so, please advise, how I an do this task.

                          Comment


                            #14
                            Hi agassi,

                            Please look at my last post (post #12). The instructions to add a secondary SMA using Ask data are in this post (this instructions are assuming that you already have a primary data series using Bid data from the instructions in post #6.
                            Chelsea B.NinjaTrader Customer Service

                            Comment


                              #15
                              Hi Chelsea,

                              What I wanted originally was this:

                              Say for example right now the CL (Crude Oil) market depth on the bid side is as follows:

                              7 @ 99.35
                              4 @ 99.34
                              9 @ 99.33
                              11 @ 99.32
                              7 @ 99.31

                              I just want to plot a line based on all the bids i.e. 7+4+9+11+7=38. I would like to do plot a similar line on asks. Is there a way to do this on NT?

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by dieci, Today, 03:31 PM
                              0 responses
                              1 view
                              0 likes
                              Last Post dieci
                              by dieci
                               
                              Started by StevenNelson, Today, 03:05 PM
                              2 responses
                              10 views
                              0 likes
                              Last Post StevenNelson  
                              Started by Benjaminf, Today, 02:21 PM
                              1 response
                              10 views
                              0 likes
                              Last Post NinjaTrader_Kate  
                              Started by grayfrog, 05-24-2020, 09:29 PM
                              5 responses
                              32 views
                              0 likes
                              Last Post NinjaTrader_RyanS  
                              Started by chrismcdermut, Today, 01:46 PM
                              1 response
                              9 views
                              0 likes
                              Last Post NinjaTrader_Kate  
                              Working...
                              X