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.

Slow calculation of custom indicator in strategy
 Post subject: Slow calculation of custom indicator in strategy Post rating: 0   New post Posted: Thu 06 Mar, 2014, 14:15 

User rating: 3
Joined: Thu 28 Jul, 2011, 19:40
Posts: 72
Location: PolandPoland
Hello,

I have problem with slow calculation of custom indicator in strategy.
I have Custom ZigZag indicator (in attachment). It have additional arrows.
I use this indicator in strategy to calculate. I need use it evry one second (the same result as every tick) and it seems that this idicator is calculated very slow,
I return message if arrow will accured and I print date/time of bar on which it accure.
and I see that there is big shift (delay) in calculating:


Image

In Messages window I receive:

Image

So it means that this indicator is calculated very slow.
What can I do to calculate it in real time, without delay?


Attachments:
CustomIndicatorTest.java [4.28 KiB]
Downloaded 70 times
CustomZigZag.jfx [12.59 KiB]
Downloaded 51 times
delay2.png [44.25 KiB]
Downloaded 325 times
dalay.png [8.42 KiB]
Downloaded 315 times
DISCLAIMER: Dukascopy Bank SA's waiver of responsability - Documents, data or information available on this webpage may be posted by third parties without Dukascopy Bank SA being obliged to make any control on their content. Anyone accessing this webpage and downloading or otherwise making use of any document, data or information found on this webpage shall do it on his/her own risks without any recourse against Dukascopy Bank SA in relation thereto or for any consequences arising to him/her or any third party from the use and/or reliance on any document, data or information found on this webpage.
 
 Post subject: Re: Slow calculation of custom indicator in strategy Post rating: 0   New post Posted: Mon 10 Mar, 2014, 18:21 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Is it really necessary to calculate over 1000 values each time? Do the indicator values on previous candles change? If not, consider storing the previous indicator results in an array and on every subsequent candle calculate the indicator only over the last candle.


 
 Post subject: Re: Slow calculation of custom indicator in strategy Post rating: 0   New post Posted: Mon 10 Mar, 2014, 19:28 

User rating: 3
Joined: Thu 28 Jul, 2011, 19:40
Posts: 72
Location: PolandPoland
Generally it is not necessary. It is necessary if I receive arrow. But I made this example to better show slow of this calculation. In practice if I only calculate 2 past value and once per 20-30 sec calculate 1000 value which I need to find last 3 peaks on zigzag. I such situation I receive about 10-20 sec delay. Not always but often. And it is also to big delay for me.
Where is the problem? in downloading data for calculation or where? (because CPU seems to not work hard).


 
 Post subject: Re: Slow calculation of custom indicator in strategy Post rating: 0   New post Posted: Tue 11 Mar, 2014, 08:59 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
janjjj wrote:
Where is the problem? in downloading data for calculation or where?
If the indicator is recalculate-all then it may cause a big performance difference as on every calculation it calculates over 4000 candles. Please check if that is the case.


 

Jump to:  

  © 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