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.

Order 'Good until' time
 Post subject: Order 'Good until' time Post rating: 0   New post Posted: Fri 30 Oct, 2009, 08:53 

User rating: 0
Joined: Wed 21 Oct, 2009, 04:47
Posts: 22
Hi there,

I've looked at the API help and tried to search through the forums, however I can't see how an order 'good until' time is specified.

I have tried specifying both a minute elapsed interval & a datetime like so:

Calendar goodUntil = Calendar.getInstance();
c.setTimeInMillis(tick.getTime());
c.add(Calendar.SECOND, 60);

I am trying to use the tick time as opposed to the current time so it works when I'm back-testing.

Could someone please point out how this should be done?

Thanks.


 
 Post subject: Re: Order 'Good until' time Post rating: 0   New post Posted: Fri 30 Oct, 2009, 09:34 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Hi,
here it is ;)
https://www.dukascopy.com/swiss/docs/api/com/dukascopy/api/IOrder.html#setGoodTillTime(long)

consider this example
Calendar goodTillTime = Calendar.getInstance();
goodTillTime.setTimeInMillis(Calendar.getInstance().getTimeInMillis()+5000); //set time to 5 seconds after now
myOrder.setGoodTillTime(goodTillTime.getTimeInMillis());


 
 Post subject: Re: Order 'Good until' time Post rating: 0   New post Posted: Fri 30 Oct, 2009, 23:55 

User rating: 0
Joined: Wed 21 Oct, 2009, 04:47
Posts: 22
Thanks again for your prompt response and great support!

Would be great to have these examples within the javadoc. I do have all the javadoc accessible within Eclipse, however all it stated was that it was a 'long'. One document I found here:

https://www.dukascopy.com/swiss/docs/Duk ... egyAPI.pdf

suggested that the time was the number of minutes before expiry (I realise that the manual is not intended for the Java API, however it is still quite helpful to have a primer on using the API).

I have tried using your example but I assume it will only work when trading live because the back-tester seems to ignore it. This seems to work for me when back-testing (and presumably also should work when trading live):

Calendar goodUntil = Calendar.getInstance();
goodUntil.setTimeInMillis(tick.getTime()+5000);


 
 Post subject: Re: Order 'Good until' time Post rating: 0   New post Posted: Mon 02 Nov, 2009, 08:40 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
yes you are correct.


 

Jump to:  

cron
  © 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