why is this not working??
would like to paint volume bar black if it is below a certain amount
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 Plot(new Pen(Color.Black, 2), PlotStyle.Bar, "LowVol"));
Add(new Line(Color.DarkGray, 0, "Zero line"));
DrawOnPricePanel = false;
}
/// <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();
if (Volume[1]<x)
{ Values[2].Set(Volume[1]);
}
}
else
{
Values[1].Set(Volume[0]);
Values[0].Reset();
if (Volume[1]<x)
{ Values[2].Set(Volume[1]);
many thanks for your help/advise
Can you help answer these questions from other members on futures io?
Here are some changes that I suggest. Have not tested them. Also ou need to declare the Variable x via "double x = 0.0;" somewhere.
Further suggestions:
If you post code, you can use [Code] tags -> just highlight the code and select # on your task bar
The condition
will work but is annoying, because you have to change the value of x for every instrument. You could try
This would show the bar as a low volume bar, if it has the lowest volume of the last 20 bars - not including the current active bar, which is yet incomplete.