Hello,
I'm testing automated strategy for positions merging. After I tried to merge positions I got the following error (full log at the end of the message):
Quote:
09:05:22 java.lang.NullPointerException @ com.dukascopy.api.impl.connect.ct.onMessage(Unknown Source)
The merger code where exeception probably happened looks like that (nothing unusual):
IOrder mergedO = engine.mergeOrders(tmpLabel, o1, o2);
IMessage message = mergedO.waitForUpdate(5, TimeUnit.SECONDS);
I suspect that cause of the error was very long merger execution (14 seconds!!!).
The merger technique is very convenient but I thought that it works immediately. To merge two positions I have to disable all stop-losses, so after I've noticed aforementioned situation it seems the technique is very risky. Is the phenomenon common or rather rare on production site? Should I manage individual positions instead of merging all positions to one? Alternative technique that is changing many stop-losses for each position is inconvenient but works immediately and in this context seems safer...
BTW Could you add mergeOrders method with stop-loss/take-profit as parameters and no need to disable stop-losses/take-profit in advance?
Best regards,
FXer
Full log:
Quote:
09:05:31 Positions: 80582864; 80582835 MERGED to position: 80583397
09:05:22 Strategy "STradeManagePos" is stopped at 2015-04-01 09:05:22.483 GMT on the local computer with parameters "instrument"=[EUR/USD], "reference1"=[ONEWAY], "hoursBack"=[0], "transactionCostInPips"=[1.0], "slippageSafeguardInPips"=[0.6]. Reason: Stopped by Engine
09:05:22 Stopping "STradeManagePos" strategy at 2015-04-01 09:05:22.471 GMT on the local computer
09:05:22 java.lang.NullPointerException @ com.dukascopy.api.impl.connect.ct.onMessage(Unknown Source)
09:05:17 Merge in progress...
09:05:17 Merge request with label jf1i668r11 sent for positions: 80582864, 80582835 at 2015-04-01 09:05:17.427 GMT by the strategy "STradeManagePos": from the local computer
09:05:17 Order CANCELLED: #305926385 Parent Order #305926378 STOP LOSS BUY 0.001 mil. EUR/USD @ MKT IF BID => 1.074 - Position #80582835
09:05:17 Canceling order #305926385 STOP LOSS BUY 1000 EUR/USD @ MKT IF BID => 1.074 at 2015-04-01 09:05:17.075 GMT by the strategy "STradeManagePos": from the local computer
09:05:17 Order FILLED at 1.07255 (#305927111 STOP SELL 0.001 mil. EUR/USD @ MKT IF BID <= 1.07255 EXPIRES: GTC) - Position #80582864
09:03:23 Position 80582864 ENTRY #305927111 price changed from 1.07180 to 1.07255
09:03:23 Order #305927111 ENTRY SELL 1000 EUR/USD @ MKT IF BID <= 1.07255 EXPIRES: GTC had been sent at 2015-04-01 09:03:23 manually
08:58:05 Order ACCEPTED: #305927111 STOP SELL 0.001 mil. EUR/USD @ MKT IF BID <= 1.0718 - Position #80582864
08:58:05 Order ENTRY SELL 1000 EUR/USD @ MKT IF BID <= 1.07180 had been sent at 2015-04-01 08:58:05 manually
08:58:05 Sending order: ENTRY SELL 0.001 mil. EUR/USD @ MKT IF BID <= 1.0718
08:57:01 Order CANCELLED: #305926379 STOP LOSS BUY 0.001 mil. EUR/USD @ MKT IF ASK => 1.074 - Position #80582835
08:57:01 Order ACCEPTED: #305926385 Parent Order #305926379 STOP LOSS BUY 0.001 mil. EUR/USD @ MKT IF BID => 1.074 - Position #80582835
08:57:01 Order FILLED at 1.07347 (#305926378 SELL 0.001 mil. EUR/USD @ MKT) - Position #80582835
08:57:01 Order ACCEPTED: #305926379 STOP LOSS BUY 0.001 mil. EUR/USD @ MKT IF ASK => 1.074 - Position #80582835
08:57:01 Order ACCEPTED: #305926378 SELL 0.001 mil. EUR/USD @ MKT - Position #80582835
08:57:01 Order SELL 1000 EUR/USD @ MKT had been sent at 2015-04-01 08:57:01 manually
08:57:01 Sending order: STOP LOSS BUY 0.001 mil. EUR/USD @ MKT IF ASK => 1.074
08:57:01 Sending order: SELL 0.001 mil. EUR/USD @ MKT MAX SLIPPAGE 0.001