NexusFi: Find Your Edge


Home Menu

 





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 4,686 views
    2. thumb_up 0 thanks given
    3. group 6 followers
    1. forum 5 posts
    2. attach_file 0 attachments




 
Search this Thread

Object-oriented design for complex NinjaTrader strategies

  #1 (permalink)
 
shodson's Avatar
 shodson 
OC, California, USA
Quantoholic
 
Experience: Advanced
Platform: IB/TWS, NinjaTrader, ToS
Broker: IB, ToS, Kinetick
Trading: stocks, options, futures, VIX
Posts: 1,976 since Jun 2009
Thanks Given: 533
Thanks Received: 3,709

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 NexusFi Trade Journal Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
How to apply profiles
Traders Hideout
Better Renko Gaps
The Elite Circle
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
Trade idea based off three indicators.
Traders Hideout
Cheap historycal L1 data for stocks
Stocks and ETFs
 
  #2 (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,460 since Jun 2009
Thanks Given: 33,234
Thanks Received: 101,655

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 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
  #3 (permalink)
Boo Doo
Toronto
 
Posts: 1 since Oct 2009
Thanks Given: 6
Thanks Received: 0


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
  #4 (permalink)
 
cunparis's Avatar
 cunparis 
Paris, France
 
Experience: Advanced
Platform: Market Delta & Ninjatrader
Trading: ES
Posts: 2,565 since Jun 2009
Thanks Given: 1,162
Thanks Received: 2,093


Boo Doo View Post
particularly the post #6 by roonius with Visual Studio Solution sample attached:
www.[AUTOLINK]ninjatrader[/AUTOLINK]-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
  #5 (permalink)
 zeller4 
Orlando Florida
 
Experience: Intermediate
Platform: NT8
Trading: CL, NQ, ES, RTY
Posts: 477 since Jun 2009
Thanks Given: 1,416
Thanks Received: 404

Hello cunparis,

Any progress with this new project?

Kirk

Reply With Quote
  #6 (permalink)
 
cunparis's Avatar
 cunparis 
Paris, France
 
Experience: Advanced
Platform: Market Delta & Ninjatrader
Trading: ES
Posts: 2,565 since Jun 2009
Thanks Given: 1,162
Thanks Received: 2,093


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




Last Updated on June 5, 2010


© 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