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.

Weekend Bars returned by IHistory.getBar() in Strategy Tester
 Post subject: Weekend Bars returned by IHistory.getBar() in Strategy Tester Post rating: 0   New post Posted: Sun 01 Apr, 2012, 18:50 
User avatar

User rating: 0
Joined: Mon 12 Mar, 2012, 18:23
Posts: 9
See the follow example, I use "All Ticks" mode in the strategy tester. IHistory.getBar() returns empty bars( Volume = 0 ) for the weekend. These bars will destory my strategy.
        String PriceMon = "" ;
        for(int i = 1; i<=60; i++)
        {
            PriceMon = PriceMon + "\nClose[" + i + "] = "  + history.getBar(instrument, Period.FIFTEEN_MINS, OfferSide.BID, i).getClose() + ", Open[" + i + "] = " + history.getBar(instrument, Period.FIFTEEN_MINS, OfferSide.BID, i).getOpen();
        }
        chart.comment(PriceMon);


Image


 
 Post subject: Re: JFOREX-3673 Weekend Bars returned by IHistory.getBar() in Strategy Tester Post rating: 0   New post Posted: Mon 02 Apr, 2012, 14:23 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
The weekend bars are flats. The Volume for the flat must be zero.


 
 Post subject: Re: Weekend Bars returned by IHistory.getBar() in Strategy Tester Post rating: 0   New post Posted: Tue 03 Apr, 2012, 06:12 
User avatar

User rating: 0
Joined: Mon 12 Mar, 2012, 18:23
Posts: 9
Hello Support,

Those flat bars are not even visible on the chart. They only appear in the memory when we use jforex api. And they affect indicator values as well. I tried to print the values of indicators in my code and compare them to the ones printed on the chart by jforex platform build-in indicator. The values are different due to the flat bars.


 
 Post subject: Re: Weekend Bars returned by IHistory.getBar() in Strategy Tester Post rating: 0   New post Posted: Tue 03 Apr, 2012, 11:50 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
testttt wrote:
Those flat bars are not even visible on the chart.
Select Tools -> Preferences -> Chart -> Flats Filtration -> Flats Filter is disabled.
testttt wrote:
And they affect indicator values as well
This is why you can select filter when you calculate your indicators, see:
https://www.dukascopy.com/wiki/#Indicator_Calculation/Calculate_indicator_by_candle_interval
testttt wrote:
I tried to print the values of indicators in my code and compare them to the ones printed on the chart by jforex platform build-in indicator. The values are different due to the flat bars.
Consider using OHLC chart object for comparing the on-chart and the strategy values:
https://www.dukascopy.com/wiki/#Add_indicators_on_chart/Include_in_OHLC


 

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