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);
double sl = lastTick.getAsk() - myInstrument.getPipValue() * stopLossPips;
double tp = lastTick.getAsk() + myInstrument.getPipValue() * takeProfitPips;
IOrder order = engine.submitOrder(this.labelStrategy, myInstrument, orderCommand, 0.001, 0, slippageAmount, sl, tp);
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);
//double sl = lastTick.getAsk() - myInstrument.getPipValue() * stopLossPips;
//double tp = lastTick.getAsk() + myInstrument.getPipValue() * takeProfitPips;
//IOrder order = engine.submitOrder(this.labelStrategy, myInstrument, orderCommand, 0.001, 0, slippageAmount, sl, tp);
IOrder order = engine.getOrder(this.labelStrategy);
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