Currently I'm doing it with the Draw.Region method (https://ninjatrader.com/support/help...raw_region.htm), but this creates lots of drawing objects that are visible in the 'Drawing Objects' window.
Is there a better way, or at least a way to hide these regions from the Drawing Objects window?
My code is (snippet):
private Region lastregion = null;
....
in OnBarUpdate() :
....
if (adxTrend[0] && ((ADXPlot[0]<DiPlus[0] && ADXPlot[0]>DiMinus[0]) || (ADXPlot[0]>DiPlus[0] && ADXPlot[0]<DiMinus[0])) ) {
if (lastregion==null)
lastregion = Draw.Region(this, "adx" + CurrentBar, Time[1], Time[0], DiPlus, DiMinus, Brushes.Yellow, Brushes.Yellow, 100);
else
lastregion.EndAnchor.Time = Time[0];
//re-using lastregion to reduce the amount of regions drawn
} else {
lastregion = null;
}

Comment