Trading Articles
Article Categories
Article Tools
Close[0] not the last bar?
Updated May 1, 2022
trending_up
261 views
thumb_up
0 thanks given
group
2 followers
forum
3 posts
attach_file
0 attachments
Welcome to futures io: the largest futures trading community on the planet, with well over 150,000 members
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
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
(If you already have an account, login at the top of the page)
Close[0] not the last bar?
(login for full post details)
#1 (permalink )
Nashville, TN
Experience: Beginner
Platform: NinjaTrader
Broker: NinjaTrader, Continuum Data
Trading: MES for now... baby steps
Posts: 219 since Feb 2022
Thanks: 154 given,
392
received
I have been working with Ninjascript for a while and never noticed this before.
Does anyone know why there would be an additional bar painted on the chart after the one represented by Close[0]?
In other words, when I Print(Close[0]) in the OnBarUpdate() method, every bar close gets printed to the output window except the last one. I am unable to read the last bar Series<t> variables programmatically.
Can you help answer these questions from other members on futures io?
Best Threads (Most Thanked) in the last 7 days on futures io
(login for full post details)
#2 (permalink )
Nashville, TN
Experience: Beginner
Platform: NinjaTrader
Broker: NinjaTrader, Continuum Data
Trading: MES for now... baby steps
Posts: 219 since Feb 2022
Thanks: 154 given,
392
received
I did find that I can get the last bar data using the Bars.GetClose() method. It's just the Series<t> that doesn't seem to see the last bar.
(login for full post details)
#3 (permalink )
Market Wizard
Quebec
Experience: Intermediate
Platform: NinjaTrader wt Rancho Dinero's profiling tools
Broker: AMP/CQG
Trading: ES, NQ, YM
Posts: 4,177 since Oct 2009
Thanks: 3,854 given,
5,454
received
chipwitch
I have been working with Ninjascript for a while and never noticed this before.
Does anyone know why there would be an additional bar painted on the chart after the one represented by Close[0]?
In other words, when I Print(Close[0]) in the OnBarUpdate() method, every bar close gets printed to the output window except the last one. I am unable to read the last bar Series<t> variables programmatically.
Make sure to set Calculate correctly...
Syntax
Calculate.OnBarClose
Calculate.OnEachTick
Calculate.OnPriceChange
Code
protected override void OnStateChange()
{
if (State == State.SetDefaults)
{
// Calculate on each tick and not on bar close
Calculate = Calculate.OnEachTick;
}
}
(login for full post details)
#4 (permalink )
Nashville, TN
Experience: Beginner
Platform: NinjaTrader
Broker: NinjaTrader, Continuum Data
Trading: MES for now... baby steps
Posts: 219 since Feb 2022
Thanks: 154 given,
392
received
trendisyourfriend
Make sure to set Calculate correctly...
Syntax
Calculate.OnBarClose
Calculate.OnEachTick
Calculate.OnPriceChange
Code
protected override void OnStateChange()
{
if (State == State.SetDefaults)
{
// Calculate on each tick and not on bar close
Calculate = Calculate.OnEachTick;
}
}
That wasn't it. I had already tried that, but thank you.
Last Updated on May 1, 2022
Ongoing