I'm trying to get familliar with the NinjaTrader platform and its indicators and strategys. I have written a stimple indicator that repaints a bar if it meets condidtions (meant to indicate a reversal).
The problem is, the bar painting works as a strategy but not as an indicator. The problem with this is that I have to be connected to a data feed in order for the bars to be repainted. So checking past charts offline doesn't work.
It's not the end of the world, but I'm curious why the strategy works and the indicator doesn't. Can I not repaint bars as an indicator? The only difference in the code (as far as my action goes) is in the initialize where I have overlay set to true in the indicator and that isn't in the strategy code. I tried the drawdot and plotcolors and neither of those work in the indicator as well. Thanks.
protectedoverridevoid Initialize()
{
Overlay = true;
CalculateOnBarClose = false;
}
protectedoverridevoid OnBarUpdate()
{
//bar down
if( High[0] > MAX(High, DPeriod)[1] && Close[0] < Close[1] && Open[1] < Close[1])
{
this.BarColor = Color.Magenta;
//DrawDot("tag1", true, 0, Low[0] - 1, Color.Red);
}
//bar up
if( Low[0] < MIN(Low, UpPeriod)[1] && Close[0] > Close[1] && Open[1] > Close[1])
{
this.BarColor = Color.Aqua;
//PlotColors[0][0] = Color.Aqua;
}
}
Comment