Changing plot colour on the fly problem
Posted: Jun 23 2015
I have tried to change the plot colour based on the indicator value is rising or falling, however it doesn't quite working during the turning point.
Attached the screen shot.
The code is like:
if (hmaSeries[0]>=hmaSeries[1]) {
hmaPlot.Set(0, hmaSeries[0], Color.LightGreen);
} else {
hmaPlot.Set(0, hmaSeries[0], Color.Red);
}
The code to initialize the plot:
hmaPlot = AddPlot(new PlotAttributes("HMA", EPlotShapes.Line, Color.White, Color.Empty, 0, 0, true));
The problem is the plot will still using the previous colour at the 1st bar after turning happened.
The indicator value on the screen from left to right are:
23617
23594
23727
23878
You will see on the screen shot, the line between 2nd and 3rd bar are still in red colour which is wrong. It should be in green colour instead. Any clue about this?
Attached the screen shot.
The code is like:
if (hmaSeries[0]>=hmaSeries[1]) {
hmaPlot.Set(0, hmaSeries[0], Color.LightGreen);
} else {
hmaPlot.Set(0, hmaSeries[0], Color.Red);
}
The code to initialize the plot:
hmaPlot = AddPlot(new PlotAttributes("HMA", EPlotShapes.Line, Color.White, Color.Empty, 0, 0, true));
The problem is the plot will still using the previous colour at the 1st bar after turning happened.
The indicator value on the screen from left to right are:
23617
23594
23727
23878
You will see on the screen shot, the line between 2nd and 3rd bar are still in red colour which is wrong. It should be in green colour instead. Any clue about this?