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.

weekly pivot points?
 Post subject: weekly pivot points? Post rating: 0   New post Posted: Tue 08 Apr, 2014, 07:36 

User rating: 0
Joined: Tue 08 Apr, 2014, 07:22
Posts: 1
Location: Singapore,
Hi, :)

could anyone explain to me how the weekly and daily pivot point indicators are calculated in jforex? What is open price and close price defined in jforex? And how can I get the last week weekly pivots by the code:

PivotPoints=indicators.pivot(Instrument,Period, OfferSide,TimePeriod,shift);


Thank you very much.


 
 Post subject: Re: weekly pivot points? Post rating: 0   New post Posted: Tue 08 Apr, 2014, 15:55 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
You could do something like this (see full source in attachments):
public class PivotShiftVsCandleIntervalNew implements IStrategy {
    private IConsole console;
    private IIndicators indicators;
    private IHistory history;

    @Configurable("")
    public Instrument instrument = Instrument.EURUSD;
    @Configurable("")
    public Period period = Period.FOUR_HOURS;
    @Configurable("")
    public Set<Period> timePeriods = new LinkedHashSet<Period>(Arrays.asList(new Period[]{Period.DAILY, Period.WEEKLY, Period.MONTHLY}));
    @Configurable("")
    public OfferSide side = OfferSide.BID;
    @Configurable("")
    public int barCount = 3;
   
    private String[] pivotLevelNames;
   
    public void onStart(IContext context) throws JFException {
        this.console = context.getConsole();
        this.indicators = context.getIndicators();
        this.history = context.getHistory();
       
        fetchOutputNames();
       
        IBar currBar = history.getBar(instrument, period, side, 0);
       
        for(Period timePeriod : timePeriods){
            double[][] pivot = indicators.pivot(instrument, period, side, timePeriod, Filter.NO_FILTER, barCount, currBar.getTime(), 0);

            print("\n============\n"+timePeriod.name() + "\n============\n");
            print(String.format("%s",  pivotToStr(pivot)));
           
            for(int shift = 0; shift< barCount ;shift++){
                double [] pivotDaily = indicators.pivot(instrument, period, side, timePeriod, shift);               
                print("shift="+shift);
                print("pivotDaily " +pivotToStr(pivotDaily));       
            }
        }       
    }

//...

If you wish to plot the indicator on chart, see:
https://www.dukascopy.com/wiki/#Add_indicators_on_chart/Include_in_OHLC


Attachments:
PivotShiftVsCandleIntervalNew.java [3.77 KiB]
Downloaded 83 times
DISCLAIMER: Dukascopy Bank SA's waiver of responsability - Documents, data or information available on this webpage may be posted by third parties without Dukascopy Bank SA being obliged to make any control on their content. Anyone accessing this webpage and downloading or otherwise making use of any document, data or information found on this webpage shall do it on his/her own risks without any recourse against Dukascopy Bank SA in relation thereto or for any consequences arising to him/her or any third party from the use and/or reliance on any document, data or information found on this webpage.
 

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