Thanks for the solution!
But, a couple of questions
1 - how do I now change the color of the last price label when I want red or green?
2 - how to stop updating if the chart has been moved?
Thanks.
Code: Select all
if (high && low)
{
let color = 'green';
if (open > tick.bid)
{
color = 'red';
}
let series = chart_obj.series[0];
if (series !== undefined && series.points !== undefined)
{
series.points[series.points.length-1].update({
open: open,
high: high,
low: low,
close: tick.bid,
color: color,
lineColor: color
});
series.update({
lastVisiblePrice: {
label: {
backgroundColor: color,
borderColor: color,
}
},
lastPrice: {
color: color,
}
}, true);
}
}
Code: Select all
lastPrice: {
color: color,
label: {
backgroundColor: color,
borderColor: color,
}
}