PDA

View Full Version : Change Pen color, on the fly?


tazatek
07-31-2008, 01:28 AM
Hi,

I've been trying something like the following:

Plots[0].Pen = new Pen(color, 4);
HA_Plot1.Set(Close[0]);

... to change the color of the plot based on certain values. I'm not getting a compile error for doing this, but the setting of the pen color is being ignored completely.

Thoughts ? I've looked at the SampleMultiColorPlot, but that uses multiple Plots. I'd rather use multiple pens instead... possible?


Thanks.

TazaTek

NinjaTrader_Dierk
07-31-2008, 01:31 AM
Unfortunately this is not supported.

majkie
08-09-2008, 09:00 AM
Hi there,
I am not sure if this is possible but in manual I found this piece of code:
// Initialize method of a custom indicator
protected override void Initialize()
{
// Plots are added to the Plots collection in order
Add(new Plot(Color.Orange, "Plot1")); // Stored in Plots[0]
Add(new Plot(Color.Blue, "Plot2")); // Stored in Plots[1]
}

// Dynamically change the primary plot's color based on the indicator value
protected override void OnBarUpdate()
{
if (Value[0] > 100)
Plots[0].Pen = new Pen(Color.Blue);
else
Plots[0].Pen = new Pen(Color.Red);
}

What exactly is this doing? I understood it as tazatek described...

NinjaTrader_Ray
08-09-2008, 10:57 AM
Just changes the color from blue to red of the primary plot of an indicator.