NT8 Programming Help/Advice/Best Practices - NinjaTrader Programming | futures io social day trading
futures io futures trading


NT8 Programming Help/Advice/Best Practices
Updated: Views / Replies:2,098 / 9
Created: by NJAMC Attachments:0

Welcome to futures io.

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

futures io is the largest futures trading community on the planet, with over 90,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors Ė all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you donít need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

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

Reply
 
Thread Tools Search this Thread
 

NT8 Programming Help/Advice/Best Practices

  #1 (permalink)
Elite Member
Atkinson, NH USA
 
Futures Experience: Intermediate
Platform: NinjaTrader 8/TensorFlow
Broker/Data: NinjaTrader Brokerage
Favorite Futures: Futures, CL, ES, ZB
 
NJAMC's Avatar
 
Posts: 1,925 since Dec 2010
Thanks: 2,962 given, 2,294 received

NT8 Programming Help/Advice/Best Practices

With the public release of NT8, the Forum might get confusing as to which platform they are looking for programming help. I am starting this thread to help keep NT8 issues separate from NT7.

NT8 Now allows & Supports the following NinjaScript Type (FEEL THE POWER):
  • AddOns
  • BarsTypes
  • ChartStyles
  • DrawingTools
  • ImportTypes
  • Indicators
  • MarketAnalyzerColumns
  • OptimizationFitnesses
  • Optimizers
  • PerformanceMetrics
  • ShareServices
  • Strategies
  • SuperDomColumns

Given these features, there is very little you cannot do with NT8. I think we are going to see some clever solutions to some difficult problems come out of this new platform with the skills of the community.

This Thread I would like to put in place to help facilitate getting answers to questions:
  • How to?
  • Will it?
  • Best Practice?
  • XAML?
  • What is the best way?

Nil per os
-NJAMC [Generic Programmer]

LOM WIKI: NT-Local-Order-Manager-LOM-Guide
Artificial Bee Colony Optimization
Reply With Quote
The following 6 users say Thank You to NJAMC for this post:
 
  #2 (permalink)
Quick Summary
Quick Summary Post

Helpful Links:

NinjaTrader 8 Help Guide
NinjaTrader 8 BETA forum
NinjaScript Reference Samples
Singleton Design Pattern


Last edited by NJAMC; September 24th, 2015 at 11:28 PM.
 
  #3 (permalink)
Elite Member
Atkinson, NH USA
 
Futures Experience: Intermediate
Platform: NinjaTrader 8/TensorFlow
Broker/Data: NinjaTrader Brokerage
Favorite Futures: Futures, CL, ES, ZB
 
NJAMC's Avatar
 
Posts: 1,925 since Dec 2010
Thanks: 2,962 given, 2,294 received

Singleton Footprint


You may want to have only a single instance of a class within NT8 environment. Maybe this is a logging function or external IO. The following is a "Singleton Footprint" I found. Place this in your class instead of a constructor and replace "MyClassName" with the name of the class. Upon the first request for the "MyClassName.Instance" the class will be instantiated. Additional "MyClassName.Instance" will keep returning a reference to that same instance.

 
Code
#region Singleton Footprint		
	    private static readonly Lazy<MyClassName> lazy =
	         	new Lazy<MyClassName>(() => new MyClassName());
	     
	     public static MyClassName Instance { get { return lazy.Value; } }

	    private MyClassName()
	    {
                    }
#endregion
Inside your Indicator/Strategy or whatever you would normally have tried to create the "MyClassName" with something like this:
 
Code
     MyClassName   refClassName=new MyClassName();
Doing this with the proper Singleton Footprint will case a compiler error as "MyClassName()" is restricted as a Private constructor.

To get around this issue and use the Singleton properly, you will use the following line to get access to that singleton class:
 
Code
     MyClassName   refClassName= MyClassName.Instance;

Nil per os
-NJAMC [Generic Programmer]

LOM WIKI: NT-Local-Order-Manager-LOM-Guide
Artificial Bee Colony Optimization

Last edited by NJAMC; September 24th, 2015 at 11:09 PM.
Reply With Quote
The following 3 users say Thank You to NJAMC for this post:
 
  #4 (permalink)
 Vendor: www.probabletrades.com 
OC, California, USA
 
Futures Experience: Advanced
Platform: IB/TWS, NinjaTrader, thinkorswim
Favorite Futures: stocks, options, futures, VIX
 
shodson's Avatar
 
Posts: 1,859 since Jun 2009
Thanks: 480 given, 3,254 received

As NT8 is more multi-threaded, you may want to make your singleton classes multi-thread friendly. See this MSDN article on the Singleton Pattern.

Other popularly-used design patterns, all stemming from the publication of this famous book in 1994.

Reply With Quote
The following 3 users say Thank You to shodson for this post:
 
  #5 (permalink)
Trading Apprentice
France
 
Futures Experience: Intermediate
Platform: Metastock
Favorite Futures: ES, EC, QM, GLD, SPY, QQQ
 
Posts: 32 since May 2012
Thanks: 5 given, 15 received

Is NT8 out already? Will they offer script translations from NT7? I use NT7 and after spending so much time to learn it I hope they will support it.

BTW, I am now testing the NinjaScript generation feature of Price Action Lab and I am wondering whether the following NT7 script will work in NT8:

 
Code
//Code starts here
#region Using declarations 
using System; 
using System.ComponentModel; 
using System.Diagnostics; 
using System.Drawing; 
using System.Drawing.Drawing2D; 
using System.Xml.Serialization; 
using NinjaTrader.Cbi; 
using NinjaTrader.Data; 
using NinjaTrader.Indicator; 
using NinjaTrader.Gui.Chart; 
using NinjaTrader.Strategy; 
#endregion 
 
namespace NinjaTrader.Strategy 
{ 
public class DIALONGT2S2Index35IndexDate20130313: Strategy
{ 
#region Variables 
 
#endregion 
protected override void Initialize() 
{ 
CalculateOnBarClose = true; 
} 
 
protected override void OnBarUpdate() 
{ 
if ( High[0] > High[1] &&  High[2] > Low[0] && High[1] > High[2] && Low[0] > Low[1] && High[3] > Low[2] && Low[1] > High[3] && Low[2] > Low[3] && Low[3] > Close[4] )
{
EnterLong(DefaultQuantity, "Long");
SetStopLoss("Long", CalculationMode.Percent,2*0.01, false);
SetProfitTarget("Long", CalculationMode.Percent,2*0.01);
}
}
 #region Properties
 
  #endregion 
}
}
 
//Code ends here
This works fine in NT7.

Reply With Quote
 
  #6 (permalink)
DabbaDo
Indianapolis/IN
 
Futures Experience: Intermediate
Platform: SC, NT, ToS, my own
Broker/Data: Stage5, InteractiveBrokers
Favorite Futures: ES
 
Posts: 57 since Jan 2013
Thanks: 961 given, 93 received

NT8 is in public beta, so you can download it now. The code you show is not hard to convert, but I don't know if they will convert it for you.

Reply With Quote
 
  #7 (permalink)
Elite Member
Littleton, CO
 
Futures Experience: Intermediate
Platform: Jigsaw (on NT8)
Broker/Data: IB, IQFeed
Favorite Futures: CL
 
Posts: 12 since Oct 2015
Thanks: 11 given, 10 received


NJAMC View Post
With the public release of NT8, the Forum might get confusing as to which platform they are looking for programming help. I am starting this thread to help keep NT8 issues separate from NT7.

NT8 Now allows & Supports the following NinjaScript Type (FEEL THE POWER):
  • AddOns
  • BarsTypes
  • ChartStyles
  • DrawingTools
  • ImportTypes
  • Indicators
  • MarketAnalyzerColumns
  • OptimizationFitnesses
  • Optimizers
  • PerformanceMetrics
  • ShareServices
  • Strategies
  • SuperDomColumns

Given these features, there is very little you cannot do with NT8. I think we are going to see some clever solutions to some difficult problems come out of this new platform with the skills of the community.

This Thread I would like to put in place to help facilitate getting answers to questions:
  • How to?
  • Will it?
  • Best Practice?
  • XAML?
  • What is the best way?

Since NT8 is still beta, there's a lot of work on NinjaScript to be done, acknowledged by the NT staff in their forums. AddOns in particular are not very well explained. There's basic examples on their help page about how to create tabbed windows, but not much else.

XAML is still a work in progress according to NT, they only support "loose" XAML, and you can't edit XAML within Visual Studio so I've read as it add Windows specific elements to the XAML that won't run in NT.

So far, I've found the best way to edit scripts is via Visual Studio since I am used to that IDE. However, if you have to manually create XAML files to add controls, that's going to suck. Maybe NT will change that before the final release.

Reply With Quote
 
  #8 (permalink)
Elite Member
Littleton, CO
 
Futures Experience: Intermediate
Platform: Jigsaw (on NT8)
Broker/Data: IB, IQFeed
Favorite Futures: CL
 
Posts: 12 since Oct 2015
Thanks: 11 given, 10 received


dryg View Post
Is NT8 out already? Will they offer script translations from NT7? I use NT7 and after spending so much time to learn it I hope they will support it.

NT8 is still beta, no release date yet. There's a lot of code changes in NT8 (I am too new to add a link, Google 'code breaking changes ninjatrader' and look for the result to their forum). The biggest is that NT8 moved to WPF which changed a lot of the method calls and properties from NT7.

A lot of scripts won't work unless they are modified to run in NT8. NT staff is helping in the NT forums, you could try there if you have specific questions.

Reply With Quote
 
  #9 (permalink)
DabbaDo
Indianapolis/IN
 
Futures Experience: Intermediate
Platform: SC, NT, ToS, my own
Broker/Data: Stage5, InteractiveBrokers
Favorite Futures: ES
 
Posts: 57 since Jan 2013
Thanks: 961 given, 93 received

Conversion script from NT7 to NT8

A friend of mine has attached an auto-conversion script in the NinjaTrader Forum.
Here's a script to convert indicators and strategies - NinjaTrader Support Forum

It might be useful.

Reply With Quote
The following 3 users say Thank You to dalebru for this post:
 
  #10 (permalink)
Trading Apprentice
Fayetteville NC USA
 
Futures Experience: Beginner
Platform: Ninja Trader
Favorite Futures: Futures
 
Posts: 5 since Sep 2013
Thanks: 0 given, 0 received


Thanks for all the info! Great submission.

Reply With Quote

Reply



futures io > > > > > NT8 Programming Help/Advice/Best Practices

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Upcoming Webinars and Events (4:30PM ET unless noted)

Linda Bradford Raschke: Reading The Tape

Elite only

Adam Grimes: TBA

Elite only

NinjaTrader: TBA

January

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Visual Programming (programming without coding) LukeGeniol Platforms and Indicators 11 September 16th, 2016 01:49 PM
Good Advice on Bad Advice? afoxperson The Elite Circle 5 February 18th, 2015 11:36 PM
Some coding practices when using VS with NinjaTrader BMMA14 NinjaTrader 3 August 19th, 2014 09:57 PM
Auto Trading Best Practices pbailey19 Elite Automated NinjaTrader Trading 4 May 7th, 2014 10:53 PM
Best Practices for Scaling In/Out with Ninja DOM HJay Traders Hideout 1 August 8th, 2009 04:19 PM


All times are GMT -4. The time now is 08:43 AM.

Copyright © 2017 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
Page generated 2017-12-12 in 0.13 seconds with 19 queries on phoenix via your IP 54.90.207.75