Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Data Streaming Into Excel and connecting Ninja to Excel

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

    Data Streaming Into Excel and connecting Ninja to Excel

    I have live prices flowing into an excel spreadsheet....as a tick happens it is written to excel live....

    naturally i want to use ninjas awesome charting....

    can i connect this column to ninja to get a chart and then if i have a few different columns representing different stocks i am watching can i connect these as well so if i have 1 column, i will have 1 chart in ninja...if i have 2 columns, i will have 2 columns in ninja etc

    appreciate and thanks for you help

    christian

    #2
    Hello Christian,

    You can use the External Data Feed to drive NinjaTrader with data from external applications. Please see the link below for more information.
    JasonNinjaTrader Customer Service

    Comment


      #3
      can you give me abit more help please

      i am stuck basically at the begining

      can u give me a few steps on how to get the live data from excel into ninja trader

      do i have to write a program?

      Comment


        #4
        Yes, you will need to use the DLL or COM interface to setup such a data connection.

        Unfortunately we do not have an example listed. This functionality is targeted to users with programming experience.

        If you do not have any programming experience, you can contact any of the supported NinjaScript consultants at the link below.
        JasonNinjaTrader Customer Service

        Comment


          #5
          I faced a similar problem.. but after researching, here's something to point you in the right direction. What I can do now is
          1) Open excel sheet
          2) read/Write data to/from NJ with Excel
          I still dun know if I can have real time updates to excel, but theoretically it should be possible. Gotta wait for the markets to open

          What I did ->
          1. Reference Microsoft.Office.Interop.Excel.dll from the ninjaScript editor
          2. insert "using Microsoft.Office.Interop.Excel;" in the topmost declaration region
          3. Visit http://csharp.net-informations.com/e...open-excel.htm

          You've gotta familiarize yourself with the excel apis.. the functions for worksheet/cells manipulation.. something which i've yet to do. but with the 3 points and some c# knowledge, at least you'll get the connection with NJ-excel up and running

          Hope that helps

          Comment


            #6
            any success on this?

            did the code work in realtime. If so, would you care to share what you have?

            Thanks in advance,

            Reg

            Comment


              #7
              Originally posted by rkuhne View Post
              did the code work in realtime. If so, would you care to share what you have?

              Thanks in advance,

              Reg
              you can try this http://www.volumedigger.com/NinjaTra...rader_DDE.aspx

              this indicator will make a dde connection to excel where you can stream the data.

              Comment


                #8
                I dunno about pumping data into NJ from Excel, but I can provide you guys with some codes to pump data into Excel from NJ

                1: remember to reference microsoft office excel interop

                2:
                in the Initialize() method, insert code

                xlApp = new ApplicationClass();
                xlWorkBook = xlApp.Workbooks.Open("C:\\spreadheet.xls", 0, false, 5, "", "", false, Microsoft.Office.Interop.Excel.XlPlatform.xlWindow s, "\t", true, true, 0, true, 1, 0);
                xlWorkSheet = (Worksheet)xlWorkBook.Worksheets.get_Item(4);//edit sheet 4
                xlApp.Visible = true;
                misValue = System.Reflection.Missing.Value;


                //this will open the spreadsheet

                3:
                In the OnBarUpdate() method,
                simply write what data you want into a cell/worksheet , for example

                xlWorkSheet.Cells[1, 1] = Close[0];
                xlWorkSheet.Cells[1, 2] = GetCurrentAskVolume();
                xlWorkSheet.Cells[1, 3] =GetCurrentBidVolume();

                Hope this helps. Working with it realtime on ES. there's a little lag in the bid/ask sizes but the last price seems ok. IMHO this interfacing will definitely fail if your trading strategy require nanoseconds decision though, otherwise seems ok

                Happy coding and trading
                Last edited by mechcow; 01-10-2011, 06:48 AM.

                Comment


                  #9
                  this is a follow up for my post below.. editting excel sheet will cause the interop to crash, there's an exception that needs to be handled here

                  references



                  here' what i did.. a simple try/catch in the OnBarUpdate() method. Now i can manipulate the data on the spreadsheet without any exceptions already. Hope there's no more bugs

                  if u come across bugs, feel free to ask. Will be glad to help since the NJ forum has been very helpful since i started using it 2 yrs ago.. cheers

                  try
                  {
                  xlWorkSheet.Cells[1, 1] = Close[0];
                  xlWorkSheet.Cells[1, 2] = GetCurrentAskVolume();
                  xlWorkSheet.Cells[1, 3] =GetCurrentBidVolume();
                  //
                  }
                  catch (Exception ex)
                  {
                  //if (ex.Message.Contains("0x800"))
                  if (ex.Message.Contains("0x800A03EC"))
                  //throw;
                  {
                  return;
                  //insert this code into #region (it's on the very top of script)-> using System.Threading;
                  Thread.Sleep(1000);//dunno if this helps in any way
                  }

                  }

                  Comment


                    #10
                    Wow. That looks awesome. Do you know if it will work with Excel 2010? And would I be able to update Excel with multiple symbols?

                    Comment


                      #11
                      hmm im not too sure abt 2010 but unless there's a change in interop code, it should work.

                      As for symbols, i dun see any problems, just add a new instrument in your indicator then just write those values into the spreadsheet

                      Comment


                        #12
                        Hey Mechow
                        Could you pleaase provide an example for us novice coders?

                        It woulod be a great help

                        thanx

                        Comment


                          #13
                          visit:


                          DionysusToast explains it much better than me

                          Comment


                            #14
                            Hi Mechcow,

                            I would like to know where you put the

                            Thread.Sleep(1000);//dunno if this helps in any way

                            Thanks...

                            Comment

                            Latest Posts

                            Collapse

                            Topics Statistics Last Post
                            Started by CortexZenUSA, Today, 12:53 AM
                            0 responses
                            1 view
                            0 likes
                            Last Post CortexZenUSA  
                            Started by CortexZenUSA, Today, 12:46 AM
                            0 responses
                            1 view
                            0 likes
                            Last Post CortexZenUSA  
                            Started by usazencortex, Today, 12:43 AM
                            0 responses
                            5 views
                            0 likes
                            Last Post usazencortex  
                            Started by sidlercom80, 10-28-2023, 08:49 AM
                            168 responses
                            2,266 views
                            0 likes
                            Last Post sidlercom80  
                            Started by Barry Milan, Yesterday, 10:35 PM
                            3 responses
                            13 views
                            0 likes
                            Last Post NinjaTrader_Manfred  
                            Working...
                            X