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.

readBars samples
 Post subject: readBars samples Post rating: 0   New post Posted: Thu 02 Jul, 2009, 21:31 
User avatar

User rating: 2
Joined: Mon 30 May, 2011, 15:41
Posts: 86
Location: Czech Republic, Prague
I write results to files (in function onMyBar) and compare these files. I call readBars function.

   public void readBars(final int jagaChartId, final int jagaSymbol, final int jagaPeriod, final int offerSide, long fromDate, long toDate, int barsBack) throws JFException
   {
      Instrument instrument = Symbol.values()[jagaSymbol].dukas;
      Period period = genial.Period.values()[jagaPeriod].dukas;
      
      if( toDate == -1 )
         toDate = history.getPreviousBarStart(period, history.getTimeOfLastTick(instrument) );
      if( barsBack > 0 )
         fromDate = history.getTimeForNBarsBack(period,toDate,barsBack);
      else
      if( fromDate == -1 )
         fromDate = history.getTimeForNBarsBack(period,toDate,100000);
      
      history.readBars
      (
         instrument, period, offerSide == 0 ? OfferSide.BID : OfferSide.ASK, fromDate, toDate,
         new LoadingDataListener()
         {
            @Override
            public void newBar(Instrument instrument, Period period,
                  OfferSide offerSide, long date, double open, double close, double low, double high, double volume)
            {
                onMyBar( jagaChartId, offerSide == OfferSide.BID ? 0 : 1, date,open,high,low,close,volume);
            }
            
            @Override
            public void newTick(Instrument instrument, long date, double ask, double bid, double askVol, double bidVol) {
               
            }
         },
         new LoadingProgressListener()
         {
            @Override
            public void dataLoaded(long startTime, long endTime, long currentTime, String information) {
            }

            @Override
            public void loadingFinished(boolean allDataLoaded, long startTime, long endTime, long currentTime) {
               getBarsFinished(jagaChartId,allDataLoaded);
            }

            @Override
            public boolean stopJob() {
               return false;
            }
         }
      );
   }
   );


 

Jump to:  

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