NexusFi: Find Your Edge


Home Menu

 





Integrate your own custom App with NinjaTrader


Discussion in NinjaTrader

Updated
    1. trending_up 2,450 views
    2. thumb_up 9 thanks given
    3. group 6 followers
    1. forum 8 posts
    2. attach_file 4 attachments




 
Search this Thread

Integrate your own custom App with NinjaTrader

  #1 (permalink)
 BMMA14 
Montreal,Quebec/Canada
 
Experience: Intermediate
Platform: NinjaTrader
Trading: Forex
Posts: 17 since Jun 2014
Thanks Given: 5
Thanks Received: 15

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.

Attached Thumbnails
Integrate your own custom App with NinjaTrader-ninjatrader-application.pdf  
Started this thread Reply With Quote
Thanked by:

Can you help answer these questions
from other members on NexusFi?
Quant vue
Trading Reviews and Vendors
What broker to use for trading palladium futures
Commodities
MC PL editor upgrade
MultiCharts
Better Renko Gaps
The Elite Circle
REcommedations for programming help
Sierra Chart
 
  #2 (permalink)
 
rleplae's Avatar
 rleplae 
Gits (Hooglede) Belgium
Legendary Market Wizard
 
Experience: Master
Platform: NinjaTrader, Proprietary,
Broker: Ninjabrokerage/IQfeed + Synthetic datafeed
Trading: 6A, 6B, 6C, 6E, 6J, 6S, ES, NQ, YM, AEX, CL, NG, ZB, ZN, ZC, ZS, GC
Posts: 3,003 since Sep 2013
Thanks Given: 2,442
Thanks Received: 5,863


BMMA14 View Post
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.

Very interesting topic !

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

warm regards
Ron

Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
  #3 (permalink)
 BMMA14 
Montreal,Quebec/Canada
 
Experience: Intermediate
Platform: NinjaTrader
Trading: Forex
Posts: 17 since Jun 2014
Thanks Given: 5
Thanks Received: 15



rleplae View Post
Very interesting topic !

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

warm regards
Ron

hi

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.

Started this thread Reply With Quote
  #4 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,463 since Jun 2009
Thanks Given: 33,236
Thanks Received: 101,660

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

We're here to help: just ask the community or contact our Help Desk

Quick Links: Change your Username or Register as a Vendor
Searching for trading reviews? Review this list
Lifetime Elite Membership: Sign-up for only $149 USD
Exclusive money saving offers from our Site Sponsors: Browse Offers
Report problems with the site: Using the NexusFi changelog thread
Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
  #5 (permalink)
 BMMA14 
Montreal,Quebec/Canada
 
Experience: Intermediate
Platform: NinjaTrader
Trading: Forex
Posts: 17 since Jun 2014
Thanks Given: 5
Thanks Received: 15


Big Mike View Post
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

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.

Started this thread Reply With Quote
  #6 (permalink)
 BMMA14 
Montreal,Quebec/Canada
 
Experience: Intermediate
Platform: NinjaTrader
Trading: Forex
Posts: 17 since Jun 2014
Thanks Given: 5
Thanks Received: 15

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.

Attached Thumbnails
Integrate your own custom App with NinjaTrader-ninjatoapp.pdf  
Started this thread Reply With Quote
Thanked by:
  #7 (permalink)
 
rleplae's Avatar
 rleplae 
Gits (Hooglede) Belgium
Legendary Market Wizard
 
Experience: Master
Platform: NinjaTrader, Proprietary,
Broker: Ninjabrokerage/IQfeed + Synthetic datafeed
Trading: 6A, 6B, 6C, 6E, 6J, 6S, ES, NQ, YM, AEX, CL, NG, ZB, ZN, ZC, ZS, GC
Posts: 3,003 since Sep 2013
Thanks Given: 2,442
Thanks Received: 5,863


BMMA14 View Post
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.

Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #8 (permalink)
 BMMA14 
Montreal,Quebec/Canada
 
Experience: Intermediate
Platform: NinjaTrader
Trading: Forex
Posts: 17 since Jun 2014
Thanks Given: 5
Thanks Received: 15


rleplae View 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.

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

Started this thread Reply With Quote
  #9 (permalink)
 BMMA14 
Montreal,Quebec/Canada
 
Experience: Intermediate
Platform: NinjaTrader
Trading: Forex
Posts: 17 since Jun 2014
Thanks Given: 5
Thanks Received: 15

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.

Attached Thumbnails
Integrate your own custom App with NinjaTrader-nt-vs-info.pdf   Integrate your own custom App with NinjaTrader-ninjatoappfinal.pdf  
Started this thread Reply With Quote
Thanked by:




Last Updated on September 3, 2014


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts