NinjaTrader Support Forum  
X

Attention!

This website will be down for maintenance from Friday May 24th at 6PM MDT until Saturday May 25th at 11AM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com


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

General Programming General NinjaScript programming questions.

Reply
 
Thread Tools Display Modes
Old 06-01-2010, 01:56 PM   #1
10percent
Junior Member
 
Join Date: Jun 2010
Posts: 10
Thanks: 0
Thanked 0 times in 0 posts
Default How can I access to data of last bar?

Hi there,

I'm new at NinjaTrader and NinjaScript. However, I have experince in MetaTrader, so I'm not completely foreign to trade programming.

I've installed NT and connected to Yahoo for daily data.

I created an indicator that has the following line in it to print bar data on th chart:

Print(CurrentBar.ToString() + " " + ToDay(Time[0]) + " Open: " + Open[0].ToString() + " Close: " + Close[0].ToString());

and here's the last part of output as of today (June 1st) for symbol INTC:
....
....
242 20100517 Open: 21.75 Close: 22.02
243 20100518 Open: 22.14 Close: 21.43
244 20100519 Open: 21.52 Close: 21.6
245 20100520 Open: 21.02 Close: 20.79
246 20100521 Open: 20.41 Close: 20.91
247 20100524 Open: 20.95 Close: 20.67
248 20100525 Open: 20.12 Close: 20.85
249 20100526 Open: 21.1 Close: 20.7
250 20100527 Open: 21.16 Close: 21.76

My question is : where is May 28th data?
Considering yesterday was a holiday, May 28th is the last bar, and I can see May 28th bar on the chart. In fact, when I insert a SMA into the chart, I can see that the SMA is not plotted for May28th either.

I'm sure I'm missing something here, any help is appreciated.

Thanks,

Nick.
10percent is offline  
Reply With Quote
Old 06-01-2010, 02:12 PM   #2
NinjaTrader_Tim
NinjaTrader Customer Service
 
NinjaTrader_Tim's Avatar
 
Join Date: Nov 2009
Location: Denver, CO
Posts: 1,424
Thanks: 0
Thanked 3 times in 3 posts
Default

Hi 10percent, and welcome to the forums!

It looks like the last available day using the Yahoo feed is May 28th, so this is treated as the current bar.

You will need to change the CaculateOnBarClose setting (Right click>Indicators) to false. Or change this in your code.

More info at - http://www.ninjatrader-support.com/H...ateOnBarClose1
NinjaTrader_Tim is offline  
Reply With Quote
Old 06-01-2010, 02:30 PM   #3
10percent
Junior Member
 
Join Date: Jun 2010
Posts: 10
Thanks: 0
Thanked 0 times in 0 posts
Default

Tim, thanks for quick reply.

I had added

CalculateOnBarClose = false;

in my code, but I kept pressing F5 on the chart to receive the changes.
I removed the indicator and added back on, now It works.

Nick.
10percent 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
Problem: basic indicator starts only on 21st bar of a daily chart CycleArt Charting 2 06-01-2010 02:05 PM
My bar chart saeed Charting 1 05-31-2010 04:48 AM
Today's 9:00 bar Stem1 General Programming 1 05-31-2010 03:58 AM
Backtest using daily bars (same bar signal) tradinghumble Strategy Development 3 05-28-2010 11:30 AM
data series bar type field - request/suggestion toddaclark Version 7 Beta General Questions & Bug Reports 5 05-28-2010 08:12 AM


All times are GMT -6. The time now is 11:06 AM.