Object-oriented design for complex NinjaTrader strategies - futures io
futures io futures trading



Object-oriented design for complex NinjaTrader strategies


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one cunparis with 2 posts (0 thanks)
    2. looks_two shodson with 1 posts (0 thanks)
    3. looks_3 Big Mike with 1 posts (0 thanks)
    4. looks_4 zeller4 with 1 posts (0 thanks)
    1. trending_up 3,883 views
    2. thumb_up 0 thanks given
    3. group 6 followers
    1. forum 5 posts
    2. attach_file 0 attachments




Welcome to futures io: the largest futures trading community on the planet, with well over 125,000 members
  • 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 and simple.

-- Big Mike, Site Administrator

(If you already have an account, login at the top of the page)

 
Search this Thread
 

Object-oriented design for complex NinjaTrader strategies

(login for full post details)
  #1 (permalink)
OC, California, USA
 
Experience: Advanced
Platform: IB/TWS, NinjaTrader, ToS
Broker: IB, ToS, Kinetick
Trading: stocks, options, futures, VIX
 
shodson's Avatar
 
Posts: 1,958 since Jun 2009
Thanks: 528 given, 3,648 received

Some of the strategies I develop are starting to get really complicated and long. I'd like to start modularizing my strats into separate class files, but NT doesn't seem to like that very much, every .cs has to either be a strat or an indicator. I also created a BaseStrategy class, which inherits from Ninja's strategy class, then tried to have my strats inherit from my BaseStrategy for my specific strategy sub-classes but Ninja didn't like that either. So how does one implement good OOP in Ninjatrader without creating one giant .cs file every time? The only alternative I can think of is to create an assembly (.DLL) in Visual Studio with helper methods and other re-usable functionality that my strats might want to use, like sending email, working with SQL Server, money management algorithms, etc, then reference it in Ninja and add a using statement to the DLL to bring in the outside behavior.

Any thoughts?

Follow me on Twitter Visit my futures io Trade Journal Started this thread Reply With Quote

 
 
(login for full post details)
  #2 (permalink)
Site Administrator
Swing Trader
Data Scientist & DevOps
Manta, Ecuador
 
Experience: Advanced
Platform: My own custom solution
Trading: Emini Futures
 
Big Mike's Avatar
 
Posts: 49,779 since Jun 2009
Thanks: 32,306 given, 97,566 received

It's a good thought Scott.

I've not tried this, but you might try the .*.NinjaScript.Utility approach, you can place some code in the napespace within the .Utility (ie: shodson.NinjaScript.Utility.cs) and call them from multiple indicators or strategies.

Then just do an include reference:
 
Code
using shodson.Utility;
At the top of your code where you want to call it.

if I understand correctly, the NinjaScript.Utility is special in this way and for this purpose. I tried to find some documentation on it just now but couldn't, so I am only citing from prior examples of code I've seen that use this approach. (Roonius and VitaminC come to mind).

Mike

We're here to help -- just ask

For the best trading education, watch our webinars
Searching for trading reviews? Review this list

Follow us on Twitter, YouTube, and Facebook

Support our community as an Elite Member:
https://futures.io/elite/
Follow me on Twitter Visit my futures io Trade Journal Reply With Quote
 
(login for full post details)
  #3 (permalink)
Toronto
 
 
Posts: 1 since Oct 2009
Thanks: 6 given, 0 received


You may find this useful:

NinjaTrader Support Forum > NinjaScript Development Support > General Programming > NT as a Black Box Development System

https://ninjatrader.com/support/forum/showthread.php?t=23275

particularly the post #6 by roonius with Visual Studio Solution sample attached:
https://ninjatrader.com/support/forum/showthread.php?p=130983

Reply With Quote
 
(login for full post details)
  #4 (permalink)
Paris, France
 
Experience: Advanced
Platform: Market Delta & Ninjatrader
Trading: ES
 
cunparis's Avatar
 
Posts: 2,565 since Jun 2009
Thanks: 1,162 given, 2,081 received


Boo Doo View Post
particularly the post #6 by roonius with Visual Studio Solution sample attached:
www.ninjatrader-support2.com/vb/showthread.php?p=130983#post130983

Thanks for the link to the project. I haven't used visual studio in a long time but I'm going to download it and try to make a simple indicator with it.

Anyone else doing this?

Follow me on Twitter Reply With Quote
 
(login for full post details)
  #5 (permalink)
Florida
 
Experience: Intermediate
Platform: NT7
Trading: CL, NQ, NG
 
Posts: 469 since Jun 2009
Thanks: 1,401 given, 402 received

Hello cunparis,

Any progress with this new project?

Kirk

Reply With Quote
 
(login for full post details)
  #6 (permalink)
Paris, France
 
Experience: Advanced
Platform: Market Delta & Ninjatrader
Trading: ES
 
cunparis's Avatar
 
Posts: 2,565 since Jun 2009
Thanks: 1,162 given, 2,081 received


zeller4 View Post
Hello cunparis,

Any progress with this new project?

I got a copy of visual studio but haven't installed it yet. I plan to give it a try. What I want to do is put some of my algorithms into a DLL and then make an interface for Ninjatrader, Tradestation, & other platforms.

Follow me on Twitter Reply With Quote


futures io Trading Community Platforms and Indicators NinjaTrader > Object-oriented design for complex NinjaTrader strategies


Last Updated on June 5, 2010


Upcoming Webinars and Events
 

NinjaTrader Indicator Challenge!

Ongoing
 

Battlestations! Show us your trading desk - $1,500 in prizes!

March
 

Importance of Finding Your Own Way w/Adam Grimes

Elite only
 

Journal Challenge w/Jigsaw

April
     



Copyright © 2021 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
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.
no new posts