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.

compare hours and minutes fundamental new
 Post subject: compare hours and minutes fundamental new Post rating: 0   New post Posted: Tue 27 Aug, 2013, 14:19 
User avatar

User rating: 1
Joined: Sun 18 Dec, 2011, 04:05
Posts: 36
Location: Spain, Madrid
Hi,

i would like to check the hour and time of economic news, for example, if there is a economic news at 13:00 but in Jforex relase at 13:10, i want to detect that, economic news is on time or not.

Can you help?, pls.

Best Regards


 
 Post subject: Re: compare hours and minutes fundamental new Post rating: 0   New post Posted: Tue 27 Aug, 2013, 14:30 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
See:
https://www.dukascopy.com/wiki/files/NewsStrategyNoTrades.java
from:
https://www.dukascopy.com/wiki/#JForex_SDK/News_and_Calendar


 
 Post subject: Re: compare hours and minutes fundamental new Post rating: 0   New post Posted: Tue 27 Aug, 2013, 15:09 
User avatar

User rating: 1
Joined: Sun 18 Dec, 2011, 04:05
Posts: 36
Location: Spain, Madrid
Thanks...

But i don't know how to compare dates and time. sorry, my programmer level is medium/low :oops: . can you help me? :mrgreen:

the target is to get the date, hour and minute of the economic news and compare to local jforex time....if it is at the same day, hour and minute it's OK!!

Best regards


 
 Post subject: Re: compare hours and minutes fundamental new Post rating: 0   New post Posted: Tue 27 Aug, 2013, 15:16 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
You compare the dates just like numbers, as they are given in milliseconds and represented by the long primitive data type. If you encounter any problems please post your example strategy and pin point what you don't know how to implement.


 
 Post subject: Re: compare hours and minutes fundamental new Post rating: 0   New post Posted: Tue 27 Aug, 2013, 15:22 
User avatar

User rating: 1
Joined: Sun 18 Dec, 2011, 04:05
Posts: 36
Location: Spain, Madrid
}
} else {
calendarNews = (ICalendarMessage) message;
List<ICalendarMessage.Detail> calendarNewsDetails = calendarNews.getDetails();

----> here. COMPARE IF THE ECONOMIC NEWS IS DELAY OR NOT

for (Detail newsDetail : calendarNewsDetails) {

......


 
 Post subject: Re: compare hours and minutes fundamental new Post rating: 1   New post Posted: Tue 27 Aug, 2013, 15:36 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
jaime_1008 wrote:
the target is to get the date, hour and minute of the economic news and compare to local jforex time
You need to compare ICalendarMessage.getEventDate() with System.currentTimeMillis()
jaime_1008 wrote:
if it is at the same day, hour and minute it's OK!!
It is easier to check if there is, for example no more than 60 seconds between the two dates, i.e.:
boolean spanLessThanMinute = Math.abs(calendarNews.getEventDate() - System.currentTimeMillis()) < TimeUnit.SECONDS.toMillis(60);


 
 Post subject: Re: compare hours and minutes fundamental new Post rating: 0   New post Posted: Tue 27 Aug, 2013, 15:55 
User avatar

User rating: 1
Joined: Sun 18 Dec, 2011, 04:05
Posts: 36
Location: Spain, Madrid
THANK YOU VERY MUCH...

i will test it and tell something here....

Last thing and very different, why sometimes i see in the forum code like (please find attached)

Best regards


Attachments:
Screen Shot 2013-08-27 at 15.57.06.png [42.92 KiB]
Downloaded 386 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: compare hours and minutes fundamental new Post rating: 0   New post Posted: Tue 27 Aug, 2013, 16:06 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
jaime_1008 wrote:
Last thing and very different, why sometimes i see in the forum code like (please find attached)
remove the hilit argument from the url and reload the page to make it disappear.


 
 Post subject: Re: compare hours and minutes fundamental new Post rating: 1   New post Posted: Tue 27 Aug, 2013, 20:10 
User avatar

User rating: 164
Joined: Mon 08 Oct, 2012, 10:35
Posts: 676
Location: NetherlandsNetherlands
I think what jaime_1008 asked is how is it possible that in a forum post a code snippet is formatted, just like on the picture that was attached.
If this is indeed the question, you can use the code tags to make your comment formatted.
Start with [code*] and finish with [/code*], like this:

public int test(void) {
    return 0;
}


You should remove the * from the tags. I just placed it there so you can see the actual tag.
I attached a screenshot that was taken while the post was open, so you can see what I am talking about.
Image

If this is not what you have asked, I am sorry to explain something boring :D.


Attachments:
File comment: Screenshot to show the post tags.
Capture.PNG [31.41 KiB]
Downloaded 537 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: compare hours and minutes fundamental new Post rating: 0   New post Posted: Tue 27 Aug, 2013, 21:16 
User avatar

User rating: 1
Joined: Sun 18 Dec, 2011, 04:05
Posts: 36
Location: Spain, Madrid
Also thanks!!!
:)

tcsabina wrote:
I think what jaime_1008 asked is how is it possible that in a forum post a code snippet is formatted, just like on the picture that was attached.
If this is indeed the question, you can use the code tags to make your comment formatted.
Start with [code*] and finish with [/code*], like this:

public int test(void) {
    return 0;
}


You should remove the * from the tags. I just placed it there so you can see the actual tag.
I attached a screenshot that was taken while the post was open, so you can see what I am talking about.
Image

If this is not what you have asked, I am sorry to explain something boring :D.


 
 Post subject: Re: compare hours and minutes fundamental new Post rating: 0   New post Posted: Wed 28 Aug, 2013, 13:10 
User avatar

User rating: 1
Joined: Sun 18 Dec, 2011, 04:05
Posts: 36
Location: Spain, Madrid
WORKS NICE the comparation of time.

Thanks


 

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