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.

BUG in the WEEKLY PIVOT indicator
 Post subject: BUG in the WEEKLY PIVOT indicator Post rating: 0   New post Posted: Thu 16 Jun, 2011, 14:42 

User rating: -
I selected the weekly pivot indicator on the EURUSD hourly chart and observed that it showed wrong values!

As of today 16.06.2011 the Weekly Pivot indicator shows a value of P 1.4434 but it should be 1.4456 instead! I checked with three other brokers to make sure and the link below showing the weekly pivots for EURUSD.

https://www.actionforex.com/markets/pivo ... 040848154/

I made some calculations and realized that the High, Low and Close values of the weekly candle containing the hourly candles from 6.06.2011 to 10.06.2011 are not correct! I took the hourly chart from the 6.06.2011 to 10.06.2011 week period and drew the lines for the HH and LL values for the whole period, then I switched to weekly candles and observed that those lines do not match with the High and Low values of that very weekly candle.

Could you check what is wrong with that? Why when the weekly candle shows different High and Low values??? Hence the weekly pivot point values are wrong.....

Thanks!

regards
Christian


 
 Post subject: Re: BUG in the WEEKLY PIVOT indicator Post rating: 0   New post Posted: Fri 17 Jun, 2011, 08:41 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Unfortunately we weren't able to reproduce the issue, please check pivot values again and tell us if the problem persists.


 
 Post subject: Re: BUG in the WEEKLY PIVOT indicator Post rating: 0   New post Posted: Fri 24 Jun, 2011, 16:16 
User avatar

User rating: 1
Joined: Fri 24 Jun, 2011, 16:05
Posts: 21
Location: Austria, Innsbruck
I had the same question/problem.
The possible solution:
Find out what price is used for calculating the pivots.
The close price from friday should not be the problem.
But what open price is used?
- open from sunday evening?
- open from monday ?
- which timezone is used ?
- in jForex it is possible to merge the sunday-data to the monday-data.

There are also some differences in the closing prices between the different brokers, espacilly on the daily and the weekly closing price.


 
 Post subject: Re: BUG in the WEEKLY PIVOT indicator Post rating: 0   New post Posted: Mon 27 Jun, 2011, 13:12 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
KAMU60 wrote:
But what open price is used?
- open from sunday evening?
- open from monday ?
Sunday evening, according to WEEKENDS filter.
Quote:
- which timezone is used ?
GMT
Quote:
- in jForex it is possible to merge the sunday-data to the monday-data.
That is the current setting.
You can find the implementation of Pivot indicator in JForex API - in com.dukascopy.indicators.PivotIndicator.


 
 Post subject: Re: BUG in the WEEKLY PIVOT indicator Post rating: 0   New post Posted: Mon 27 Jun, 2011, 15:14 

User rating: -
Support wrote:
Unfortunately we weren't able to reproduce the issue, please check pivot values again and tell us if the problem persists.


The same thing observed on this Monday again! Today on Monday 27.06.2011 the JForex Weekly Pivot indicator on EURUSD shows P: 1.42279

For other three brokers the Weekly Pivot point is at 1.4253 instead! which is the correct value in this case....

I guess the Jforex weekly pivot indicator is not correct due to the weekend candles issue. Why do you introduce the weekend candles in all JForex indicators by default?? In my opinion it should come only at request, thus having filtered already the weekend candles by default in all jforex functions.....I find it very bothering that I have to use the complicated weekend candle filtering JForex methods all over the places.....

Thanks!


 
 Post subject: Re: BUG in the WEEKLY PIVOT indicator Post rating: 0   New post Posted: Tue 28 Jun, 2011, 14:07 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Guest wrote:
I guess the Jforex weekly pivot indicator is not correct due to the weekend candles issue. Why do you introduce the weekend candles in all JForex indicators by default??
Those filters don't affect the pivot values in this case, since in either case they are flat over the particular period. There are two factors why the prices do differ:
    1) Majorly because Pivot points of your source take 21:00 as the day close time, whilst JForex takes 00:00. So effectively both show the same tendencies, but with a shift of 3 hours.
    2) Difference in market scope contributes to minor fluctuations (usually around 1 to 2 pips) since the JForex price is bound to its Interbank market Marketplace scope.
Consider a simple strategy which shows why and how the pivot point values differ:
package jforex.strategies;

import java.text.DecimalFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.TimeZone;

import com.dukascopy.api.*;

public class PivotCalculationTest implements IStrategy {
   
   private Instrument instrument = Instrument.EURUSD;
   
    private IConsole console;
    private IHistory history;
   
    @SuppressWarnings("serial")
   private final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss") {{setTimeZone(TimeZone.getTimeZone("GMT"));}};

    public void onStart(IContext context) throws JFException {
        this.console = context.getConsole();
        this.history = context.getHistory();
        print("start: " + this.getClass().getSimpleName());
               
        getMarketHoursPivot("DAILY (day begins 21:00)","2011-06-26 21:00:00", "2011-06-27 21:00:00");
        getMarketHoursPivot("WEEKLY (day begins 21:00)","2011-06-19 21:00:00", "2011-06-26 21:00:00");
        getMarketHoursPivot("DAILY (day begins 00:00)","2011-06-27 00:00:00", "2011-06-28 00:00:00");
        getMarketHoursPivot("WEEKLY (day begins 00:00)","2011-06-20 00:00:00", "2011-06-27 00:00:00");
    }
   
    private void getMarketHoursPivot(String comment, String marketOpenStr, String marketCloseStr) throws JFException{

        try {
         Date marketOpen = sdf.parse(marketOpenStr);
         Date marketClose = sdf.parse(marketCloseStr);
         List<ITick> ticks = history.getTicks(instrument, marketOpen.getTime(), marketClose.getTime());
         double high = 0.0;
         double low = 2.0;
         double open = ticks.get(0).getBid();
         double close = ticks.get(ticks.size() - 1).getBid();
         for(ITick t: ticks){
            if(t.getBid() > high)
               high = t.getBid();
            if(t.getAsk() < low)
               low = t.getBid();
         }
         double pivot = (high + low + close) / 3;
         print(comment + " Market hours " + sdf.format(marketOpen) + " - " + sdf.format(marketClose) + " pivot="
               + (new DecimalFormat("0.0000")).format( pivot) + " high=" + high + " low=" + low + " open=" + open + " close=" + close);
         
      } catch (ParseException e) {
         printErr(e);
      }
    }

    public void onAccount(IAccount account) throws JFException {
    }

    public void onMessage(IMessage message) throws JFException { 
       
    }
    public void onStop() throws JFException {    }
    public void onTick(Instrument instrument, ITick tick) throws JFException {    }
    public void onBar(Instrument instrument, Period period, IBar askBar, IBar bidBar) throws JFException {    }
   
    private void print(Object o){
       console.getOut().println(o);
    }
   
    private void printErr(Object o){
       console.getErr().println(o);
    }
}


 

Jump to:  

cron
  © 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