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.

why were they not correct in macd values when using the daily period?
 Post subject: why were they not correct in macd values when using the daily period? Post rating: 0   New post Posted: Wed 28 Aug, 2013, 03:09 
User avatar

User rating: 0
Joined: Wed 28 Mar, 2012, 06:41
Posts: 25
Location: China, Beijing
when I used 1min 10 mins and 1hour ,they were all correct.
but when I want to get daily period Macd values.they were not correct?was it the system bug? want someone to help me..
double macd[][] = indicators.macd(instrument, period, OfferSide.BID, IIndicators.AppliedPrice.CLOSE, 12, 26, 9, Filter.NO_FILTER,3,currBarTime, 0);

INFO
28.08.2013 00:00:06 $$$$ = -0.0001204 i=2 j=2
INFO
28.08.2013 00:00:06 $$$$ = -0.0001380 i=2 j=1
INFO
28.08.2013 00:00:06 $$$$ = -0.0000812 i=2 j=0
INFO
28.08.2013 00:00:06 $$$$ = 0.0038118 i=1 j=2
INFO
28.08.2013 00:00:06 $$$$ = 0.0038418 i=1 j=1
INFO
28.08.2013 00:00:06 $$$$ = 0.0038764 i=1 j=0
INFO
28.08.2013 00:00:06 $$$$ = 0.0036914 i=0 j=2
INFO
28.08.2013 00:00:06 $$$$ = 0.0037038 i=0 j=1
INFO
28.08.2013 00:00:06 $$$$ = 0.0037951 i=0 j=0

instrument:EUR/USD

but the last three day's macd is between 0.0044000-0.0044400


 
 Post subject: Re: why were they not correct in macd values when using the daily period? Post rating: 0   New post Posted: Wed 28 Aug, 2013, 12:21 
User avatar

User rating: 164
Joined: Mon 08 Oct, 2012, 10:35
Posts: 676
Location: NetherlandsNetherlands
Hi,

Do you have an example strategy that replicates the issue? As what has been provided so far is not really enough to see what might cause your problem.

As you say that you try to get MACD for the last 3 days, I guess that maybe you have a problem because you use no filter in the indicator calculation. 3 days ago it was Sunday, so the weekend flats might cause some confusion. Try to modify your indicator code as
double macd[][] = indicators.macd(instrument, period, OfferSide.BID, IIndicators.AppliedPrice.CLOSE, 12, 26, 9, Filter.ALL_FLATS, 3, currBarTime, 0);

, but this is just a wild guess...

Quote:
but the last three day's macd is between 0.0044000-0.0044400


MACD indicator contains 3 values: MACD, MACD Signal, and MACD Hist. Which one of these are you referring to? It is not clear.
So, as stated above, provide more information, an example strategy, what values do you expect to get and what is your exact calculation.


 
 Post subject: Re: why were they not correct in macd values when using the daily period? Post rating: 0   New post Posted: Wed 28 Aug, 2013, 12:31 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Make sure the platform filtration and sunday candle settings match the periods (pay attention that there are three of them DAILY, DAILY_SKIP_SUNDAY and DAILY_SUNDAY_IN_MONDAY) and filters (note that calculation by shift uses Filter.NO_FILTER) that you use form api, see more here:
https://www.dukascopy.com/wiki/#Indicator_usage_checklist


 
 Post subject: Re: why were they not correct in macd values when using the daily period? Post rating: 0   New post Posted: Wed 28 Aug, 2013, 17:10 
User avatar

User rating: 0
Joined: Wed 28 Mar, 2012, 06:41
Posts: 25
Location: China, Beijing
tcsabina wrote:
Hi,

Do you have an example strategy that replicates the issue? As what has been provided so far is not really enough to see what might cause your problem.

As you say that you try to get MACD for the last 3 days, I guess that maybe you have a problem because you use no filter in the indicator calculation. 3 days ago it was Sunday, so the weekend flats might cause some confusion. Try to modify your indicator code as
double macd[][] = indicators.macd(instrument, period, OfferSide.BID, IIndicators.AppliedPrice.CLOSE, 12, 26, 9, Filter.ALL_FLATS, 3, currBarTime, 0);

, but this is just a wild guess...

Quote:
but the last three day's macd is between 0.0044000-0.0044400


THANK YOU.

MACD indicator contains 3 values: MACD, MACD Signal, and MACD Hist. Which one of these are you referring to? It is not clear.
So, as stated above, provide more information, an example strategy, what values do you expect to get and what is your exact calculation.


 
 Post subject: Re: why were they not correct in macd values when using the daily period? Post rating: 0   New post Posted: Wed 28 Aug, 2013, 17:15 
User avatar

User rating: 0
Joined: Wed 28 Mar, 2012, 06:41
Posts: 25
Location: China, Beijing
API Support wrote:
Make sure the platform filtration and sunday candle settings match the periods (pay attention that there are three of them DAILY, DAILY_SKIP_SUNDAY and DAILY_SUNDAY_IN_MONDAY) and filters (note that calculation by shift uses Filter.NO_FILTER) that you use form api, see more here:
https://www.dukascopy.com/wiki/#Indicator_usage_checklist



I try every times in DAILY, DAILY_SKIP_SUNDAY and DAILY_SUNDAY_IN_MONDAY,but why did they get the same values each time?

when I changed Filter from Filter.NO_FILTER to Filter.ALL_FLATS ..got the correct results in daily macds.

what is the difference between them?
thank you


 
 Post subject: Re: why were they not correct in macd values when using the daily period? Post rating: 2   New post Posted: Wed 28 Aug, 2013, 21:19 
User avatar

User rating: 164
Joined: Mon 08 Oct, 2012, 10:35
Posts: 676
Location: NetherlandsNetherlands
Quote:
what is the difference between them?


Check this wiki page, and search for Flats Filtration. It describes the subject pretty detailed.


 

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