|
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.
How use DAILY_SKIP_SUNDAY? |
[Antuan]
|
Post subject: How use DAILY_SKIP_SUNDAY? |
Post rating: 0
|
Posted: Thu 11 Nov, 2010, 21:36
|
|
User rating: 0
Joined: Wed 03 Nov, 2010, 12:02 Posts: 2
|
Hello,
I'm using Daily bars, and I want to skip the sunday candle when I use history.getBar(...). Maybe using Period = Period.DAILY_SKIP_SUNDAY, but I don't know how to do it....because what i've tried doesn't work.
Thanks Antuan
|
|
|
|
 |
tspeicher
|
Post subject: Re: How use DAILY_SKIP_SUNDAY? |
Post rating: 0
|
Posted: Thu 11 Nov, 2010, 22:23
|
|
User rating: 0
Joined: Wed 18 May, 2011, 11:25 Posts: 60 Location: DE
|
|
|
|
 |
[alfie]
|
Post subject: Re: How use DAILY_SKIP_SUNDAY? |
Post rating: 0
|
Posted: Sat 08 Jan, 2011, 11:51
|
|
User rating: 0
Joined: Sun 02 Jan, 2011, 00:54 Posts: 2
|
any one from support able to answer here?
The filter removes flats. So will not help for Sunday Bars
DAILY_SKIP_SUNDAY does not seem to work.
Rgds Allan
|
|
|
|
 |
[Hyperdimension]
|
Post subject: Re: How use DAILY_SKIP_SUNDAY? |
Post rating: 0
|
Posted: Wed 02 Mar, 2011, 15:46
|
|
User rating: 1
Joined: Sun 05 Dec, 2010, 08:44 Posts: 21
|
When I compare indicator outputs and history.getBar outputs using the periods DAILY, DAILY_SKIP_SUNDAY and DAILY_SUNDAY_IN_MONDAY I get exactly the same results. To test whether there are different output values, here is my onBar method: public void onBar(Instrument instrument, Period period, IBar askBar, IBar bidBar) throws JFException { //called on bar completion and before first onTick call if (period == Period.FOUR_HOURS) {
double atrDaily = indicators.atr(instrument, Period.DAILY, OfferSide.BID, 5, 0); double atrDailySkipSunday = indicators.atr(instrument, Period.DAILY_SKIP_SUNDAY, OfferSide.BID, 5, 0); double atrDailySundayInMonday = indicators.atr(instrument, Period.DAILY_SUNDAY_IN_MONDAY, OfferSide.BID, 5, 0);
if (!(atrDaily == atrDailySkipSunday && atrDailySkipSunday == atrDailySundayInMonday)) console.getOut().println("ATR values not equal");
long previousBarTimeDaily = history.getBar(instrument, Period.DAILY, OfferSide.BID, 1).getTime(); long previousBarTimeDailySkipSunday = history.getBar(instrument, Period.DAILY_SKIP_SUNDAY, OfferSide.BID, 1).getTime(); long previousBarTimeDailySundayInMonday = history.getBar(instrument, Period.DAILY_SUNDAY_IN_MONDAY, OfferSide.BID, 1).getTime();
if (!(previousBarTimeDaily == previousBarTimeDailySkipSunday && previousBarTimeDailySkipSunday == previousBarTimeDailySundayInMonday)) console.getOut().println("Bar times not equal"); } } When I run this there is nothing printed to the console because the outputs of the atr method calls are the same using all three different periods. Similarly with the calls to getBar. Also, period.toString() always returns "Daily" regardless of whether period = DAILY, DAILY_SKIP_SUNDAY or DAILY_SUNDAY_IN_MONDAY. So it seems that DAILY_SKIP_SUNDAY and DAILY_SUNDAY_IN_MONDAY are simply exactly the same as the DAILY period. Please fix this problem. Thank you.
|
|
|
|
 |
[Hyperdimension]
|
Post subject: Re: How use DAILY_SKIP_SUNDAY? |
Post rating: 0
|
Posted: Wed 02 Mar, 2011, 19:16
|
|
User rating: 1
Joined: Sun 05 Dec, 2010, 08:44 Posts: 21
|
After further experimentation I have found that DAILY_SKIP_SUNDAY and DAILY_SUNDAY_IN_MONDAY works only in conjunction with Filter.ALL_FLATS or Filter.WEEKENDS and not Filter.NO_FILTER. Was this by design?
I think your documentation should be updated to state this fact.
Or maybe you could make some changes such that skipping Sundays or merging Sunday into Monday is handled entirely by the Filter. At the moment in Filter you have: ALL_FLATS NO_FILTER WEEKENDS
WEEKENDS is misnamed because it only filters out Saturdays. Maybe you should rename it to SATURDAYS, and add new values called SUNDAYS and SUNDAY_IN_MONDAY. I think this would make more sense than using Period to handle skipping Sundays.
|
|
|
|
 |
RoadRunner
|
Post subject: Re: How use DAILY_SKIP_SUNDAY? |
Post rating: 0
|
Posted: Wed 02 Mar, 2011, 22:00
|
|
User rating: 3
Joined: Wed 18 May, 2011, 16:25 Posts: 331 Location: SwitzerlandSwitzerland
|
Hi Hyperdimension, Quote: Or maybe you could make some changes such that skipping Sundays or merging Sunday into Monday is handled entirely by the Filter. ... WEEKENDS is misnamed because it only filters out Saturdays. Maybe you should rename it to SATURDAYS ... Please have in mind that filters are applied to any period, not just the DAILY.
|
|
|
|
 |
API Support
|
Post subject: Re: How use DAILY_SKIP_SUNDAY? |
Post rating: 0
|
Posted: Thu 03 Mar, 2011, 11:42
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
Hi, Hyperdimension wrote: When I run this there is nothing printed to the console because the outputs of the atr method calls are the same using all three different periods. Similarly with the calls to getBar.
So it seems that DAILY_SKIP_SUNDAY and DAILY_SUNDAY_IN_MONDAY are simply exactly the same as the DAILY period.
Please run your code in the Historical tester for the last month and you will see differences.
|
|
|
|
 |
[Hyperdimension]
|
Post subject: Re: How use DAILY_SKIP_SUNDAY? |
Post rating: 0
|
Posted: Fri 04 Mar, 2011, 18:41
|
|
User rating: 1
Joined: Sun 05 Dec, 2010, 08:44 Posts: 21
|
Support wrote: Please run your code in the Historical tester for the last month and you will see differences. I'm using the JForex API 2.6.33 in Eclipse. I've downloaded new data up to the end of February 2011, and results using the periods DAILY_SKIP_SUNDAY and DAILY_SUNDAY_IN_MONDAY are still exactly the same as the DAILY period (without using a Filter). I then changed the DAILY period to FIFTEEN_MINS in the atr indicator and I got the expected output "ATR values not equal". I then changed the DAILY period to MONTHLY in getBar, and I got the expected output "Bar times not equal". Then I changed them back to DAILY and I get no output, which means the values from the three different daily period values are the same. As I said above, it works only when I use a filter (NO_FLATS or WEEKENDS), but that means we cannot use the simple version of indicator methods (the version without Filter) if we want to use DAILY_SKIP_SUNDAY and DAILY_SUNDAY_IN_MONDAY; we would have to always use the version that returns an array. Is there a bug, or is it by design? Can you also answer why the toString() for each of the three different enumerated values all return "Daily", and not "Daily", "Daily Skip Sunday", and "Daily Sunday in Monday"?
|
|
|
|
 |
API Support
|
Post subject: Re: How use DAILY_SKIP_SUNDAY? |
Post rating: 0
|
Posted: Mon 07 Mar, 2011, 15:20
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
|
|
|
 |
|
Pages: [
1
]
|
|
|
|
|