All – I got a bunch of data off this forum yesterday which I will be using to do some probability analysis of some of the setups I use. This is excellent stuff and in return I would like to give something back.
First – let me tell you about myself. I’m a part time trader – I trade the ES open every day and usually hang in till about 11:30am EST or 11:30pm in my time zone. I do develop helper apps but I don’t currently use any indicators.
A few months back, I was struggling with one aspect of trading – and I created some helper apps for that. Part of this involved getting Ninja hooked up to Excel. I’d never programmed C# before and this was a good way to learn. I did end up developing some tools and sharing them with friends who convinced me to go commercial with them. There’s a desktop apps developer working with me now to produce production versions. So – I can’t share the tools I developed but I would like to give something back.
So - I give you Ninja and Excel working together. Hope this is new to you all.
I think this will be of some use as I have seen requests for having Ninja and Excel communicate on other forums but not seen any solution.
So – here goes (Note – this is Ninja 7.x).
Microsoft Interop
This is a pre-requisite. It allows communications between Ninja & Excel. Microsoft has 2 versions:
Office 2007
Download details: 2007 Microsoft Office System Update: Redistributable Primary Interop Assemblies (
The particular dll we are interested from is: Interop.Microsoft.Office.Interop.Excel.dll
The target directory for this dll should be: \NinjaTrader 7\bin\Custom
You can either install the Interop Assemblies into this directory or just move the dll file there.
Referencing the DLL in Ninja
Next you need to create a reference to the Interop DLL in Ninja. To do this, you need to get to the references window which is available when editing an indicator. Just choose any indicator for this.
Open Ninja Control Centre -> Tools -> Edit NinjaScript -> Indicator -> Select ANY Indicator
Once the indicator is open, right click in the body of the indicator window and select "References". You will see a window appear that looks like this:
Click "Add", it will then open up an explorer window looking at the \NinjaTrader 7\bin\Custom directory - locate the dll and click "insert"
Then you should see the following in the references window:
Now you are ready to go and start writing code to integrate with Excel.