Dukascopy
 
 
Wiki JStore Search Login

Attention! Read the forum rules carefully before posting a topic.

    Try to find an answer in Wiki before asking a question.
    Submit programming questions in this forum only.
    Off topics are strictly forbidden.

Any topics which do not satisfy these rules will be deleted.

i have some problem with merge
 Post subject: i have some problem with merge Post rating: 0   New post Posted: Tue 29 Apr, 2014, 13:13 
User avatar

User rating: 0
Joined: Tue 29 Apr, 2014, 13:06
Posts: 8
Location: IsraelIsrael
hi every one
i have a problem when i try to merge orders in strategy code
i get a reject to merge and the message tell me that the group not found
i try to use mergedOrder.waitForUpdate(5, TimeUnit.SECONDS);
but it keep to give me a reject after few merges that did happen

if some can help me with that i will be very happy
eliran ruben


 
 Post subject: Re: i have some problem with merge Post rating: 0   New post Posted: Tue 29 Apr, 2014, 15:15 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
It might be that some of the positions that you are trying to merge are already being closed by another request and therefore you get this message.


 
 Post subject: Re: i have some problem with merge Post rating: 0   New post Posted: Tue 29 Apr, 2014, 16:20 
User avatar

User rating: 0
Joined: Tue 29 Apr, 2014, 13:06
Posts: 8
Location: IsraelIsrael
i dont think that the postions is close this is the function that i write

private void mergeFilledDeals() throws JFException
{
m_orderLabel = m_labelDateFormat.format(new Date());
String firstFilledLabel = "MERGED"+ m_orderLabel;
IOrder FilledOrder = null;
boolean isfound = false;
List<IOrder> FilledOrders = new ArrayList<IOrder>();
for(IOrder o: m_engine.getOrders(c_INSTRUMENT)){

if(o.getState() == IOrder.State.FILLED)
{

//FilledOrder = o;
FilledOrders.add(o);
isfound = true;

}
}


if(isfound == true && FilledOrders.size() > 50)//&& FilledOrder != null)
{
if(m_isMergeSucceful == true)
{
m_mergedOrder = m_engine.mergeOrders(firstFilledLabel, FilledOrders);
myMsg(m_msgLog,"INFO","merge order have been send");
}
}
if(m_mergedOrder != null)
{
for(int i = 0 ; i < 10 ; i++)
{
IMessage message = m_mergedOrder.waitForUpdate(5, TimeUnit.SECONDS);

if(message != null)
{
if(message.getType() == IMessage.Type.ORDERS_MERGE_OK)
{
m_isMergeSucceful = true;
myMsg(m_msgLog,"INFO","merge order have been aproved massege from api " + message);
break;
}
}
else
{
m_isMergeSucceful = false;
}
}

}
}
what am i doing worng ???
it do only one time merge and in the second time it just say merge in progress ..... and never return a merge is ok


 
 Post subject: Re: i have some problem with merge Post rating: 0   New post Posted: Fri 02 May, 2014, 13:38 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Please extract from that a full example strategy which would replicate the behaviour that you are describing. For more on merge and some examples see:
https://www.dukascopy.com/wiki/#Merge_Positions


 

Jump to:  

cron
  © 1998-2025 Dukascopy® Bank SA
On-line Currency forex trading with Swiss Forex Broker - ECN Forex Brokerage,
Managed Forex Accounts, introducing forex brokers, Currency Forex Data Feed and News
Currency Forex Trading Platform provided on-line by Dukascopy.com