I appreciate your help.
I am trying to tag the bars on the chart based on a condition. I wrote this but it works only on the first bar that achieve the condition; not all. Would you please help where is the mistake?
Thank you.
protected override void OnBarUpdate()
{
NinjaTrader.NinjaScript.BarsTypes.VolumetricBarsTy pe barsType = Bars.BarsSeries.BarsType as
NinjaTrader.NinjaScript.BarsTypes.VolumetricBarsTy pe;
NinjaTrader.Gui.Tools.SimpleFont myFont = new NinjaTrader.Gui.Tools.SimpleFont("Courier New", 12) { Size = 20, Bold = true };
if (barsType == null)
return;
int count=1;
if (CurrentBar < Count-2)
for(count = 1; count < Count-1; count++)
{
if (Bars.GetClose(Count-(count+1)) > (Bars.GetHigh(Count-count)+Bars.GetLow(Count-count))/2)
Draw.Text(this, "tag1", false, "*", Bars.GetTime(Count-(count+1)), Bars.GetHigh(Count-(count+1)), 10, Brushes.Blue, myFont, TextAlignment.Center, Brushes.Transparent, null, 1);
}
}
Comment