protected override void OnBarUpdate()
{
DrawLine("line", 5, Close[5], 0, Close[0], Color.Blue);
}
No line appears on my chart. What am I missing?
I have another question also. The indicator that I want to create will draw stairstepping lines - lines plotted, say, from a swing low on an early bar to a swing high on a later bar, then from that swing high to an even more recent swing low... etc.
I understand that the OnBarUpdate() function is called for every bar.
1. Does this mean that every bar on the chart becomes Bar[0] when the function is called for that bar?
2. If so, how can I have OnBarUpdate() called only for the last (current) bar, OR have the code inside OnBarUpdate() only executed for the current bar? For my indicator I only need to call the function on the current bar, determine my swing points from the price dataseries, and draw my stair stepping lines once, would that be correct?
Thankyou.
Comment