|
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.
getting future calendar events in strategy |
hartjr
|
Post subject: getting future calendar events in strategy |
Post rating: 0
|
Posted: Sun 11 Mar, 2012, 22:24
|
|
User rating: 0
Joined: Mon 27 Feb, 2012, 00:59 Posts: 6
|
Hi, Is there a way to access future calendar events from my strategy? I want to get the time of the next economic calendar event of high impact for say EUR & USD eg the same info as you have on this web page : https://www.dukascopy.com/swiss/english/ ... ccalendar/I then want my automated strategy to act of this information. For example to stop trading five minutes before and ten after such an event. I've looked at the NewsFilter and CalendarFilter classes but they don't seem to allow me to look up the next event, rather just give you a message when the event has occurred. Thanks, James
|
|
|
|
 |
API Support
|
Post subject: Re: getting future calendar events in strategy |
Post rating: 0
|
Posted: Mon 12 Mar, 2012, 10:20
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
Your strategy receives calendar and news messages in two cases: - The message gets created on server, i.e. a news event occurs or a calendar event gets inserted.
- You filter the events either in JForex client or in Standalone. In this case the strategy receives all events that have been filtered.
- For JForex client, download the NewsStrategyNoTrades strategy from https://www.dukascopy.com/wiki/#IClient_functionality/Calendar_filter_example, start it, then open News -> Live Economic calendar, and filter some today's calendar events.
- For Standalone, see: https://www.dukascopy.com/wiki/#IClient_functionality/News_and_Calendar
Note that in the current implementation the strategy does not receive news when back-tested (e.g., when being ran in Historical Tester).
|
|
|
|
 |
hartjr
|
Post subject: Re: getting future calendar events in strategy |
Post rating: 0
|
Posted: Tue 13 Mar, 2012, 20:19
|
|
User rating: 0
Joined: Mon 27 Feb, 2012, 00:59 Posts: 6
|
Thanks for the information. I've had a look but it doesn't look like it allows me to do what I'd like to - namely I want to get the next economic event from the calendar in advance (the onMessage only delivers them when they happen doesn't it?)
Thanks
|
|
|
|
 |
API Support
|
Post subject: Re: getting future calendar events in strategy |
Post rating: 0
|
Posted: Wed 14 Mar, 2012, 09:00
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
hartjr wrote: namely I want to get the next economic event from the calendar in advance See part 2.a - start the example strategy and then launch News -> Live Economic Calendar with filter Today. hartjr wrote: the onMessage only delivers them when they happen doesn't it? This is part 1.
|
|
|
|
 |
hartjr
|
Post subject: Re: getting future calendar events in strategy |
Post rating: 0
|
Posted: Wed 21 Mar, 2012, 20:42
|
|
User rating: 0
Joined: Mon 27 Feb, 2012, 00:59 Posts: 6
|
Thanks for the quick reply. Sorry if I'm being slow but I still don't think this does what I want. I've tried what you suggest and I can see the future events via the jforex client (filtered for today) but I want my automated strategy to access this information. Eg in pseudo code I want to:
List todaysEvents; // get future events for today
for (Event : todaysEvents) { // loop through today's events
//check time of event
if (timeOfEventStart == (currentTime + 5 mins){ // if the event is going to happen soon ie 5 mins in future doSomething...; } }
This is roughly what I want to do hopefully it is clear. Sorry if I misunderstood the previous answer.
Thanks,
James
|
|
|
|
 |
API Support
|
Post subject: Re: getting future calendar events in strategy |
Post rating: 0
|
Posted: Thu 22 Mar, 2012, 14:32
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
Did you try the example strategy that we did refer to?
|
|
|
|
 |
hartjr
|
Post subject: Re: getting future calendar events in strategy |
Post rating: 0
|
Posted: Mon 02 Apr, 2012, 18:58
|
|
User rating: 0
Joined: Mon 27 Feb, 2012, 00:59 Posts: 6
|
yes I tried it. I manually filtered the events via the gui. That works and my strategy receives them. But the strategy only receives them when they happen (I can see ones which are coming up via the screen BUT I want my strategy to be able to 'pull' them in in advance - the onMessage works by 'push'ing them in to the strategy when the event occurs).
Is there a way round this?
|
|
|
|
 |
API Support
|
Post subject: Re: getting future calendar events in strategy |
Post rating: 0
|
Posted: Tue 03 Apr, 2012, 11:57
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
hartjr wrote: But the strategy only receives them when they happen (I can see ones which are coming up via the screen BUT I want my strategy to be able to 'pull' them in in advance - the onMessage works by 'push'ing them in to the strategy when the event occurs). The strategy also receives them when you filter the events in client manually or in standalone by a program.
|
|
|
|
 |
tcsabina
|
Post subject: Re: getting future calendar events in strategy |
Post rating: 0
|
Posted: Thu 10 Jan, 2013, 12:49
|
|
User rating: 164
Joined: Mon 08 Oct, 2012, 10:35 Posts: 676 Location: NetherlandsNetherlands
|
Dear Support,
Would that be a possible request to create a simple strategy that implements what the original poster was after? Let`s say a strategy that checks the Economic Calender for High priority news for EUR and USD currencies, and if there is one, it sets a global variable to false 5 minutes prior the time of the event, and sets it to true 10 minutes afterwards.
I myself probably would be able to implement this, using the mentioned examples, but it would take me days to get there.
|
|
|
|
 |
API Support
|
Post subject: Re: getting future calendar events in strategy |
Post rating: 0
|
Posted: Thu 10 Jan, 2013, 13:00
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
tcsabina wrote: I myself probably would be able to implement this, using the mentioned examples, but it would take me days to get there. Use the examples as starting point and adjust them to fit your business logic. If you encounter any difficulties please post your example strategy and specify which part you don't know how to implement.
|
|
|
|
 |
tcsabina
|
Post subject: Re: getting future calendar events in strategy |
Post rating: 0
|
Posted: Tue 29 Jan, 2013, 11:29
|
|
User rating: 164
Joined: Mon 08 Oct, 2012, 10:35 Posts: 676 Location: NetherlandsNetherlands
|
Dear Support, Is the news listening `feature` available for demo accounts? It is stated that it isn`t working for Historical Backtest, but how about demo accounts? I am asking, because as a test, I started the NewsStrategyNoTrades.java ( https://www.dukascopy.com/wiki/#JForex_S ... d_Calendar) yesterday around 22:00 on my demo account but it haven`t `received` or `processed` any news or calendar messages since then. Regarding to the Economic Calendar, there were a couple of events: 23:00 AU AUD CB Leading Indicator Tuesday, January 29, 2013 00:30 AU AUD National Australia Bank's Business Confidence 00:30 AU AUD National Australia Bank's Business Conditions 05:30 IN INR Cash Reserve Ratio 05:30 IN INR RBI Interest Rate Decision (Repo Rate) 05:30 IN INR Reserve Repo Rate 07:00 DE EUR Gfk Consumer Confidence Survey 07:45 FR EUR Consumer Confidence 08:00 HU EUR Unemployment Rate 08:00 TR TRY Consumer Confidence 08:00 ES EUR Retail Sales 09:00 IS ISK Consumer Price Index 09:00 IS ISK Consumer Price Index Or do I miss a point here about news listening? I don`t do any filtering at the moment. Based one of your previous replies, when a news/calender ever triggers on the server, it should arrive to the strategy as well. I don`t want to filter with the client`s News -> Live Economic Calendar -> Apply, as I want the strategy to work automatically: when a news available, it should `appear` in the strategy and the strategy itself will deal with it. How can I achieve that?
|
|
|
|
 |
API Support
|
Post subject: Re: getting future calendar events in strategy |
Post rating: 0
|
Posted: Tue 29 Jan, 2013, 14:00
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
You receive calendar events not when they are scheduled to happen, but rather when they get inserted into the database. The news you should receive "as they happen".
|
|
|
|
 |
tcsabina
|
Post subject: Re: getting future calendar events in strategy |
Post rating: 0
|
Posted: Tue 29 Jan, 2013, 16:20
|
|
User rating: 164
Joined: Mon 08 Oct, 2012, 10:35 Posts: 676 Location: NetherlandsNetherlands
|
If this is the case, how can I re-enter them in the strategy that is running in the client? Is the database that is involved available for query from a strategy? I know that by pressing the Apply on the Live Calender the running strategy will process the events. But can I automate this for a strategy that is running in the JForex client?
Also, I am think about the best aproach to create a strategy that is processing calendar events from time to time (every 15min?, every hour?, every day?), and if a certain event(-type) occurs, it disables trading?
This is what I came up with, but I would appreciate your comments on it: Every time when the calendar events processed by the strategy, we create a list from the events that matches our criteria. Every minute the strategy going through the previously created list, and if an event about to happen, it disables trading for a certain period of time. (Which function (onBar(), onTick()?) would be the place for such calculations? There is no guarantee that a tick arrives for a minute, so I would say onBar().)
For this to work, I have to know how to make the calendar events arrive to the strategy again and again (which I asked in the first part of the comment). I also very much would like to use the Impact parameter of a calender event, which is not yet available, but I hope that it will be soon.
|
|
|
|
 |
API Support
|
Post subject: Re: getting future calendar events in strategy |
Post rating: 0
|
Posted: Wed 30 Jan, 2013, 08:49
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
tcsabina wrote: Which function (onBar(), onTick()?) would be the place for such calculations? There is no guarantee that a tick arrives for a minute, so I would say onBar(). For non-feed related operations you don't have to restrict yourself to using onBar or onTick, as well you can use java.util.concurrent.ScheduledExecutorService for this, see a usage example: https://www.dukascopy.com/wiki/#Threading/Scheduled_asynchronous_executiontcsabina wrote: For this to work, I have to know how to make the calendar events arrive to the strategy again and again (which I asked in the first part of the comment). See the point 2 in our first post.
|
|
|
|
 |
tcsabina
|
Post subject: Re: getting future calendar events in strategy |
Post rating: 0
|
Posted: Wed 30 Jan, 2013, 10:27
|
|
User rating: 164
Joined: Mon 08 Oct, 2012, 10:35 Posts: 676 Location: NetherlandsNetherlands
|
Thanks for the reply. Quote: See the point 2 in our first post.
Let`s see: As I am running the strategy in the platform, I suppose 2.a is relevant for me. 2.a says Open News -> Live Economic calendar, and filter some today's calendar events. But the problem with this is that I don`t want to manually filter these events to arrive to the strategy. Maybe I was not clear with my question, so let me repeat myself (and I think this was the original poster`s question too): I would like to know, how to do this filtering automatically, without any user interaction, in a strategy that is running in the platform? I hope I made myself clear now. Thanks in advance.
|
|
|
|
 |
API Support
|
Post subject: Re: getting future calendar events in strategy |
Post rating: 0
|
Posted: Wed 30 Jan, 2013, 10:34
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
tcsabina wrote: I would like to know, how to do this filtering automatically, without any user interaction, in a strategy that is running in the platform? This is not possible.
|
|
|
|
 |
olga
|
Post subject: Re: getting future calendar events in strategy |
Post rating: 0
|
Posted: Fri 21 Feb, 2014, 03:35
|
|
User rating: 0
Joined: Fri 21 Feb, 2014, 03:27 Posts: 1 Location: Belgium, Liege
|
Exactly the same question (I think) as tcsabina but in eclipse with the jforex SDK, is there a way to subscribe to calendar events with a given filter and look through them with some sort of array containing them all. there are a bunch of methods for news and calendar in the javadoc so I got hope there's a way...
The earlier answers seem outdated as the links don't point to anything relevant.
|
|
|
|
 |
API Support
|
Post subject: Re: getting future calendar events in strategy |
Post rating: 0
|
Posted: Mon 24 Feb, 2014, 09:36
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
We have updated the links
|
|
|
|
 |
|
Pages: [
1
]
|
|
|
|
|