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: Fri 05 Oct, 2012, 08:41 
User avatar

User rating: 7
Joined: Fri 13 Jan, 2012, 20:49
Posts: 94
Location: Poland, Warsaw
Hello dear Support,

This bug regards Standalone API not Desktop platform.

I noticed that 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)



best regards,
Kurak


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

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Please provide the example program which you launch.


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

User rating: 7
Joined: Fri 13 Jan, 2012, 20:49
Posts: 94
Location: Poland, Warsaw
Hi,

I use program from Wiki page: https://www.dukascopy.com/wiki/files/MainOpenChart.java

I just modified following lines in IStrategy.onStart 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 (engine.getOrders(instrument).size()==0) {                               
            engine.submitOrder(
                    "Order#" + counter++,
                    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 in initial post.

best regards,
Kurak


Attachments:
chart_SL_TP_bug.png [59 KiB]
Downloaded 407 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.
 

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