Dukascopy
 
 
Wiki JStore Search Login

Attention! Read the forum rules carefully before posting a topic.

    Submit JForex API bug reports in this forum only.
    Submit Converter issues in Converter Issues.
    Off topics are strictly forbidden.

Any topics which do not satisfy these rules will be deleted.

New chart from strategy - bad 4 hour bars (chart shift time)
 Post subject: New chart from strategy - bad 4 hour bars (chart shift time) Post rating: 0   New post Posted: Mon 22 Feb, 2016, 16:17 

User rating: 1
Joined: Mon 27 Feb, 2012, 22:49
Posts: 119
Location: Czech Republic,
Hello support,

I set in platform platform and chart shift time (UTC + 2). If I open new chart from strategy hourly and daily bars are OK.

But four hour bars are bad. They starts at 2, 6, 10 .. hours, but they should start at 0, 4, 8 hours.

I tried to open hour chart and change (from strategy) to 4 hour, but change doesn’t works. I must change it manually.

Please help. Thank you.

IChart Chart = null;
//
IFeedDescriptor FdDsc = new TicksFeedDescriptor( Instr );
//
FdDsc.setDataType( DataType.TIME_PERIOD_AGGREGATION );
if ( ChartPeriod.equals( Period.FOUR_HOURS ) ) {
FdDsc.setPeriod( Period.ONE_HOUR );
}
else {
FdDsc.setPeriod( ChartPeriod );
}
FdDsc.setOfferSide( OfferSide.BID );
//
try {
Chart = Context.openChart( FdDsc );
}
catch ( Exception Exc ) {
Exc.printStackTrace( Err );
OInfo = "===";
OInfo += MethodName + ": ";
OInfo += "Exception: " + Exc.getMessage() + "; ";
SES.fiout( OInfo );
}
//
if ( Chart != null ) {
Chart.getFeedDescriptor().setPeriod( ChartPeriod );
Chart.setDataPresentationType( DataPresentationType.CANDLE );
}
//


 
 Post subject: Re: New chart from strategy - bad 4 hour bars (chart shift time) Post rating: 0   New post Posted: Thu 10 Mar, 2016, 09:51 

User rating: 1
Joined: Mon 27 Feb, 2012, 22:49
Posts: 119
Location: Czech Republic,
Hello support,

this problém is still bothering. Day bars have this problém too.

Thank you.


 
 Post subject: Re: New chart from strategy - bad 4 hour bars (chart shift time) Post rating: 0   New post Posted: Wed 06 Apr, 2016, 13:10 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
When chart is created from a strategy, timezone is determined by the timezone of Period parameter.
If strategy needs to open chart with timezone other than UTC, custom period object must be created.
To set custom timezone please use this code:
Period period = Period.createCustomPeriod(Unit.Hour, 4, JFTimeZone.EET);
        IFeedDescriptor feedDescriptor = new TimePeriodAggregationFeedDescriptor(Instrument.EURUSD, period, OfferSide.ASK);       
        context.openChart(feedDescriptor);


 

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