Hi, A wanted to build a loop to look for several orders on the same instrument and merge them. I tried to use the method mergeOrders
IOrder mergeOrders(String label,
Collection<IOrder> orders)
throws JFException
but I get the following error:
Quote:
no suitable method found for mergeOrders(java.lang.String,java.util.Collection<com.dukascopy.api.IOrder>)
method com.dukascopy.api.IEngine.mergeOrders(java.lang.String,com.dukascopy.api.IOrder...) is not applicable
(argument type java.util.Collection<com.dukascopy.api.IOrder> does not conform to vararg element type com.dukascopy.api.IOrder)
method com.dukascopy.api.IEngine.mergeOrders(com.dukascopy.api.IOrder...) is not applicable
(argument type java.lang.String does not conform to vararg element type com.dukascopy.api.IOrder)
I attach the code:
public void lookForMerge(IOrder orden) throws JFException
{
Collection<IOrder> listaMerge = new ArrayList<IOrder>();
int masOrdenes=0;
for (IOrder order : engine.getOrders(par))
{
if (order.getState()==IOrder.State.FILLED)
{
if (!order.equals(orden))
{
order.setStopLossPrice(0);
masOrdenes=1; // there are more orders than the first one...
}
}
}
if (masOrdenes==1)
{
String label = getLabel(orden.getInstrument());
engine.mergeOrders(label, listaMerge) throws JFException;
}
Thanks in advance,
Carlos