Hello support,
I notice there is a strange " flashening "on chart drawings sent by the strategy I'm building, The logic is under " onBar " method so the event should be executed once every 1 minute bar (in this case), while the logic is somehow repeated MANY times every new 1 minute bar causing that lines are drawn and then quickly re-drawn.
I tried many different ways to avoid this, but without success.
Is there something wrong / missing in the code itself?
Here's extracted part of code. It is repeated for 4 instruments, but the same behavior happens even with 1 single instrument:
if (period.equals(Period.ONE_MIN)){
for (IChart chart : context.getCharts(SelectedInstrument2)) {
if (chart.getSelectedPeriod().equals(Period.FIVE_MINS) && SelectedInstrument2.equals(chart.getInstrument())){
IPriceMarkerChartObject Line1 =
chart.getChartObjectFactory().createPriceMarker("H1L", price1);
IPriceMarkerChartObject Line2 =
chart.getChartObjectFactory().createPriceMarker("H1P", price2);
H1HighOpen.setColor(h1Color);
Line1 .setLineWidth(L1Width);
Line1 .setLineStyle(L1Style);
Line1 .setOpacity(0.6f);
Line1 .setText("L1");
Line2 .setColor(L1Color);
Line2 .setLineWidth(L1Width);
Line2 .setLineStyle(L1Style);
Line2 .setOpacity(0.6f);
Line2 .setText("L1");
chart.add(Line1);
chart.add(Line2);
}
}
}
Thank you