New OnStartUp() method in NT7 B8 - NinjaTrader Programming | futures io social day trading
futures io futures trading


New OnStartUp() method in NT7 B8
Updated: Views / Replies:2,162 / 7
Created: by aslan 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
 

New OnStartUp() method in NT7 B8

  #1 (permalink)
Elite Member
Madison, WI
 
Futures Experience: Advanced
Platform: Sierra Charts, ALT
Favorite Futures: ES
 
aslan's Avatar
 
Posts: 614 since Jan 2010
Thanks: 342 given, 1,077 received

New OnStartUp() method in NT7 B8

Well NT7 Beta 8 was released, and they finally broke down and made a change to add a new method called OnStartUp(). This method is called once before an indicator starts up (after Initialize() and before first call to OnBarUpdate(). It is an ideal place to put your startup code instead of having a static flag and startup routine that you call once out of OnBarUpdate(). Another key item is the Bars var is initialized, which was the main problem with putting code in the Initialize() routine. The signature is

protected override void OnStartUp() {
}

This will help clean code up by allowing you to put code where it belongs.

This routine is also the best place to allocate resources, and then deallocate them in the matching OnTermination() to avoid memory leaks.

Reply With Quote
The following 4 users say Thank You to aslan for this post:
 
  #2 (permalink)
Quick Summary
Quick Summary Post

Quick Summary is created and edited by users like you... Add FAQ's, Links and other Relevant Information by clicking the edit button in the lower right hand corner of this message.

 
  #3 (permalink)
Elite Member
Wrocław, Poland
 
Futures Experience: Intermediate
Platform: NinjaTrader, Racket
Favorite Futures: Ockham's razor
 
gregid's Avatar
 
Posts: 651 since Aug 2009
Thanks: 321 given, 605 received


Excellent news! No more "myInit" or whatever else one used to call it!

Reply With Quote
 
  #4 (permalink)
Elite Member
Israel
 
Futures Experience: Intermediate
Platform: NinjaTrader
Broker/Data: pfg
Favorite Futures: eminis
 
Posts: 323 since Jun 2009
Thanks: 6 given, 206 received

Hi,
I'm not so frill about this new function.
I'll continue to use my Init routine. The reason why is that NT makes mistakes, and one mistake I can catch and fix with my own Init.
The mistake is that sometimes when you run a backtest the first bar that you run on is not the first bar of a day. So if you do have some code for each day like if Bars.FirstBarOfSession it won't execute on the first bar in data series and it can be a disaster.

Baruch

Reply With Quote
 
  #5 (permalink)
Elite Member
Calcutta, India
 
Futures Experience: Intermediate
Platform: ArthaChitra
 
Posts: 278 since Jun 2009
Thanks: 161 given, 259 received

OnStartUp is a very good feature. there are multiple instances of Initialization, onstartup dont have such issues. again not many things can be accessed in init. onstartup solves that prob

Reply With Quote
 
  #6 (permalink)
Elite Member
Madison, WI
 
Futures Experience: Advanced
Platform: Sierra Charts, ALT
Favorite Futures: ES
 
aslan's Avatar
 
Posts: 614 since Jan 2010
Thanks: 342 given, 1,077 received


baruchs View Post
Hi,
I'm not so frill about this new function.
I'll continue to use my Init routine. The reason why is that NT makes mistakes, and one mistake I can catch and fix with my own Init.
The mistake is that sometimes when you run a backtest the first bar that you run on is not the first bar of a day. So if you do have some code for each day like if Bars.FirstBarOfSession it won't execute on the first bar in data series and it can be a disaster.
Baruch

It sounds like you are confusing the real purpose of the routine. It is meant for indicator initialization, not functional code. So if you have code that runs for each day, that is not indicator init, and you should continue to run that code in OnBarUpdate(). This routine runs only once before OnBarUpdate() is called and allows for one time startup type functions.

In the grand scheme of things it is fairly minor, but it allows for cleaner code and gets rid of that annoying check at the start of your OnBarUpdate. The other benefit if used properly is to make it easier to get resource allocation/destruction correct, but pairing your allocation and dispose methods in the OnStartUp() and OnTermination() routines.

Of course you don't have to use it, so if you like the way you are doing it, that works too.

Reply With Quote
 
  #7 (permalink)
Administrator: Retired Backtester
 Vendor: speedytradingservers.com 
Rennes France
 
Futures Experience: Advanced
Platform: NinjaTrader
Broker/Data: IB/Kinetick
Favorite Futures: Futures
 
sam028's Avatar
 
Posts: 3,366 since Jun 2009
Thanks: 3,574 given, 3,983 received


bukkan View Post
OnStartUp is a very good feature. there are multiple instances of Initialization, onstartup dont have such issues. again not many things can be accessed in init. onstartup solves that prob

[off-topic]

OnStartup() and the other features added on Beta 8 are good features, for sure, but this also means we'll not see a non-beta before a long time imho.
If NT guys can add something like OnStartup() on a Beta 8, many things can happen before the final version...

I modified some NT6.5 indicators for let them work with NT7, but I'm not spending to much time on it, as I feel that many things can already change before the final version.
So it might be a good idea to don't go to fast in changing your precious .cs .

[/off-topic]

Success requires no deodorant! (Sun Tzu)
Reply With Quote
The following user says Thank You to sam028 for this post:
 
  #8 (permalink)
Elite Member
Madison, WI
 
Futures Experience: Advanced
Platform: Sierra Charts, ALT
Favorite Futures: ES
 
aslan's Avatar
 
Posts: 614 since Jan 2010
Thanks: 342 given, 1,077 received


sam028 View Post
[off-topic]

OnStartup() and the other features added on Beta 8 are good features, for sure, but this also means we'll not see a non-beta before a long time imho.
If NT guys can add something like OnStartup() on a Beta 8, many things can happen before the final version...

I modified some NT6.5 indicators for let them work with NT7, but I'm not spending to much time on it, as I feel that many things can already change before the final version.
So it might be a good idea to don't go to fast in changing your precious .cs .

[/off-topic]

I agree the final form of NT7 is aways off, they still have to do a full beta, which will expose more issues as well.

There are enough code breaking changes, that it is getting difficult to keep 6.5 and 7.0 around. I've recently decided to go with 7.0 only with 6.5 as a backup, but I am already waiting for fixes in B9.

Reply With Quote
The following user says Thank You to aslan for this post:

Reply



futures io > > > > > New OnStartUp() method in NT7 B8

Thread Tools Search this Thread
Search this Thread:

Advanced Search



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

Jigsaw Trading: TBA

Elite only

FuturesTrader71: TBA

Elite only

NinjaTrader: TBA

Jan 18

RandBots: TBA

Jan 23

GFF Brokers & CME Group: Futures & Bitcoin

Elite only

Adam Grimes: TBA

Elite only

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
overloaded method exCaliberNinja NinjaTrader Programming 5 May 20th, 2011 12:19 AM
Help : Method + Switch wkmetal NinjaTrader Programming 3 October 25th, 2010 05:51 AM
The Langford Method fallout Traders Hideout 3 September 6th, 2010 12:17 AM
Careful going to NT7 B8 aslan NinjaTrader 1 February 4th, 2010 12:15 PM
NT7 new account access method marotom NinjaTrader Programming 3 January 18th, 2010 10:49 AM


All times are GMT -4. The time now is 07:08 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-18 in 0.11 seconds with 19 queries on phoenix via your IP 54.163.209.109