|
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.
how to avoid strategy thread queue overloaded? |
beardao
|
Post subject: how to avoid strategy thread queue overloaded? |
Post rating: 0
|
Posted: Tue 28 Feb, 2017, 09:11
|
|
User rating: 0
Joined: Thu 22 Dec, 2016, 02:12 Posts: 10
|
Dear API support, my strategy need monitoring last tick's price for opened order. when using history.getLastTick(instrument), then "strategy thread queue overloaded with tasks, ticks in queue" appear. (actually I already make thread sleep for 60 seconds to execute history.getLastTick, but still got warning) so far it will not affect strategy execution, but I don't know it will impact for long-term auto-trading or not? I searched this forum, but I can't find good solution for this. if possible, could you show me some codes to fix this warning message? appreciate! thanks!
|
|
|
|
 |
API Support
|
Post subject: Re: how to avoid strategy thread queue overloaded? |
Post rating: 0
|
Posted: Wed 01 Mar, 2017, 09:07
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
This happens when running onTick() takes too long. One way to fix this is to move the logic to onBar() method. Usually, history and indicator calls take more time.
|
|
|
|
 |
beardao
|
Post subject: Re: how to avoid strategy thread queue overloaded? |
Post rating: 0
|
Posted: Thu 02 Mar, 2017, 12:20
|
|
User rating: 0
Joined: Thu 22 Dec, 2016, 02:12 Posts: 10
|
thanks! but one thing I can't understand is: even the strategy only has one task remaining which is just thread sleep for tens of minutes (for example, if my order is not submitted successfully, I let strategy thread sleep maybe 20 minutes to wait for next calculation period ), this warning message still happens. (the message appear almost 5 minutes later after thread begins sleeping). why?
|
|
|
|
 |
API Support
|
Post subject: Re: how to avoid strategy thread queue overloaded? |
Post rating: 0
|
Posted: Thu 02 Mar, 2017, 16:57
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
This happens because the first onTick execution has not finished while platform has received new ticks. The strategy will only receive the most recent tick and older ticks will get discarded. The message is shown because the ticks are discarded. Solution: Tasks that need to be executed after certain delay can be called using java Executors https://www.dukascopy.com/wiki/en/devel ... -executionNote that task is executed by calling context.executeTask. This is done because IEngine and some other platform interfaces can be called only from strategy thread that is managed by platform.
|
|
|
|
 |
jaime_1008
|
Post subject: Re: how to avoid strategy thread queue overloaded? |
Post rating: 0
|
Posted: Fri 24 Mar, 2017, 20:05
|
|
User rating: 1
Joined: Sun 18 Dec, 2011, 04:05 Posts: 36 Location: Spain, Madrid
|
Hello,
Have the same problem. In fact, 2 weeks was running in remote with no problem, then. Start to appear this message.
My iTick() is empty, all logic is in the iBar(). I made some modifications and still same problem.
Any advise how to find or where is the overload?
Maybe because I have 20 pairs?
Best regards
|
|
|
|
 |
JasonW
|
Post subject: Re: how to avoid strategy thread queue overloaded? |
Post rating: 0
|
Posted: Mon 27 Mar, 2017, 19:17
|
|
User rating: 0
Joined: Mon 27 Mar, 2017, 18:38 Posts: 4
|
I have been encountering the same issue, since upgrading to JForex 3.1.7.
Before that I was able to run locally, 16 instruments. I can still use the historical tester with no issues, but I get the thread queue overloaded errors when I try to run the strategy on my demo account.
The only changes I've made to my code since using the last version of JForex 3 was to reduce some debug messages in my events.
|
|
|
|
 |
JasonW
|
Post subject: Re: how to avoid strategy thread queue overloaded? |
Post rating: 0
|
Posted: Tue 04 Apr, 2017, 21:54
|
|
User rating: 0
Joined: Mon 27 Mar, 2017, 18:38 Posts: 4
|
RESOLVED:
During my onStart() event handler, I initialize email notifications. I did some debugging and found that the send email call was hanging because the timeout was too long, and therefore causing the onStart() method to hang...not allowing the other messages to fire and handle the tick data. The issue was actually my Firewall software blocking the gmail smtp call, causing the timeout to occur.
My onTick(), onBar(), onMessage() and onAccount() handlers are all done in separate threads and are pretty light. So the issue was simply onStart() not completing and allowing all other handlers to get setup.
Bottom line here, especially if your onTick() handler is pretty lightweight - trace your startup code and make sure it's completing properly, allowing the other event handlers to setup correctly.
Good luck all!
JW
|
|
|
|
 |
API Support
|
Post subject: Re: how to avoid strategy thread queue overloaded? |
Post rating: 0
|
Posted: Fri 07 Apr, 2017, 14:03
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
If you still experience this problem please send a full example that would reproduce the issue.
|
|
|
|
 |
nen
|
Post subject: Re: how to avoid strategy thread queue overloaded? |
Post rating: 0
|
Posted: Fri 09 Jun, 2017, 11:40
|
|
User rating: 0
Joined: Sat 25 Mar, 2017, 19:13 Posts: 6 Location: RomaniaRomania
|
I receive the thread overload warning for this onStart handler. The rest are empty. Any suggestions? public void onStart(IContext context) throws JFException { IEngine engine = context.getEngine(); IHistory history = context.getHistory(); while (true){ System.out.println("\n"); for (Instrument instrument : instruments){ IBar bar = history.getBar(instrument, Period.DAILY, OfferSide.BID, 1); System.out.format("%s (%s / %s)\n",history.getLastTick(instrument).getBid(),bar.getHigh(),bar.getLow());} try {Thread.sleep(1000*60*3);} catch(InterruptedException ex) {Thread.currentThread().interrupt();} } }
|
|
|
|
 |
API Support
|
Post subject: Re: how to avoid strategy thread queue overloaded? |
Post rating: 0
|
Posted: Mon 12 Jun, 2017, 07:32
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
|
|
|
 |
|
Pages: [
1
]
|
|
|
|
|