Close[0] not the last bar? - futures io
futures io



Close[0] not the last bar?


Discussion in NinjaTrader

Updated
    1. trending_up 261 views
    2. thumb_up 0 thanks given
    3. group 2 followers
    1. forum 3 posts
    2. 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)

 
Search this Thread
 

Close[0] not the last bar?

(login for full post details)
  #1 (permalink)
 chipwitch 
Nashville, TN
 
Experience: Beginner
Platform: NinjaTrader
Broker: NinjaTrader, Continuum Data
Trading: MES for now... baby steps
 
chipwitch's Avatar
 
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.

Started this thread Reply With Quote

Can you help answer these questions
from other members on futures io?
need help with easy language OR breakout code:)
Traders Hideout
value chart indicator by sim22
NinjaTrader
Tips for directional bias during Asian Session?
Traders Hideout
mahDualCandlePattern
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on futures io
Spoo-nalysis ES e-mini futures S&P 500
44 thanks
How many day traders are profitable?
27 thanks
Why you should move from futures to forex
15 thanks
Attached Orders
13 thanks
fx "traders" hate real profitable traders
8 thanks
 
(login for full post details)
  #2 (permalink)
 chipwitch 
Nashville, TN
 
Experience: Beginner
Platform: NinjaTrader
Broker: NinjaTrader, Continuum Data
Trading: MES for now... baby steps
 
chipwitch's Avatar
 
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.

Started this thread Reply With Quote
 
(login for full post details)
  #3 (permalink)
 trendisyourfriend 
Market Wizard
Quebec
 
Experience: Intermediate
Platform: NinjaTrader wt Rancho Dinero's profiling tools
Broker: AMP/CQG
Trading: ES, NQ, YM
 
trendisyourfriend's Avatar
 
Posts: 4,177 since Oct 2009
Thanks: 3,854 given, 5,454 received



chipwitch View Post
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;
    }
}

Reply With Quote
 
(login for full post details)
  #4 (permalink)
 chipwitch 
Nashville, TN
 
Experience: Beginner
Platform: NinjaTrader
Broker: NinjaTrader, Continuum Data
Trading: MES for now... baby steps
 
chipwitch's Avatar
 
Posts: 219 since Feb 2022
Thanks: 154 given, 392 received


trendisyourfriend View Post
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.

Started this thread Reply With Quote


futures io Trading Community Platforms and Indicators NinjaTrader > Close[0] not the last bar?


Last Updated on May 1, 2022


Upcoming Webinars and Events
 

NinjaTrader Indicator Challenge!

Ongoing
     



Copyright © 2022 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada), 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