Dukascopy
 
 
Wiki JStore Search Login

NullPointerException when double click on SL or TP line on chart launched from Standalone API
 Post subject: NullPointerException when double click on SL or TP line on chart launched from Standalone API Post rating: 0   New post Posted: Tue 09 Oct, 2012, 13:31 
User avatar

User rating: 7
Joined: Fri 13 Jan, 2012, 20:49
Posts: 94
Location: Poland, Warsaw
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.java

I 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


Attachments:
chart_SL_TP_bug.png [59 KiB]
Downloaded 427 times
DISCLAIMER: Dukascopy Bank SA's waiver of responsability - Documents, data or information available on this webpage may be posted by third parties without Dukascopy Bank SA being obliged to make any control on their content. Anyone accessing this webpage and downloading or otherwise making use of any document, data or information found on this webpage shall do it on his/her own risks without any recourse against Dukascopy Bank SA in relation thereto or for any consequences arising to him/her or any third party from the use and/or reliance on any document, data or information found on this webpage.
 
 Post subject: Re: NullPointerException when double click on SL or TP line on chart launched from Standalone API Post rating: 0   New post Posted: Thu 11 Oct, 2012, 07:34 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
The standalone charts are read only and it must not allow to select / edit / create orders / indicators by using charts. Only through strategy API.
We have extended charts core module to disable selection of chart's objects, including TP/SL lines.


 

Jump to:  

  © 1998-2024 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