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.
The following 4 users say Thank You to BMMA14 for this post:
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.
Last edited by BMMA14; August 29th, 2014 at 09:54 PM.
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.
Sent from my LG Optimus G Pro
Due to time constraints, please do not PM me if your question can be resolved or answered on the forum.
Need help? 1) Stop changing things. No new indicators, charts, or methods. Be consistent with what is in front of you first. 2) Start a journal and post to it daily with the trades you made to show your strengths and weaknesses. 3) Set goals for yourself to reach daily. Make them about how you trade, not how much money you make. 4) Accept responsibility for your actions. Stop looking elsewhere to explain away poor performance. 5) Where to start as a trader? Watch this webinar and read this thread for hundreds of questions and answers. 6) Help using the forum? Watch this video to learn general tips on using the site.
If you want to support our community, become an Elite Member.
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.
The following 2 users say Thank You to BMMA14 for this post:
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.
The following 2 users say Thank You to rleplae for this post:
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.
The following user says Thank You to BMMA14 for this post: