Is NT7 "CalculateOnBarClose = false" broken? - NinjaTrader | futures io social day trading
futures io futures trading


Is NT7 "CalculateOnBarClose = false" broken?
Updated: Views / Replies:2,526 / 6
Created: by Curbfeeler 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
 

Is NT7 "CalculateOnBarClose = false" broken?

  #1 (permalink)
Elite Member
Des Moines, IA
 
Futures Experience: Beginner
Platform: NinjaTrader
 
Posts: 22 since Nov 2009
Thanks: 33 given, 16 received

Is NT7 "CalculateOnBarClose = false" broken?

I am trying to code a quick indicator which will write out some text on each incoming tick. I'm on a 333 tick chart, just crossed over the swing indicator, and I want to write a line of HTML for each high and each low from the entry. I'm just trying to get some simple stats about risk:reward.

For hours I've been struggling and suddenly realized my code is fine. I think there is something wrong with "COBC = false" in NT7 beta 20, because my simple indicator is only called on the first tick of the bar.

I went back to the drawing board and wrote the simplest possible indicator, just to dumb things down and test. Guess what....

 
Code
        protected override void Initialize()
        {
            Overlay				= false;
			CalculateOnBarClose = false;

        }

         protected override void OnBarUpdate()
        {
			
				if (FirstTickOfBar)
				{
					Print("TICK 1");
				}
				else{
					Print("ELSE");
				}
				
        }
The output says...

TICK 1
TICK 1
TICK 1
TICK 1
TICK 1
TICK 1
TICK 1


Last edited by Curbfeeler; August 24th, 2010 at 11:30 PM. Reason: Code tags...
Reply With Quote
 
  #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)
Site Administrator
Manta, Ecuador
 
Futures Experience: Advanced
Platform: My own custom solution
Favorite Futures: E-mini ES S&P 500
 
Big Mike's Avatar
 
Posts: 46,238 since Jun 2009
Thanks: 29,350 given, 83,218 received

Answer
This post has been selected as an answer to the original posters question Answer


Historical charts and backtesting are incapable of COBC = false. It is a design limitation.

COBC = false is only available on live incoming data. So make sure your test is live incoming data in a moving market, and not based on adding the indicator to a chart --- at which point it is historical data only.

You could do:

 
Code
                            
if (Historical) return; 

At the top of your code.

Mike

Due to time constraints, please do not PM me if your question can be resolved or answered on the forum.

Need help?
1) Stop changing things. No new indicators, charts, or methods. Be consistent with what is in front of you first.
2) Start a journal and post to it daily with the trades you made to show your strengths and weaknesses.
3) Set goals for yourself to reach daily. Make them about how you trade, not how much money you make.
4) Accept responsibility for your actions. Stop looking elsewhere to explain away poor performance.
5) Where to start as a trader? Watch this webinar and read this thread for hundreds of questions and answers.
6)
Help using the forum? Watch this video to learn general tips on using the site.

If you want
to support our community, become an Elite Member.

Reply With Quote
The following 4 users say Thank You to Big Mike for this post:
 
  #4 (permalink)
Elite Member
Des Moines, IA
 
Futures Experience: Beginner
Platform: NinjaTrader
 
Posts: 22 since Nov 2009
Thanks: 33 given, 16 received

Possible Solution: Use Multiple Timeframes

Thanks Mike. This explains what I was seeing then. I added another timeframe (single tick), and this seems to have fixed my problem. Of course my code is now much more complex than the simple HTML-generating indicator that I envisioned, but it's working for the most part.

Reply With Quote
 
  #5 (permalink)
Elite Member
Near the BEuTiFULL Horse Shoe
 
Futures Experience: Beginner
Platform: NinjaTrader
Broker/Data: MBTrading Dukascopy ZenFire
Favorite Futures: $EURUSD when it is trending
 
Trader.Jon's Avatar
 
Posts: 500 since Jul 2009
Thanks: 401 given, 176 received


Big Mike View Post
Historical charts and backtesting are incapable of COBC = true. It is a design limitation.

COBC = false is only available on live incoming data. So make sure your test is live incoming data in a moving market, and not based on adding the indicator to a chart --- at which point it is historical data only.

You could do:

 
Code
                            
if (Historical) return; 

At the top of your code.

Mike

Mike,

""Historical charts and backtesting are incapable of COBC = true""

I think I am confused: this is from the NT7 f1 help:
If true, OnBarUpdate() is called on the close of each bar otherwise it is called on each incoming tick. This property should ONLY be set in an Initialize() method and be the last statement within that method.

∑ When indicators or strategies are running on historical data, OnBarUpdate() is only called on the close of each historical bar even if this property is set to false. This is due to the fact that with a historical data set, only the OHLCVT of the bar is known and not each tick that made up the bar.

∑ The CalculateOnBarClose property of indicators embedded within a strategy are overriden by the CalculateOnBarClose property of the strategy

Doesnt this mean that COBC=true is only workable option in backtesting/historical charts?

Jon

Reply With Quote
 
  #6 (permalink)
Elite Member
Des Moines, IA
 
Futures Experience: Beginner
Platform: NinjaTrader
 
Posts: 22 since Nov 2009
Thanks: 33 given, 16 received


Trader.Jon View Post

Doesnt this mean that COBC=true is only workable option in backtesting/historical charts?

Jon

I am no expert at this. I am a software developer with over 10 years experience, so my coding skills are fine, but NT has a bit of a learning curve.

I found a workaround and was able to get my indicator to be called for each incoming tick, but I had to add a 1-tick timeframe to my indicator. This means that you will have to reference price in a different way throughout your indicator. Instead of High[0] you will use Highs[0][0]. The first series of the array refers to which timeframe.

For me, I want to check for a crossover with each incoming tick, so I use this...

 
Code
					//CROSSOVER HIT!
					if (Closes[1][0] < (SMA(BarsArray[0],12)[0]-.2) && !bLongFirstIn && bLongSignalHit){
This means the 1-tick dataset crosses the 333 tick SMA(12). Hope that helps. There are other examples, but I will tell you it's a pain once you commit to multiple timeframes. Everything you code becomes more complex.

Reply With Quote
The following 3 users say Thank You to Curbfeeler for this post:
 
  #7 (permalink)
Site Administrator
Manta, Ecuador
 
Futures Experience: Advanced
Platform: My own custom solution
Favorite Futures: E-mini ES S&P 500
 
Big Mike's Avatar
 
Posts: 46,238 since Jun 2009
Thanks: 29,350 given, 83,218 received


Trader.Jon View Post
Mike,

""Historical charts and backtesting are incapable of COBC = true""

Was a type-o, I meant false. The very next sentence I said "COBC = false is only available on live incoming data.". I have corrected the type-o.

Mike

Due to time constraints, please do not PM me if your question can be resolved or answered on the forum.

Need help?
1) Stop changing things. No new indicators, charts, or methods. Be consistent with what is in front of you first.
2) Start a journal and post to it daily with the trades you made to show your strengths and weaknesses.
3) Set goals for yourself to reach daily. Make them about how you trade, not how much money you make.
4) Accept responsibility for your actions. Stop looking elsewhere to explain away poor performance.
5) Where to start as a trader? Watch this webinar and read this thread for hundreds of questions and answers.
6)
Help using the forum? Watch this video to learn general tips on using the site.

If you want
to support our community, become an Elite Member.

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

Reply



futures io > > > > Is NT7 "CalculateOnBarClose = false" broken?

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
dealing with GetCurrentBidVolume and GetCurrentAskVolume , "long" casting into "int" jmejedi NinjaTrader Programming 4 May 23rd, 2011 10:33 AM
jtRangeMakrker7 - Printing in "Output" window on NT7....4 Affliction NinjaTrader 5 April 29th, 2011 10:22 AM
"Beware of false Prophets" Hard 8 Beginners and Introductions 7 November 14th, 2010 04:29 PM
"Wicked Renko" indicator for NT7 tr8ermom NinjaTrader 2 November 9th, 2010 11:20 AM
How do you "lock" indicators in NT7 so you can't delete them? Todd NinjaTrader 4 May 16th, 2010 03:37 PM


All times are GMT -4. The time now is 02:39 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.12 seconds with 31 queries on phoenix via your IP 54.90.207.75