I am new to Ninjascript programming but am a developer w/ 20+ years experience.
What I am wanting to do seems simple enough ... after initialization and startup of my indicator I want to reference the "current" bar in OnBarUpdate. Not CurrentBar as defined in the docs, but rather the most current bar from a time point of view.
So, I put in the following test code:
protectedoverridevoid OnBarUpdate()
{
Print(CurrentBar.ToString() + ", " +
(Bars.Count - 1).ToString());
if (CurrentBar == Bars.Count - 1)
{
// Do my thing!
}
}
Now, I run it and check the output window for the last entry.
It shows CurrentBar = 1378 and Bars.Count - 1 = 1379.
It seems that OnBarUpdate does not get called for the "current/last" bar.
Am I just missing something? Is there an easier way to determine the right-most bar on a chart on start up? I'm just having too much fun!
Thanks ... Ed
Comment