orderscount++;
engine.submitOrder("test"+orderscount, instrument,
IEngine.OrderCommand.SELL, 0.1, 0, 0,
history.getLastTick(instrument).getAsk() + instrument.getPipValue() * 30,
history.getLastTick(instrument).getAsk() + instrument.getPipValue() * 30);
//or
orderscount++;
engine.submitOrder("test"+orderscount, instrument,
IEngine.OrderCommand.BUY, 0.1, 0, 0,
history.getLastTick(instrument).getBid() + instrument.getPipValue() * 30,
history.getLastTick(instrument).getBid() + instrument.getPipValue() * 30);
Method of interest [
javadoc]
IOrder
submitOrder(String label, Instrument instrument, IEngine.OrderCommand orderCommand, double amount, double price, double slippage, double stopLossPrice, double takeProfitPrice)
Parameters of interest:IEngine.OrderCommand orderCommand
double stopLossPrice
double takeProfitPrice
General Issue:Long trades (BUY) close out immediately
Short trades (SELL) close out immediately
Observations:In Long cases that anticipate a price rise, the Stop Loss is placed above the open bid and well into the potential rise zone (Open + SL)
In Short cases that anticipate a price fall, the Take Profit is placed above the open ask and well into the potential rise zone (Open + TP)
Remedies:In Long cases that anticipate a price rise, consider placing the Stop Loss towards the area below the entry price (the fall zone)
(a stop loss order for a Long position set above the open appears to have already been hit, price fell below the stop loss, on entry into the position)In Short cases that anticipate a price fall, consider placing the Take Profit towards the area below the entry price (the fall zone)
(a take profit order for a Short position set above the open appears to have already been hit, price fell to or below the take profit, on entry into the position)