Dukascopy
 
 
Wiki JStore Search Login

Attention! Read the forum rules carefully before posting a topic.

    Try to find an answer in Wiki before asking a question.
    Submit programming questions in this forum only.
    Off topics are strictly forbidden.

Any topics which do not satisfy these rules will be deleted.

Your order has been rejected due to validation failure. Invalid order
 Post subject: Your order has been rejected due to validation failure. Invalid order Post rating: 0   New post Posted: Mon 27 Aug, 2012, 07:17 
User avatar

User rating: 4
Joined: Sat 12 May, 2012, 00:28
Posts: 21
Location: New Zealand, Auckland
Hello,

The strategy which has been working on both real and demo accounts for months suddenly stopped working on Demo account. On the real account the same strategy works fine.
Demo account: platform 2.18 / API 2.7 (updated about a week ago and has been working fine up until now)
Real account: platform 2.17.25 / API 2.6.71

The strategy tries to modify Take Profit of an open position by running the following code snippet:
...
try
{
print(0, "Setting TP of order " + o.getId() + ", current TP " + priceFormat.format(oTPPrice) + " to " + priceFormat.format(tp));
o.setTakeProfitPrice(tp);
msg = o.waitForUpdate(WaitForUpdate, TimeUnit.MILLISECONDS);
if (msg == null) {print(1, "TP buy change: WaitForUpdate() timeout!");}
}
catch (JFException e) {console.getErr().println(e.getMessage()); e.printStackTrace(console.getErr()); print(0, "Exception on changing TP buy!!! Error message: " + e.getMessage());}
...

What happens on demo:
The strategy output:
2012-08-27 05:47:08: Setting TP of order 41017792, current TP 1.2828 to 1.2826
2012-08-27 05:47:08: Order id 41017792 change rejected!

(the last message is a result of onMessage() handler - it receives ORDER_CHANGED_REJECTED message and complains about it)

The platform log:
2012-08-27 05:47:08 Your order has been rejected due to validation failure. Invalid order

On the real account there is a corresponding position id 15474290 opened and managed by the same code, and it works fine - no errors upon Take Profit modifications.

The most weird thing is that when I modify demo account position manually from a platform (setting the same Take Profit as the strategy tries to set), it works without a glitch.

Restarting Demo platform didn't help.


Thanks,
Max


 
 Post subject: Re: Demo account issue Post rating: 0   New post Posted: Mon 27 Aug, 2012, 21:34 
User avatar

User rating: 2
Joined: Mon 30 May, 2011, 15:41
Posts: 86
Location: Czech Republic, Prague
I have same problem on demo account when trying modify stoploss of filled order:

Your order has been rejected due to validation failure. Invalid order


 
 Post subject: Re: Demo account issue Post rating: 0   New post Posted: Tue 28 Aug, 2012, 07:23 
User avatar

User rating: 4
Joined: Sat 12 May, 2012, 00:28
Posts: 21
Location: New Zealand, Auckland
Same issue second day in a row.


 
 Post subject: Re: Demo account issue Post rating: 0   New post Posted: Wed 29 Aug, 2012, 08:35 
User avatar

User rating: 4
Joined: Sat 12 May, 2012, 00:28
Posts: 21
Location: New Zealand, Auckland
Third day in a row. Time to do something about it?


 
 Post subject: Re: Demo account issue Post rating: 0   New post Posted: Wed 29 Aug, 2012, 12:41 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Please provide an example strategy which replicates the issue.


 
 Post subject: Setting new stop loss price works in Historical Tester but not in real-time Post rating: 0   New post Posted: Wed 29 Aug, 2012, 17:31 
User avatar

User rating: 0
Joined: Mon 09 Jul, 2012, 14:09
Posts: 17
Location: Ireland,
Dear Support,

The following command:

order.setStopLossPrice(newStop, OfferSide.BID, 0.00);

has started to give this error:

15:25:25 Your order has been rejected due to validation failure. Invalid order

when it is invoked in the real-time demo account. Running the same strategy without any changes at all in the Historical Tester (Demo account) works perfectly when this command is called.

I would be grateful if you could look into this.

Sincerely,

Seamus McKenna


 
 Post subject: Re: Demo account issue Post rating: 0   New post Posted: Thu 30 Aug, 2012, 01:43 
User avatar

User rating: 4
Joined: Sat 12 May, 2012, 00:28
Posts: 21
Location: New Zealand, Auckland
An example strategy is attached. It opens a buy position (if not already opened) then tries to change take profit of this position (roughly every five seconds) and fails.


Attachments:
exStrategy.java [9.68 KiB]
Downloaded 311 times
DISCLAIMER: Dukascopy Bank SA's waiver of responsability - Documents, data or information available on this webpage may be posted by third parties without Dukascopy Bank SA being obliged to make any control on their content. Anyone accessing this webpage and downloading or otherwise making use of any document, data or information found on this webpage shall do it on his/her own risks without any recourse against Dukascopy Bank SA in relation thereto or for any consequences arising to him/her or any third party from the use and/or reliance on any document, data or information found on this webpage.
 
 Post subject: Re: Setting new stop loss price works in Historical Tester but not in real-time Post rating: 0   New post Posted: Thu 30 Aug, 2012, 07:47 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
We could not replicate this with the following strategy:


Attachments:
SLwithSlippage.java [1.19 KiB]
Downloaded 321 times
DISCLAIMER: Dukascopy Bank SA's waiver of responsability - Documents, data or information available on this webpage may be posted by third parties without Dukascopy Bank SA being obliged to make any control on their content. Anyone accessing this webpage and downloading or otherwise making use of any document, data or information found on this webpage shall do it on his/her own risks without any recourse against Dukascopy Bank SA in relation thereto or for any consequences arising to him/her or any third party from the use and/or reliance on any document, data or information found on this webpage.
 
 Post subject: Re: Setting new stop loss price works in Historical Tester but not in real-time Post rating: 0   New post Posted: Thu 30 Aug, 2012, 10:13 
User avatar

User rating: 0
Joined: Mon 09 Jul, 2012, 14:09
Posts: 17
Location: Ireland,
Dear Dukascopy Support,

Many thanks for dealing with this query so quickly.

Does the factor of 10 in the following:

order.setStopLossPrice(ask - instrument.getPipValue() * 10, OfferSide.BID, 0.00);

mean that it is not possible to set any trailing stop step to less than 10 pips? If so, are there any plans to change this requirement?

Sincerely,

Seamus McKenna


 
 Post subject: Re: Setting new stop loss price works in Historical Tester but not in real-time Post rating: 0   New post Posted: Thu 30 Aug, 2012, 11:16 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Smackenn wrote:
Does the factor of 10 in the following:

order.setStopLossPrice(ask - instrument.getPipValue() * 10, OfferSide.BID, 0.00);
No the first argument stands for the stop loss price, please see the documetation:
https://www.dukascopy.com/client/javadoc/com/dukascopy/api/IOrder.html#setStopLossPrice(double,%20com.dukascopy.api.OfferSide,%20double)
The minimum trailing stop amount is a system restriction, for that also see the same javadoc link.


 
 Post subject: Re: Setting new stop loss price works in Historical Tester but not in real-time Post rating: 0   New post Posted: Thu 30 Aug, 2012, 13:59 
User avatar

User rating: 0
Joined: Mon 09 Jul, 2012, 14:09
Posts: 17
Location: Ireland,
Once again I greatly appreciate your help. I have been studying the javadoc. Is it possible for you to give me (an) example(s) of what might cause the "...validation failure. Order not valid" message / SMcK


 
 Post subject: Re: Demo account issue Post rating: 0   New post Posted: Thu 30 Aug, 2012, 14:09 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
This will be fixed with the release of JForex-API 2.7.1.


 
 Post subject: Re: Your order has been rejected due to validation failure. Invalid order Post rating: 0   New post Posted: Thu 30 Aug, 2012, 14:24 
User avatar

User rating: 0
Joined: Mon 09 Jul, 2012, 14:09
Posts: 17
Location: Ireland,
In the meantime, before the release of 2.7.1, would it help at all if I were to use the waitForUpdate command:

order.waitForUpdate(2000, IOrder.State.FILLED);

In other words, what is the essential feature of your code snippet "SLwithSlippage" that means the command to change the stop loss can get through without error?

Rgrds

Seamus


 
 Post subject: Re: Your order has been rejected due to validation failure. Invalid order Post rating: 0   New post Posted: Thu 30 Aug, 2012, 14:32 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
See:
https://www.dukascopy.com/wiki/#Manage_Order_State


 
 Post subject: Re: Your order has been rejected due to validation failure. Invalid order Post rating: 0   New post Posted: Thu 30 Aug, 2012, 15:27 
User avatar

User rating: 0
Joined: Mon 09 Jul, 2012, 14:09
Posts: 17
Location: Ireland,
Thanks again - much appreciated / SMcK


 
 Post subject: Re: Your order has been rejected due to validation failure. Invalid order Post rating: 0   New post Posted: Thu 30 Aug, 2012, 20:36 
User avatar

User rating: 4
Joined: Sat 12 May, 2012, 00:28
Posts: 21
Location: New Zealand, Auckland
So what about my example strategy which tries to set take profit of a position and fails?


 
 Post subject: Re: Your order has been rejected due to validation failure. Invalid order Post rating: 0   New post Posted: Fri 31 Aug, 2012, 08:12 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
mcs wrote:
So what about my example strategy which tries to set take profit of a position and fails?
API Support wrote:
This will be fixed with the release of JForex-API 2.7.1.


 
 Post subject: Re: Your order has been rejected due to validation failure. Invalid order Post rating: 0   New post Posted: Fri 31 Aug, 2012, 12:33 
User avatar

User rating: 0
Joined: Mon 09 Jul, 2012, 14:09
Posts: 17
Location: Ireland,
Dear Support,

I have studied the wiki articles you pointed me to. I have also complied and run your example:

SlTpUpdateWithOrigLines

without any modification whatever and I still get the error "Your order has been rejected due to validation failure. Invalid order" when I run it.

So it would appear that the problem is in the command

order.setStopLossPrice

It looks like it can set the stop loss once after the order has been filled but it cannot change the stop loss after that.

Rgrds

Seamus McK


 
 Post subject: Re: Your order has been rejected due to validation failure. Invalid order Post rating: 0   New post Posted: Fri 31 Aug, 2012, 12:58 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
We reiterate that the issue will be fixed with the release of JForex-API 2.7.1.


 

Jump to:  

  © 1998-2025 Dukascopy® Bank SA
On-line Currency forex trading with Swiss Forex Broker - ECN Forex Brokerage,
Managed Forex Accounts, introducing forex brokers, Currency Forex Data Feed and News
Currency Forex Trading Platform provided on-line by Dukascopy.com