Hello dear Support,
Please DO NOT move this to Desktop Platform section. This bug regards STANDALONE API.
Bug description:
NullPointerException is thrown on double click on Stop Loss or Take Profit line on chart launched from Standalone API.
It would be perfect if methods stopLossClicked(IOrder o) and takeProfitClicked(IOrder o) where triggered on such actions instead of exception.
The exception:
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at com.dukascopy.charts.orders.OrdersManagerImpl.updateSelectedGroupIds(OrdersManagerImpl.java:445)
at com.dukascopy.charts.orders.OrdersManagerImpl.mouseClicked(OrdersManagerImpl.java:202)
at com.dukascopy.charts.mouseandkeyadaptors.MainChartPanelMouseAndKeyAdapter.mouseClicked(MainChartPanelMouseAndKeyAdapter.java:53)
at java.awt.Component.processMouseEvent(Component.java:6291)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)
at java.awt.Component.processEvent(Component.java:6053)
at java.awt.Container.processEvent(Container.java:2041)
at java.awt.Component.dispatchEventImpl(Component.java:4651)
at java.awt.Container.dispatchEventImpl(Container.java:2099)
at java.awt.Component.dispatchEvent(Component.java:4481)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4577)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4247)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
at java.awt.Container.dispatchEventImpl(Container.java:2085)
at java.awt.Window.dispatchEventImpl(Window.java:2478)
at java.awt.Component.dispatchEvent(Component.java:4481)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:643)
at java.awt.EventQueue.access$000(EventQueue.java:84)
at java.awt.EventQueue$1.run(EventQueue.java:602)
at java.awt.EventQueue$1.run(EventQueue.java:600)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:98)
at java.awt.EventQueue$2.run(EventQueue.java:616)
at java.awt.EventQueue$2.run(EventQueue.java:614)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:613)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
I use program from Wiki page:
https://www.dukascopy.com/wiki/files/MainOpenChart.javaI just modified following lines in IStrategy.onTick method to ensure there are open orders on the chart with SL and TP limits.
IChart chart = context.getChart(instrument);
if (chart != null) {
System.out.println(chart.getFeedDescriptor() + " " + tick);
if (context.getEngine().getOrders(instrument).size()==0) {
context.getEngine().submitOrder(
instrument.name(),
instrument,
IEngine.OrderCommand.BUY,
0.001,
0,
-1.0,
tick.getBid()-10*instrument.getPipValue(),
tick.getAsk()+10*instrument.getPipValue());
}
}
I attach a screenshot of chart before double click on SL line and after.
After SL line is clicked, SL disappears and exception is thrown like above.
best regards,
Kurak