Dukascopy Support Board http://www.dukascopy.com/swiss/english/forex/jforex/forum/ |
|
engine.getOrder(String label) not working properly http://www.dukascopy.com/swiss/english/forex/jforex/forum/viewtopic.php?f=16&t=52198 |
Page 1 of 1 |
Author: | Jotas [ Thu 29 Jan, 2015, 10:02 ] |
Post subject: | engine.getOrder(String label) not working properly |
Hi, I recently experimented a issue when deploying strategies in Dukascopy using my custom Java platform. I have several strategys that use technical analysis to Open and Close Positions. Each strategy can only open a position at a time, i give it an unique Label, so i can get the orders for that strategy using. For trying i put this code onStart of the strategy. (The variables are all defined) ITick lastTick = history.getLastTick(myInstrument); It opens a position with that label, I can see in JForex, and if i try the method engine.getOrder(this.labelStrategy) it returns the order. Now I stop the strategy and my Java Platform. I change the onStart method of the strategy and put this code //ITick lastTick = history.getLastTick(myInstrument); I launch the platforma and reconnect again to Dukascopy. I just try to get the position i opened befored which is still opened, but i dont get any order and it returns me null. I think this method was working fine several weeks ago. Thanx in advance |
Author: | tcsabina [ Fri 30 Jan, 2015, 12:56 ] |
Post subject: | Re: engine.getOrder(String label) not working properly |
Hi, If you iterate through your orders, do you also get back NULL? for (IOrder order : engine.getOrders()) { If the above code finds the order that was filled in previously, then there is something wrong with your "labelStrategy" object (not being initialized properly at the 2nd run, or something like that). If engine.getoRders() also returns null, then it is probably a bug (as you also indicated). |
Author: | Jotas [ Fri 30 Jan, 2015, 13:55 ] |
Post subject: | Re: engine.getOrder(String label) not working properly |
Hi tcsabina First, thanx for anwsering Yes, the other instruction works fine and gets all opened orders. The problem is i have a portfolio of more than 100 robots trading in different instruments which only open 1 position at a time. Each robot has a label, which is unique for it and is pre-assigned. So in each bar i check if i have the order open, and also check some technical indicators to open (if the order is not opened) or close (if the order is opened), but always there must be 1 position of the same robot at a time The problem is in performance. Because on each 1 hour Bar i have all the robots working. So each robot has to loop for all positions and check if he has a position opened or not. I waste several seconds processing these instructions for all robots and i have the risk of big slipagges between the close price of the bar and the moment when i open position. Thats why this method is perfect for my purposes, because it returns me the order i need for each robot. |
Author: | tcsabina [ Mon 02 Feb, 2015, 13:16 ] |
Post subject: | Re: engine.getOrder(String label) not working properly |
Hi, Could you post your strategy (or at least a simplified one) that replicates the case? Is the unique label (or some parts of it) not being changed between strategy execution? Is the label for a particular strategy is always looks the same? If you execute engine.getOrder(label) right away you have submitted the strategy gives back the correct order? So the problem only exists if you restart the strategy? These are just question to help to locate the problem... |
Author: | API Support [ Wed 04 Feb, 2015, 08:37 ] |
Post subject: | Re: engine.getOrder(String label) not working properly |
Hi Jotas! We could not replicate this issue, please provide the strategy or (if you use SDK) application+strategy pair that replicates the issue. |
Page 1 of 1 |