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.

thread queue overload during market close
 Post subject: thread queue overload during market close Post rating: 0   New post Posted: Sun 06 Feb, 2011, 20:20 

User rating: 0
Joined: Tue 15 Sep, 2009, 00:44
Posts: 20
When I started my strategy during the weekend I receive the error "thread queue overloaded with tasks". The platform is not receiving ticks however the onBar method continues to run (in this case every 5 minutes).

Maybe I don't understand how the JForex API works. But I was assuming the onBar method would only execute after the close of a bar. Evidently this is not true.

API describes onBar Method .... "Called on every bar for every basic period and instrument that application is subscribed on"
I am subscribed to EURUSD and am filtering all periods except M5, M15, M30 and H1. I am using several indicators in these time frames.

Why is the onBar method being called when the market is closed?
What is the best way to avoid this problem. A code example would help. (is this code acceptable? -> if askBar != null ...)
-----------------------------
18:42:59 Stopping "jTest" strategy at 2011-02-06 18:42:59.900 GMT on the local computer
18:42:56 Strategy thread queue overloaded with tasks. Ticks in queue - 0, bars - 503, other tasks - 0
18:42:51 Strategy thread queue overloaded with tasks. Ticks in queue - 0, bars - 503, other tasks - 0
18:42:46 Strategy thread queue overloaded with tasks. Ticks in queue - 0, bars - 502, other tasks - 0
18:42:41 Strategy thread queue overloaded with tasks. Ticks in queue - 0, bars - 502, other tasks - 0
18:42:36 Strategy thread queue overloaded with tasks. Ticks in queue - 0, bars - 501, other tasks - 0
18:42:31 Strategy thread queue overloaded with tasks. Ticks in queue - 0, bars - 501, other tasks - 0
15:33:55 jTest 2.26: onStart() EUR/USD Account Login: DEMO2.26
15:33:55 Strategy "jTest" is started at 2011-02-06 15:33:55.365 GMT on the local computer with parameters
15:33:55 Starting "jTest" strategy at 2011-02-06 15:33:55.365 GMT on the local computer


 
 Post subject: Re: thread queue overload during market close Post rating: 0   New post Posted: Mon 07 Feb, 2011, 10:28 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Hi,
The onBar method method returns flat candles in a weekend.


 
 Post subject: Re: thread queue overload during market close Post rating: 0   New post Posted: Mon 07 Feb, 2011, 16:28 

User rating: 0
Joined: Tue 15 Sep, 2009, 00:44
Posts: 20
What exactly is a flat candle? Is it the last returned price continuously repeated or is it a null price?

What is the best way to avoid this problem? A code example would help.


 
 Post subject: Re: thread queue overload during market close Post rating: 0   New post Posted: Tue 08 Feb, 2011, 11:16 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
SquareRoot wrote:
What exactly is a flat candle? Is it the last returned price continuously repeated or is it a null price?

What is the best way to avoid this problem? A code example would help.


If a candle close and the candle open price equals and the candle open price equals with a previous candle close price, then this is a flat candle. You can call an indicator with a Filter parameter or you can skip holidays in your strategy. Please consider the following code:
      
   private boolean isTradableDay(long tickTime){
      Calendar calendar = Calendar.getInstance();
      calendar.setTimeInMillis(tickTime);
      
      int weekday = calendar.get(Calendar.DAY_OF_WEEK);
      if (weekday == Calendar.SATURDAY) {
         return false;
      } else if (weekday == Calendar.SUNDAY) {
         return false;
      }
      return true;
   }


 

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