have a nice day
The length of the last candle is 10.
It is stored in a variable called BarLength.
The BarLength should be constant in the loop, but it changes as you can see in the photo.
protected override void OnBarUpdate()
{
//Add your custom indicator logic here.
if (Bars==null) return;
NinjaTrader.NinjaScript.BarsTypes.VolumetricBarsType barsType =
Bars.BarsSeries.BarsType as NinjaTrader.NinjaScript.BarsTypes.VolumetricBarsType;
if (barsType == null) return;
int BarLength=(int) ((High[0] - Low[0]) / TickSize);
for (int i = 0; i <=BarLength; i++)
{
Draw.Text(this,"myTaga-"+i.ToString(),High[0].ToString(),i,High[i],Brushes.Yellow);
Draw.Text(this,"myTagb-"+i.ToString(),BarLength.ToString(),i,Low[i],Brushes.Yellow);
}
}

Comment