Hi,
Quote:
Is it possible that this happens because the label is too long?
no
Quote:
is there a limit to the size of the label?
yes, 64 symbols.
There is such restriction for order labels:
- Label must not be null;
- Label must not be longer than 64 symbols;
- Label must contain restricted symbols;
- Label must not start with number.
Exception is thrown because an order with your given label already exists on the server. To avoid such exceptions, always before place an order, check if there isn't already placed such. Consider this example:
public void onStart(IContext context) throws JFException {
if (context.getEngine().getOrder("MyOrder") == null){
context.getEngine().submitOrder("MyOrder", Instrument.EURUSD, OrderCommand.BUY, 0.5);
}
If you are submitting order in
onTick function, then to get an unique label, you must add some randomize number. Its because in one second could be lot of ticks. Here is link with example
https://www.dukascopy.com/swiss/english/forex/jforex/forum/viewtopic.php?f=7&t=914