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.

Get indicator data, which length is equal to ticks size.
 Post subject: Get indicator data, which length is equal to ticks size. Post rating: 0   New post Posted: Sat 26 Dec, 2015, 13:31 
User avatar

User rating: 0
Joined: Sun 08 Mar, 2015, 23:36
Posts: 7
Location: Russian FederationRussian Federation
Hello, how to correct get array from indicator?
        DateTime begin = new DateTime(time).minusWeeks(2).withDayOfWeek(DateTimeConstants.MONDAY).withTimeAtStartOfDay();
        DateTime end = new DateTime(time);
       
        List<ITick> ticks = history.getTicks(instrument, begin.getMillis(), end.getMillis());
        double[] zz = indicators.zigzag(instrument, Period.TICK, OfferSide.BID, 2, 2, 0, begin.getMillis(), end.getMillis());
       
        System.out.println("TICKS SIZE: "+ticks.size()+", zz.len: "+zz.length);

Output expected
TICKS SIZE: 689150, zz.len: 689150
but
TICKS SIZE: 689150, zz.len: 788400

I asking this question, because I need to handle zigzag WITH ticks, eg.:
        for(int i=0; i<ticks.size(); i++)
            if(ticks.get(i).getBid() == zz[i])
                console.getOut().println("Peak found, i="+i);



I drew the ticks(blue line) and indicator(red line):
for(int i=0; i<ticks.size(); i++) {
            c.add(new SimpleDateFormat("SSS ss mm HH dd MM yyyy").format(ticks.get(i).getTime()), zz[i], ticks.get(i).getBid());


So, graph looks like Image


 
 Post subject: Re: Get indicator data, which length is equal to ticks size. Post rating: 0   New post Posted: Sun 27 Dec, 2015, 22:18 
User avatar

User rating: 0
Joined: Sun 08 Mar, 2015, 23:36
Posts: 7
Location: Russian FederationRussian Federation
Help me plz((9


 
 Post subject: Re: Get indicator data, which length is equal to ticks size. Post rating: 0   New post Posted: Mon 28 Dec, 2015, 15:18 
User avatar

User rating: 0
Joined: Sun 08 Mar, 2015, 23:36
Posts: 7
Location: Russian FederationRussian Federation
Ok then, i created ma indicator with period 1 and offer side=bid and compared to ticks
Image
Code is attached too:
        ticks = history.getTicks(instrument, begin.getMillis(), end.getMillis());
        double[] zz = indicators.ma(instrument,Period.TICK, OfferSide.ASK, IIndicators.AppliedPrice.CLOSE, 1, MaType.SMA, begin.getMillis(), end.getMillis());
        System.out.println("TICKS SIZE: "+ticks.size()+", zz.len: "+zz.length);

        /**
         * CREATING CHART.
         */
        Chart c = new Chart("NN out visualizer");
        c.pack();
        RefineryUtilities.centerFrameOnScreen(c);
        c.setVisible(true);

        /**
         * DRAWING INDICATOR.
         */
        for(int i=0; i<ticks.size(); i++) {
            c.add(new SimpleDateFormat("SSS ss mm HH dd MM yyyy").format(ticks.get(i).getTime()), zz[i], ticks.get(i).getBid());
            //add to graph: datetime, indicator[i] and bid[i]
        }

So, how to get indicator correctly??????? Mmmmmmmmmm??????????????????????????


 

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