All this is doing is painting red and green bars on volume. I am planning to do the same but I need 5 colors for different scenarios.
How does the indicator know what is red and what is lime? I understand the add new plot but where is the array telling which color to use.
dataseries IndicatorBase.Values.
Lastly why is there a Values[1].Reset() ?
protected override void Initialize()
{
Add(new Plot(new Pen(Color.Lime, 2), PlotStyle.Bar, "UpVolume"));
Add(new Plot(new Pen(Color.Red, 2), PlotStyle.Bar, "DownVolume"));
Add(new Line(Color.DarkGray, 0, "Zero line"));
}
/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
if (Close[0] >= Open[0])
{
Values[0].Set(Volume[0]);
Values[1].Reset();
}
else
{
Values[1].Set(Volume[0]);
Values[0].Reset();
}
}
}
}
Comment