I have never asked for help in a NinjaTrader forum before, I hope I can provide enough info to get a helpful answer with minimal effort from the answer-er. I have a basic understanding of C#. I wrote software in SAS; building expert systems in it for a career. I have learned the basics of C# by working though various books. I've built separate indicators which work with the Market Analyzer flagging conditions of interest to me and they work well. I've worked through the examples provided by NinjaTrader, however I am at an impasse, and somewhat embarrassed, clearly missing something(s).
So in real life all I want to do is build an indicator which will display colored dots in its own panel based on a complex series of tests. I can do that myself if someone could provide some insights or perhaps solving this simpler version.
So I built the first example as it seems at first glance to be very close. I worked through the other examples as well.
However I don't have any need for a scale, I'm wanting to plot dots varying the color depending on the conditions tested for. I could find no example of such.
To start I tried working with setting Plot0.Set(1) and changing the line color so the line, plotted much like volume is displayed would change color but the line did not change color, and was one continuous line unlike volume. I tried other things but have had no luck advancing. Here is the code frag.
I'm not passing in Period, just using 3 to start with a trivial example.
Thanks.
protected override void OnBarUpdate()
{
// Are there enough bars
if (CurrentBar < 3) return;
if (SMA(3)[0] > SMA(3)[1]) Plots[0].Pen = new Pen(Color.Green);
else if (SMA(3)[0] < SMA(3)[1]) Plots[0].Pen = new Pen(Color.Red);
else Plots[0].Pen = new Pen(Color.Yellow);
Plot0.Set(1);
}
Comment