but what keeps happening, i've tried several ways, i tried using Line/Lines terms, is that the whole line plots only one color instead of the line plotting a color dependent upon which condition is true for that bar, i.o.w. i want a line that plots the condition color at zero but stays that conditions color once another bar is begun...
maybe i need to pass the conditions into a dataseries by storing a simple value for each condition then plot that condition?
thanks for you time, i'm not a programmer by any means.... i haven't even finished the plots, i was going to continue with plot definitions and limits for 200-299.9999 and 300+, both for positive and negative....
here's what i've done:
protected override void Initialize()
{
Add(new Plot(Color.FromKnownColor(KnownColor.White), PlotStyle.Line, "CCIcolor_Val")); //data holder for CCIcolor(Period)
Add(new Plot(Color.FromKnownColor(KnownColor.Silver), PlotStyle.Line, "ZeroPlot")); //new ZeroPlot color changing line...
Add(new Plot(Color.FromKnownColor(KnownColor.LimeGreen), PlotStyle.Line, "Positive"));
Add(new Plot(Color.FromKnownColor(KnownColor.MediumTurquoi se), PlotStyle.Line, "MiddlePositive"));
Add(new Plot(Color.FromKnownColor(KnownColor.Red), PlotStyle.Line, "Negative"));
Add(new Plot(Color.FromKnownColor(KnownColor.HotPink), PlotStyle.Line, "MiddleNegative"));
Add(new Line(Color.FromKnownColor(KnownColor.Crimson), 200, "TwoHundredTop"));
Add(new Line(Color.FromKnownColor(KnownColor.ForestGreen), -200, "TwoHundredBottom"));
Add(new Line(Color.FromKnownColor(KnownColor.Green), Up, "Up"));
Add(new Line(Color.FromKnownColor(KnownColor.Red), Down, "Down"));
PaintPriceMarkers = true;
Plots[0].Pen.Width = 1;
Plots[2].Pen.Width = 4;
Plots[4].Pen.Width = 4;
Plots[3].Pen.Width = 2;
Plots[5].Pen.Width = 2;
Lines[0].Pen.Width = 1;
Lines[1].Pen.Width = 4;
Plots[2].Min = up; // set the plot threshold values
Plots [2].Max = 199.9999;
Plots[3].Max = up;
Plots[3].Min = 0;
Plots[4].Max = down;
Plots[4].Min = -199.9999;
Plots[5].Max = 0;
Plots[5].Min = down;
CalculateOnBarClose = false; // calculate on each tick data
Overlay = false;
}
/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
if (CurrentBar < Period) return;
double CCIcolor_Val = CCI(Period)[0];
// Use this method for calculating your indicator values. Assign a value to each
// plot below by replacing 'Close[0]' with your own formula.
ZeroPlot.Set (0); // set ZeroPlot to 0 value ????
Positive.Set(CCIcolor_Val); // or Positive.Set(CCI(Period)[0]);
MiddlePositive.Set(CCIcolor_Val);
Negative.Set(CCIcolor_Val);
MiddleNegative.Set(CCIcolor_Val);
if ( CCI(Period)[0] > CCI(Period)[1] && Close[0] >= Close[1] )
{Plots[1].Pen = new Pen(Color.LimeGreen, 4);}
else if ( CCI(Period)[0] < CCI(Period)[1] && Close[0] <= Close[1] )
{Plots[1].Pen = new Pen(Color.Red, 4);}
else if ( CCI(Period)[0] < CCI(Period)[1] && Close[0] > Close[1] )
{Plots[1].Pen = new Pen(Color.Magenta, 4);}
else if ( CCI(Period)[0] > CCI(Period)[1] && Close[0] < Close[1])
{Plots[1].Pen = new Pen(Color.Yellow, 4);}
else
{Plots[1].Pen = new Pen(Color.Silver, 4);}
}
#region Properties
[Browsable(false)] // this line prevents the data series from being displayed in the indicator properties dialog, do not remove
[XmlIgnore()] // this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove
public DataSeries CCIcolor_Val
{
get { return Values[0]; }
}
[Browsable(false)] // this line prevents the data series from being displayed in the indicator properties dialog, do not remove
[XmlIgnore()] // this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove
public DataSeries ZeroPlot
{
get { return Values[1]; }
}
[Browsable(false)] // this line prevents the data series from being displayed in the indicator properties dialog, do not remove
[XmlIgnore()] // this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove
public DataSeries Positive
{
get { return Values[2]; }
}
[Browsable(false)] // this line prevents the data series from being displayed in the indicator properties dialog, do not remove
[XmlIgnore()] // this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove
public DataSeries MiddlePositive
{
get { return Values[3]; }
}
[Browsable(false)] // this line prevents the data series from being displayed in the indicator properties dialog, do not remove
[XmlIgnore()] // this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove
public DataSeries Negative
{
get { return Values[4]; }
}
[Browsable(false)] // this line prevents the data series from being displayed in the indicator properties dialog, do not remove
[XmlIgnore()] // this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove
public DataSeries MiddleNegative
{
get { return Values[5]; }
}
[Description("CCIcolor period")]
[GridCategory("Parameters")]
public int Period
{
get { return period; }
set { period = Math.Max(1, value); }
}
[Description("setting for Up")]
[GridCategory("Parameters")]
public int Up
{
get { return up; }
set { up = Math.Max(1, value); }
}
[Description("setting for Down")]
[GridCategory("Parameters")]
public int Down
{
get { return down; }
set { down = Math.Max(1, value); }
}
#endregion
Comment