Dukascopy Support Board http://www.dukascopy.com/swiss/english/forex/jforex/forum/ |
|
BARS FILTER 4 WEEKEND http://www.dukascopy.com/swiss/english/forex/jforex/forum/viewtopic.php?f=81&t=49623 |
Page 1 of 1 |
Author: | vurbileron [ Tue 16 Jul, 2013, 14:42 ] | ||
Post subject: | BARS FILTER 4 WEEKEND | ||
Hi guys, i have a little problem. When I do my back-test, on ONE_HOUR time-frame, the historical tester take also the flats bars of the week-end. I know there are filters but i don't know how to use them. Now I'm using the getBar method with shift. This is the situation: LONG ENTRY: if the close of the last bar is the lowest of the last 5 bars, BUY. but when the market open (22:00 gmt:0 on sunday) sometime I have a wrong entry signal, because the platform read all the flats candle during the weekend. I hope my explanation is clear. Thank you. Umb.
|
Author: | tcsabina [ Wed 17 Jul, 2013, 11:54 ] |
Post subject: | Re: BARS FILTER 4 WEEKEND |
What is your method the get the last 5 bars? Could you modify that part and check if the bar was a flat one? (Like if bar.getOpen() == bar.getClose().) Filters (as far as I know) are used for indicator calculation, or can be used for chart drawings (not to draw flat candles). If you use/calculate bar data on your own, without indicators, you have to implement your own 'flat filter', just as I mentioned above. |
Author: | vurbileron [ Wed 17 Jul, 2013, 15:12 ] |
Post subject: | Re: BARS FILTER 4 WEEKEND |
tcsabina wrote: What is your method the get the last 5 bars? Could you modify that part and check if the bar was a flat one? (Like if bar.getOpen() == bar.getClose().) Filters (as far as I know) are used for indicator calculation, or can be used for chart drawings (not to draw flat candles). If you use/calculate bar data on your own, without indicators, you have to implement your own 'flat filter', just as I mentioned above. If I use your filter (bar.getOpen() == bar.getClose()) it can take something like a doji, especially in low TF. I was using this method: IBar PreviuosOne = history.getBar(this.cross, this.period, OfferSide.BID, 1); Now I'm watching for a solution here: https://www.dukascopy.com/wiki/#History_bars |
Author: | tcsabina [ Wed 17 Jul, 2013, 22:27 ] | ||
Post subject: | Re: BARS FILTER 4 WEEKEND | ||
I did my homework ![]() See attached strategy that returns the last 5 non-flat candle for every bar. package jforex; Sample output from Historical Tester: 2011.01.07 is Friday, so flat period starts at 21:30. And ends at 2011.01.09_22:00. 21:29:22 Current bar time: 2011.01.10_01:00:00. Previous 5 non-flat bars are:
|
Author: | vurbileron [ Fri 19 Jul, 2013, 02:04 ] | ||
Post subject: | Re: BARS FILTER 4 WEEKEND | ||
I founded this way to avoid weekend bars (exemple for the last 5 bars, buy): long prevBarTime = history.getPreviousBarStart(period, history.getLastTick(cross).getTime()); I think it is more simple and fast ![]() I dont't know why, but "getPreviousBarStart" give the start of the 0 bar. So I modified the code in my own way.
|
Page 1 of 1 |