Hi guys i got a problem over here.
When i test my strategy on the historical data some wrong stop loss'es occure. As u see in the file there are stop losses way over 3 although they were set to 3 (as i can see in the console via the print function).
This is my submit order method. (Slippage is set to 0)
private IOrder submitOrder(OrderCommand orderCmd) throws JFException {
double price = 0.0;
double takeProfitPrice = 0.0;
double stopLossPrice = 0.0;
ITick tick = history.getLastTick(instrument);
if(orderCmd == OrderCommand.BUY) {
price = tick.getAsk();
stopLossPrice = price - getPipPrice(stopLossPips);
takeProfitPrice = price + getPipPrice(takeProfitPips);
}
if(orderCmd == OrderCommand.SELL) {
price = tick.getBid();
stopLossPrice = price + getPipPrice(stopLossPips);
takeProfitPrice = price - getPipPrice(takeProfitPips);
}
print("P:" + price);
print("TP:" + takeProfitPrice);
print("SL:" + stopLossPrice);
return engine.submitOrder(getLabel(instrument), instrument, orderCmd, amount, price, slippage, getRoundedPrice(stopLossPrice), getRoundedPrice(takeProfitPrice));
}