Dukascopy
 
 
Wiki JStore Search Login

HistoryBars GetBarsExample demo code returns no history
 Post subject: HistoryBars GetBarsExample demo code returns no history Post rating: 0   New post Posted: Wed 09 Aug, 2017, 18:46 

User rating: 0
Joined: Mon 29 May, 2017, 17:19
Posts: 21
Location: Germany,
I wanted to try out GetBarsExample.java from https://www.dukascopy.com/wiki/en/devel ... story-bars . all I did was use a fresh Main.java, add my login details, and changed client.startStrategy(new MA_Play()); to client.startStrategy(new ReadBarsExample());.
After running Main.java, it logs in successfully, starts the demo strategy, but then returns "Exited readBars method, bars read - 0". I assume it should return bars from yesterdays 24 hours. I did not change anything else.

Why is there no no data? I'm using jforex api 2.13.37.

Any help really appreciated.

EDIT: I've tried jforex api 2.13.39, the problem was not resolved


 
 Post subject: Re: HistoryBars GetBarsExample demo code returns no history Post rating: 0   New post Posted: Thu 10 Aug, 2017, 09:50 

User rating: 0
Joined: Mon 29 May, 2017, 17:19
Posts: 21
Location: Germany,
I found my error. I looked only at the printout of "Exited readBars method, bars read - " + numberOfBarsLoaded);.
But this is asynchronous loading and when this code is executed, the other thread retrieving the data has not yet finished.But then context.stop(); ends the strategy. Seems to me that its a matter of luck if the loadingFinished actually gets triggered before the strategy stops. In that case it looks like it loaded nothing, while all that happened was that the strategy stopped too soon, before the data could be loaded.

Maybe set a timer in the demo code so it is more easily understandable what it is doing (when looking at the printouts)? Or simply get rid of context.stop().


 

Jump to:  

  © 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