NinjaTrader Support Forum  

Go Back   NinjaTrader Support Forum > NinjaScript Development Support > General Programming

General Programming General NinjaScript programming questions.

Reply
 
Thread Tools Display Modes
Old 01-26-2011, 07:27 PM   #1
sgordet
Senior Member
 
Join Date: Feb 2010
Posts: 150
Thanks: 1
Thanked 1 time in 1 post
Default Confused about Close[0]

Example from manual:
if (Close[0] > Close[1]) Print ("We had an up day");

If CalculateOnBarClose is true, isn't every single tick the "close" so that if you run this code with that option on, you don't really know if you had an up day when you're running this test as you could always wind up lower at the end of the bar?.
Now, if CalculateOnBaClose is false, you don't know when the bar has ended until you get the first tick of the next bar and then isn't Close[0] really Close[1] at that point?
As I wrote above, I'm confused.
Thanks,
Stephen
sgordet is offline  
Reply With Quote
Old 01-27-2011, 06:20 AM   #2
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,560
Thanks: 261
Thanked 1,015 times in 996 posts
Default

Stephen, it's more the other way around - CalculateOnBarClose = true calcs only on the bar close == the opening tick of the new bar, so you would then be in the position to know if you had an upday or not as the closing tick of the bar is in.
NinjaTrader_Bertrand is online now  
Reply With Quote
Old 01-27-2011, 05:19 PM   #3
ETFVoyageur
Senior Member
 
Join Date: Dec 2010
Posts: 470
Thanks: 0
Thanked 4 times in 4 posts
Default

Quote:
Originally Posted by NinjaTrader_Bertrand View Post
Stephen, it's more the other way around - CalculateOnBarClose = true calcs only on the bar close == the opening tick of the new bar, so you would then be in the position to know if you had an upday or not as the closing tick of the bar is in.
Bertrand,

That explains the perverse behavior I have seen. If you are working with EOD data then you must always set COBC false. If it is true, then you will not process the last bar on your chart until the next day. For example, if you examine your charts in the evening, your indicators will not be up to date as of that day.

Suggestion: NT ought to know when time-based bars are complete, and process them right away, without waiting for the next day. Otherwise you sit there wondering "What do you mean that today's NYSE trading has not closed? Try telling the NYSE that!"

--EV
ETFVoyageur is offline  
Reply With Quote
Old 01-28-2011, 05:51 AM   #4
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,560
Thanks: 261
Thanked 1,015 times in 996 posts
Default

Thanks for the suggestion EV - NT's framework is event based and not time based .
NinjaTrader_Bertrand is online now  
Reply With Quote
Old 01-28-2011, 08:46 AM   #5
ETFVoyageur
Senior Member
 
Join Date: Dec 2010
Posts: 470
Thanks: 0
Thanked 4 times in 4 posts
Default

Quote:
Originally Posted by NinjaTrader_Bertrand View Post
Thanks for the suggestion EV - NT's framework is event based and not time based .
First of all, this is not really a problem for me -- since I am doing nothing tick-based I just always turn off COBC.

Whether or not you have them now, there certainly could be time events. Perhaps for those markets that do have a set open and close, such as NYSE, an event could be generated for the market open and close. I have not paid attention to strategies yet, but I can easily imagine wanting to do things with respect to market open and close. Market close could be used to mark bars for that market closed, rather than waiting for the next market day's trading to begin.

As I said, no big deal for me personally -- just one of those little oddities. After all, it is "Calculate On Bar Close", not "Calculate When The Next Bar Opens".

--EV
ETFVoyageur is offline  
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Confused about Bars skyholder84 Automated Trading 27 10-27-2010 12:42 PM
Confused Mindset Indicator Development 6 09-02-2009 07:18 AM
Confused... d.allen101 Automated Trading 1 06-16-2009 02:58 PM
Confused Duval Strategy Analyzer 24 12-05-2008 03:19 PM
really confused about bid/ask/last... behealed Miscellaneous Support 4 04-06-2008 09:47 PM


All times are GMT -6. The time now is 03:51 AM.