nicofr0707 wrote:
1 - Can't figure out how to create a chartOject with an object Key without using deprecated methods, see exemple :
We were not able to reproduce this. We tested with the following strategy:
package charts.test;
import java.awt.Color;
import java.util.UUID;
import com.dukascopy.api.*;
import com.dukascopy.api.drawings.IRayLineChartObject;
public class RayLine implements IStrategy {
private IChart chart;
private IHistory history;
@Override
public void onStart(IContext context) throws JFException {
this.chart = context.getChart(Instrument.EURUSD);
this.history = context.getHistory();
ITick tick = history.getLastTick(Instrument.EURUSD);
double price1 = (tick.getAsk() + tick.getBid()) / 2;
IRayLineChartObject line1 = chart.getChartObjectFactory().createRayLine();
line1.setPrice(0, price1);
line1.setTime(0, tick.getTime());
line1.setPrice(1, price1 - 0.0010);
//5 bars ahead
line1.setTime(1, tick.getTime() - chart.getSelectedPeriod().getInterval() * 5);
line1.setColor(Color.BLUE);
chart.addToMainChart(line1);
//use the same coordinates, but change the style
IRayLineChartObject line2 = chart.getChartObjectFactory().createRayLine(UUID.randomUUID().toString(),
line1.getTime(0), line1.getPrice(0),
line1.getTime(1), line1.getPrice(1));
line2.setOpacity(0.2f);
line2.setColor(Color.RED);
line2.setLineWidth(10);
chart.addToMainChart(line2);
}
@Override
public void onTick(Instrument instrument, ITick tick) throws JFException { }
@Override
public void onBar(Instrument instrument, Period period, IBar askBar, IBar bidBar) throws JFException {}
@Override
public void onMessage(IMessage message) throws JFException {}
@Override
public void onAccount(IAccount account) throws JFException {}
@Override
public void onStop() throws JFException {}
}
Attachment:
RayLine.java [1.79 KiB]
Downloaded 364 times
nicofr0707 wrote:
3 - How to lock a chartObject on the chart ? (previously we used addToMainChartUnlocked() to lock or not the object)
There is no more division in unlocked or locked objects.
nicofr0707 wrote:
It would be nice to have an updated documentation on the chartObject wiki.
Please elaborate on what additional information you would like to find in the JForex wiki? Regarding deprecated methods in
object catalog - they have not been replaced, since they are due to be reintroduced but with a more informative signature, e.g.:
instead of:
IRectangleChartObject createRectangle(Object... params)
there will be:
IRectangleChartObject createRectangle(String key, long time1, double price1, long time2, double price2)