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.

Setting Trading Times
 Post subject: Setting Trading Times Post rating: 0   New post Posted: Sat 26 Feb, 2011, 06:24 

User rating: 0
Joined: Sat 26 Feb, 2011, 06:09
Posts: 1
I am very new to programming and would like to set my strategy to trade between the hours of 11 GMT to 20:30 GMT and 22 GMT to 5 GMT the next day.

I tried setting my time zone to GMT using:

Calendar time = Calendar.getInstance();
time.setTimeZone(TimeZone.getTimeZone("GMT");


then used the following to try and get todays starting value in millis:

startTime = calendar.getTimeInMillis(calendar.DAY_OF_YEAR);


however i am getting a compiler error:

[Syntax error on token "setTimeZone", Identifier expected after this token
Syntax error on tokens, AnnotationName expected instead
Syntax error, insert "Type VariableDeclaratorId" to complete FormalParameterList
The method getTimeInMillis() in the type Calendar is not applicable for the arguments (int)

i was hoping to subtract the value of the time in millis of the current day at time 0:00 from the bidBar.getTime() value. however i have been unable to find a way to do that. any help is greatly appreciated


 
 Post subject: Re: Setting Trading Times Post rating: 0   New post Posted: Tue 01 Mar, 2011, 03:16 

User rating: 1
Joined: Fri 26 Mar, 2010, 19:19
Posts: 116
Location: Canada
I generally prefer to use IHistory.getLastTick().getTime() to get a timestamp. It ensures accuracy of the time and works during backtesting too. Then you can convert the long to java.util.Calendar to get the hour easily.


 
 Post subject: Re: Setting Trading Times Post rating: 0   New post Posted: Wed 02 Mar, 2011, 10:16 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Hi,
Please consider the following JForex Wiki page: https://www.dukascopy.com/wiki/index.php ... martingale


 

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