Dukascopy
 
 
Wiki JStore Search Login

JFOREX-2640 Problems with OsMA and TWENTY_MINS timeframe
 Post subject: JFOREX-2640 Problems with OsMA and TWENTY_MINS timeframe Post rating: 0   New post Posted: Tue 30 Nov, 2010, 10:19 

User rating: 0
Joined: Thu 27 Aug, 2009, 12:09
Posts: 23
I'm not sure if this is a bug or if I'm doing something wrong (it has been known!).

In my onBar routine I'm filtering all periods except FIVE_MINS. Then I'm getting data from certain indicators in different time frames which almost seems to work.

This works for 10 minutes:

iTime = (bidBar.getTime() / 600000) * 600000;
dOsMA = indicators.osma(currentInstrument, Period.TEN_MINS, OfferSide.BID, 12, 26, 9, IIndicators.AppliedPrice.TYPICAL_PRICE, Filter.WEEKENDS, 1, iTime, 0)[0];

But this throws up an exception (number of bars to load = 0 or time is not correct time for the period specified):

iTime = (bidBar.getTime() / 1200000) * 1200000;
dOsMA = indicators.osma(currentInstrument, Period.TWENTY_MINS, OfferSide.BID, 12, 26, 9, IIndicators.AppliedPrice.TYPICAL_PRICE, Filter.WEEKENDS, 1, iTime, 0)[0];

Have I got it all wrong with the time?

Incidently, as it appears you can't put any time in, why does the parameter have to be done by time and not a simple shift?

Thanks for any help :)


 
 Post subject: Re: Problem setting time on indicator call? Post rating: 0   New post Posted: Tue 30 Nov, 2010, 10:49 

User rating: 0
Joined: Thu 27 Aug, 2009, 12:09
Posts: 23
Hmm, I tried some other periods (30m, 1h, 4h) and the problem seems to be only 20 minutes.

Is this a bug or are you not allowed to do this on 20 mins for some reason?

The other problem I'm having is the actual values don't seem to match what's on the chart?

I've got the chart filter set to filter weekend flats as in my call. The Sunday filter is off. Price is the same type. Both are bid. I'm writing out the values to a log file with the time and none of them seem that close to the actual chart values? All are out by a few pips. eg. charts says 0.00032 but I get 0.00013.

For example on a onBar period of ONE_HOUR I tried this:

dMA = indicators.osma(currentInstrument, Period.ONE_HOUR, OfferSide.BID, 12, 26, 9, IIndicators.AppliedPrice.CLOSE, Filter.WEEKENDS, 2, bidBar.getTime(), 0)[0];

Shouldn't this give me the value of the previous bar? Or is it this?

dMA = indicators.osma(currentInstrument, Period.ONE_HOUR, OfferSide.BID, 12, 26, 9, IIndicators.AppliedPrice.CLOSE, Filter.WEEKENDS, 2, bidBar.getTime(), 0)[1];

I'm not too sure which way the array goes - lowest number is most recent bar? Anyhow, I've tried both and neither give the same results as the chart. Some of the differences are as much as 5 or 6 pips which worries me.

I also tried changing the time amd get similar results:

dMA = indicators.osma(currentInstrument, Period.ONE_HOUR, OfferSide.BID, 12, 26, 9, IIndicators.AppliedPrice.CLOSE, Filter.WEEKENDS, 1, bidBar.getTime()-3600000, 0)[0];

By the way this is on a demo account using the strategy tester if that makes any difference? I hope not!

Any ideas?...


 
 Post subject: Re: Problems using indicators Post rating: 0   New post Posted: Wed 01 Dec, 2010, 03:17 

User rating: 0
Joined: Thu 27 Aug, 2009, 12:09
Posts: 23
Well I made some progress. It would appear that OsMA is definately returning different values to the chart.

I tried macd with the same parameters that does give the same results as the chart (within a few tenths of a pip). eg. this is for the previous completed bar:

dMA = indicators.macd(currentInstrument, Period.ONE_HOUR, OfferSide.BID, IIndicators.AppliedPrice.CLOSE, 12, 26, 9, Filter.WEEKENDS, 2, bidBar.getTime(), 0)[2][0];

The macd result on the chart is also the same as the OsMA result on the chart as you'd expect. It's just the called osma which is different??? In some places it's out by so much it crosses over the zero line at up to 5 bars adrift which on a one hour timeframe is a lot!

I tried different parameters on macdExt to see if it's using a different MA or something but no combination seems similar?

Anyhow, I guess I'll stick with macd.


 
 Post subject: Re: Problems with OsMA and TWENTY_MINS timeframe Post rating: 0   New post Posted: Wed 01 Dec, 2010, 14:32 

User rating: 0
Joined: Thu 27 Aug, 2009, 12:09
Posts: 23
Any official comment on this?

Should I mention this in the bug topics?

Thanks


 
 Post subject: Re: Problems with OsMA and TWENTY_MINS timeframe Post rating: 0   New post Posted: Sat 04 Dec, 2010, 21:13 
User avatar

User rating: 3
Joined: Wed 18 May, 2011, 16:25
Posts: 331
Location: SwitzerlandSwitzerland
Hi,

Quote:
Hmm, I tried some other periods (30m, 1h, 4h) and the problem seems to be only 20 minutes.


FYI: Non basic (custom) periods (in this case 20 minutes) are not yet supported in the API for indicators and IHistory.getBars!

also see: https://www.dukascopy.com/swiss/english/forex/jforex/forum/viewtopic.php?f=17&t=23825&p=29062&hilit=custom+periods#p29062

Let's hope Dukascopy will add or fix this in the near future...

We are very much waiting for the custom period support.

Best, RR.

@Dukascopy: In your reply to my above referenced posting in September you wrote, this will be fixed ASAP. Any feedback/hint on how long it might still take until we can see the custom periods working for indicators/getbars would be very much appreciated. Thanks a lot!


 
 Post subject: Re: Problems with OsMA and TWENTY_MINS timeframe Post rating: 0   New post Posted: Fri 17 Dec, 2010, 11:10 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Hi,
Sorry for not answering for a long time. When you use filter in an API indicator method and compare result with a chart, please be sure that period and filters matches in the API and in the JForex platform. Custom periods are not supported yet.


 

Jump to:  

  © 1998-2024 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