![]() |
This website will be down for maintenance from Friday May 24th at 6PM MDT until Saturday May 25th at 11AM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com
|
|||||||
| General Programming General NinjaScript programming questions. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#46 | |
|
Senior Member
Join Date: Jul 2010
Location: Bangkok
Posts: 162
Thanks: 4
Thanked 38 times in 12 posts
|
Quote:
It worked fine. |
|
|
|
|
|
The following user says thank you to DionysusToast for this post: |
|
|
|
#47 |
|
Junior Member
Join Date: Oct 2011
Posts: 5
Thanks: 1
Thanked 0 times in 0 posts
|
Thanks a lot DT - awesome job
BC |
|
|
|
|
|
#48 | |
|
Junior Member
Join Date: Sep 2011
Location: Conover, NC
Posts: 21
Thanks: 2
Thanked 1 time in 1 post
|
Quote:
I am so impressed with your work in creating a bridge between the millions of users out there with Excel and NT... well done! I have incorporated the Interop dll into NT and have reviewed your code. The next questioin I have is how does one incorporate your code into NT... what steps do I follow? |
|
|
|
|
|
|
#49 | |
|
Junior Member
Join Date: Sep 2011
Location: Conover, NC
Posts: 21
Thanks: 2
Thanked 1 time in 1 post
|
Dionysus,
I appreciate your work with BigMike... well I'm BigSteve. And, in the interest of beginning with the end in mind, I have attached a file that describes the type of data I need from Ninja Trader in real time. I would like to know if you believe this is possible and would like your help with some sample code. I would be willing to pay you a fee if necessary to get this endstate. What are your thoughts? Steve Quote:
|
|
|
|
|
|
|
#50 |
|
Member
Join Date: Oct 2009
Posts: 64
Thanks: 9
Thanked 5 times in 4 posts
|
Thank you Dionysus for this. A true gem !
I have got it to work. However, I do not have autocomplete in Ninja editor for the excel functions and I am having a hard time figuring out the function calls and parameters. Any suggestion/bypass ? |
|
|
|
|
|
#51 |
|
Junior Member
Join Date: Jun 2012
Posts: 1
Thanks: 2
Thanked 0 times in 0 posts
|
Hello all,
I am new to ninjatrader and was looking for a way to convert VBA code to c# and I noticed this thread connecting excel to ninjatrader. It is my understanding that excel is written in VBA and that NT is written in C#. Is that correct, and if so how difficult would it be to convert vba code to c#? I have some code written for another trading software platform that uses vba and the developer has given permission to convert it for use in other platforms. But I am not a programmer and do not understand the complexities of doing so. Any advice for how to go about doing this? Thank you for any constructive feedback, Michael |
|
|
|
|
|
#52 |
|
Senior Member
Join Date: Dec 2007
Posts: 365
Thanks: 36
Thanked 28 times in 24 posts
|
Could someone provide a hint or link as to a tiny bit of sample code to read from Excel. Specifically, I'm trying to figure out what the code would look like to grab a value from a particular excel cell, and assign that value to a variable in Ninja.
Thanks much to all who contributed on this. |
|
|
|
|
|
#53 | |
|
Junior Member
Join Date: Jun 2012
Posts: 21
Thanks: 4
Thanked 2 times in 2 posts
|
Quote:
When trying to apply the Excel integration steps outlined in the current thread I pretty much ran into the problems mentioned by others here (installing a too old Interop.Excell.dll being unable to find a new separate one on the Internet => going for forrestang's solution to look inside the Windows folder - but not getting further than post #38 - because I can see files with desired names under Windows - but I'm unable to select them for reference in NT or to copy them into NT ... and I'm not sure that they are dlls, because they don't have the file extension and don't have the same icon as shown in forrestang's screen shots in #38). So currently I'm stuck trying to execute the code mentioned in the current thread. Looking for other read/write solutions I found: http://www.bigmiketrading.com/ninjat...njatrader.html It contains a SimpleExcelWriter.cs that works nicely - but as the name says ... it is only a writer. |
|
|
|
|
|
|
#54 |
|
Member
Join Date: Oct 2009
Posts: 64
Thanks: 9
Thanked 5 times in 4 posts
|
Well I got it working to read and write after following this thread, took some fiddling though but now it is working in production with no problems.
You may have found the wrong DLL - it is not the same for each version of Excel. Which excel do you have installed ? Make sure you have the right one. Now windows explorer does not display those files the regular way for whatever reason, esp in those system directories. However they are there and can be copied around. I had to use command prompt to handle them and copy them. Hope this helps |
|
|
|
|
The following user says thank you to tickling for this post: |
|
|
|
#55 | |
|
Junior Member
Join Date: Jun 2012
Posts: 21
Thanks: 4
Thanked 2 times in 2 posts
|
Quote:
1) Started cmd.exe as administrator by writing 'cmd.exe' in the 'Start search'-bar under 'Start' and then right click on the 'cmd.exe' that appears as search result - and the select 'Run as administrator' (the is to prevent 'Access denied' when copying the dll). Used 'cd [dir name]' (use 'cd ..' to leave dir and write 'dir' to see content of a directory) to drill down to the folder in C:>Windows>Assemby>GAC>Microsoft.Office.Interop.Ex cel>12.0.0.0__71e9bc11e9429c (find a similar folder) where the dll is found. Then write 'copy Microsoft.Office.Interop.Excel.dll c:\' (or another destination) and the file Microsoft.Office.Interop.Excel.dll is copied to c:\. 2) Then I moved the file to the folder: C:\....\Documents\NinjaTrader 7\bin\Custom 3) In NinjaTrader I added the reference to the file by opening an indicator in edit mode and right clicking on the code and then press 'References...' and selecting 'C:\....\Documents\NinjaTrader 7\bin\Custom\Microsoft.Office.Interop.Excel.dll' 4) Restarted the computer just to be on the safe side. 5) When I tried to run the 'BigMikeExcel' I still got the message, that made me believe that I was running an outdated version of the Microsoft.Office.Interop.Excel.dll (the one from Office 2003). The message said: "Error on calling 'OnBarUpdate' method for indicator 'BigMikeExcel' on bar 0: Old format or invalid type library. (Exception from HRESULT: 0x80028018 (TYPE_E_INVDATAREAD)) ". I found the following http://www.add-in-express.com/creati...-type-library/ that suggested to install the MS Office Multilingual User Interface Pack to fix the problem, which requires the Office Communicator to be installed - which I did. But I still got the same error message. Changing the 'Primary editing language' to 'English (United States)' under 'Microsoft Office 2007 Language Settings' did not help either (and I did restart the computer). I then followed the code advice from the site and build the following code into the BigMikeExcel indicator: using System.Threading; using System.Globalization; - and protectedoverridevoid Initialize() { System.Globalization.CultureInfo newCulture = new System.Globalization.CultureInfo("en-US"); System.Threading.Thread.CurrentThread.CurrentCultu re = newCulture; } - and this finally made the integration and script run without problems I don't know if this is a general MS Office 2007 problem or because en-US not being the default language.Note that I did not have to extract and reference other dlls than the one for Excel (a previous post mentioned 2 others).
Last edited by Saxo_; 07-22-2012 at 12:56 PM.
|
|
|
|
|
|
|
#56 |
|
Member
Join Date: Oct 2009
Posts: 64
Thanks: 9
Thanked 5 times in 4 posts
|
OK over my head here. I have Excel 2003, up to your item 5 all match, then I got it to work.
It does seem to relate to non-us thing. Check this out, may help http://stackoverflow.com/questions/5...0028018-type-e I kept this excel - and machine - strictly US-en only because of too many marks on my back. No Multilingual pack, no globalization issues Good Luck |
|
|
|
|
|
#57 |
|
Member
Join Date: Apr 2010
Posts: 79
Thanks: 9
Thanked 2 times in 2 posts
|
I recently installed BigMikeExcel but get the error "Error on calling 'OnBarUpdate' method for indicator 'BigMikeExcel' on bar 65535: Exception from HRESULT:0x800A03EC"
It consistently gives me 65535 lines in the spreadsheet but then stops working and gives that error. Has anyone else ran into a limitation on the amount of excel lines like this? Any suggestions or ideas why this might occur? |
|
|
|
|
|
#58 |
|
Member
Join Date: Apr 2010
Posts: 79
Thanks: 9
Thanked 2 times in 2 posts
|
Never mind. It's an excel limitation when writing data directly to the program. I should have researched before posting. Any one know how to change BigMikeExcel to write to a .csv file instead? Apparently writing to a .csv and then pasting into excel is a workaround.
|
|
|
|
|
|
#59 |
|
Senior Member
Join Date: Sep 2008
Posts: 543
Thanks: 80
Thanked 187 times in 131 posts
|
Hi Tdschulz, I'm not familiar with the BigMikeExcel indicator I believe the 'ExportData' strategy can write to csv:
http://www.ninjatrader.com/support/f...7&postcount=21 |
|
|
|
|
The following user says thank you to Radical for this post: |
|
|
|
#60 |
|
Senior Member
Join Date: Dec 2007
Posts: 365
Thanks: 36
Thanked 28 times in 24 posts
|
Wondering if anyone has any suggestions...
I finally found the dll online and placed it in \Custom folder of NT. I imported the BigMikeExcel indicator. I verified the interop reference. I compiled the indicator and added it to a chart. I have the correct excel spreadsheet saved and opened in the correct location. Everything "works" but nothing happens to the spreadsheet and no error messages arise. EDIT: I forgot to check the log. I don't know exactly what this means.... Error on calculating indicator min/max value for indicator 'BigMikeExcel'. Please check the 'GetMinMaxValues' method: Could not load file or assembly 'Microsoft.Office.Interop.Excel, Version=10.0.4504.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
Last edited by coolmoss; 09-10-2012 at 05:44 PM.
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Data Streaming Into Excel and connecting Ninja to Excel | cjgovi | Connecting | 13 | 02-28-2011 10:21 AM |
| Instrument not present in default list is present on the DOM instrument dropdown | cunparis | Version 7 Beta General Questions & Bug Reports | 5 | 10-22-2010 04:49 AM |
| Data from Ninja to Excel | MAX | Automated Trading | 1 | 02-09-2010 02:21 PM |
| New Year (?) problem. No live data with Zen Fire/Ninja platform | mkoumis | Connecting | 11 | 01-02-2009 05:30 AM |
| Linking Ninja and Excel | RedDuke | General Programming | 3 | 08-16-2007 03:16 AM |