Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
I wanted to create an Application in C# which would communicate with NinjaTrader. Therefore I needed a very stable link in between my application and NT. My approach is to use NT script with minimum code and use class libraries to do what I would like to do. So NT Script is just a front end which provides some basic info to my business model running in the background. I will only post some annotations on NinjaTrader chart display reflecting the computed outcome of the background machine. Please find attached a very preliminary work of my spec. You will find a basic schematic and description + some notes of my experience with NinjaTrader integration work to avoid pitfalls.
I wanted to offer my work to the BigMike forum community as a payback and gratitude, as I used myself some very useful information from the forum contributors. I hope it helps. Feedback and suggestions are welcome.
Depending on the data to be exchanged with the external application and NT you might consider loosely coupling ?
I have been working on both types of projects :
1. a class library (that is even NT independant/neutral), for which the objects can be instantiated both inside and outside NT. Same binary is used in NT strategies and same binary (DLL) is used in brute force stand-alone application. Still this is tightly coupled, that stategy will load the class libary in its address space and needs to be able to call the right method with the correct parameters, otherwise an exception will be thrown.
2. a stand alone application (using the encog neural network library of heaton research as an example). the problem being that 1) it is .NET 4.0 so not possible to instantiate it in NT which is .NET 3.5 and 2) it doesn't like very much to run into the NT address space. I implemented an stand alone application and my strategy talks over a TCP/IP socket to the program that acts as a listening service. making it even completely technology, hardware, instance agnostic...
I am happy to share bits of code and exchange architecture ideas
It's nice to hear people working on similar ideas. Thanks for the feedback. You are correct about loose coupling. I will change it. Thanks for pointing out. I am developing a third party adds on for NinjaTrader (also can be used for Metatrader etc.). It will be a very interesting project, as it will employ concepts like fractals and tools like fuzzy logic. Some of those concepts and prototypes have been developed over the course of the past 10-15 years. I will post more work ideas/template code and more about the progress of this project in the future.
If your work is not 100% free, or if you have plans to make it commercial or for profit, you are not allowed to use futures.io (formerly BMT) to promote it or discuss it.
Thanks for feedback. When I joined the forum a while ago, my purpose was to exchange ideas first and foremost on Ninjatrader integration in terms of software coding such as csharp. The technical Indicators, market analysis tools and systems that I have developed over the many years, I consider an intellectual property and proprietary. Be rest assured that they will neither be disclosed nor promoted in this forum or any other. /Regards.
Following are the highlights of the architecture:
• Loosely coupled MVVMP architectural design, which enables easy code maintenance, highly organized and factored coding and robust performance immune to crash. The NinjaScript is kept very simple and being the View component, merely used for annotation deliverance on NinjaTrader chart. The architecture provides double layer of abstraction. First being the MVVM of the NTCL and secondly the loose coupling between NTCL and CACL. In practical terms, it means the least interference into NinjaTrader chain and ecosystem, whilst being capable of highly complex trading concept design for the background machine, running in own memory space. The exchange between the CACL and NTCL is done via a single channel of interface event handling using an encoded communication protocol. Thus, NTCL can obtain any process data from ANCL through encoded commands, providing state information in return back to CACL via another layer of interface abstraction.
I did something similar (but more basic) to call a service for trade signal scoring with Encog neural network library. I open a socket in my strategy and ask the service listening on a certain port to 'score' the signal, in real-time it gives a thumb up or down. Besides that i did develop and document how to invoke class library in NT.
I like the component based approach in your solution.
thanks. It was your previous remark about loose coupling, which brought me to re-think the design. I used Interface event to handle this. Besides, I guess I saw your document on this forum the other day. Mine follows basically the same initial steps, except I added some more salt and pepper into it by MVVM and abstract layering./Regards
find attached some personal notes that I've created a while back, when I was trying to use Visual Studio with NinjaTrader. This information is basically a collection of info I've found here and there and also some personal notes to avoid pitfalls. Also find attached the final copy of the block level diagram of NT Script-Class Library integration with more detail info.