Something interesting, old thread - page 3

 

...

Got it Will have to wait till tomorrow to check some changes made. From what I see so far there should be no such issue that you described, but it seems that you have a nose for finding bugs in metatrader(s) (like the one with a snapshot in metatrader 4)

dr.house7:
Good morning mladen!

yap sure, this is my little mod...here I used cci cause the calculation is more complex and slow than ma calculation (so it's easier to see differences in indy's loading time).

Please try it before with 5000 bars chart and than with 1.000.000 bars chart what a big difference loading time.

Best regards

doc

prova3.mq5
 
mladen:
Got it Will have to wait till tomorrow to check some changes made. From what I see so far there should be no such issue that you described, but it seems that you have a nose for finding bugs in metatrader(s) (like the one with a snapshot in metatrader 4)

Yap,

it seems that I have not a good relationship with the platform

 
mladen:
Got it Will have to wait till tomorrow to check some changes made. From what I see so far there should be no such issue that you described, but it seems that you have a nose for finding bugs in metatrader(s) (like the one with a snapshot in metatrader 4)

Hi mladen,

did you check your changes made on the code?

Best regards

doc

 

...

Doc

Try this version out

Removed all that was not necessary from the OnTick(), moved what could be moved to OnInit() and simplified some things, but quite frankly, I do not see a significant change in speed (average CPU usage gets at 2% at my PC with this indicator included)

What I see is that CCI calculations you have are quite a lengthy ones and CCI must go through a 2 times period loops to calculate CCI values, which could cause some slowing down, but not the kind of slowing down that you are describing. Will test some more, and if I find something will get back on this issue here

dr.house7:
Hi mladen,

did you check your changes made on the code?

Best regards

doc
Files:
prova_3.01.mq5  18 kb
 
mladen:
Doc

Try this version out

Removed all that was not necessary from the OnTick(), moved what could be moved to OnInit() and simplified some things, but quite frankly, I do not see a significant change in speed (average CPU usage gets at 2% at my PC with this indicator included)

What I see is that CCI calculations you have are quite a lengthy ones and CCI must go through a 2 times period loops to calculate CCI values, which could cause some slowing down, but not the kind of slowing down that you are describing. Will test some more, and if I find something will get back on this issue here

Thanks anyway mladen for your support.

Best regards

doc

 

...

The problem with CCI calculation is that those 2 loops in calculation can not be completely avoided. It can be partially avoided on the simple moving average (which is the first part of CCI calculation) but can not (at least I did not find a way so far) for calculating mean deviation and that can slow down CCI calculation significantly for long periods

dr.house7:
Thanks anyway mladen for your support.

Best regards

doc
 
mladen:
The problem with CCI calculation is that those 2 loops in calculation can not be completely avoided. It can be partially avoided on the simple moving average (which is the first part of CCI calculation) but can not (at least I did not find a way so far) for calculating mean deviation and that can slow down CCI calculation significantly for long periods

Sorry mladen,

but I don't understand you ...I intentionally put the cci because I knew the complex calculation, with the only idea to show you how much different is metatrader in loading time from few bars in chart to many.

If you didn't see this difference, it's probably because you forget that on mt5 the procedure for change the max bars in chart is different from mt4... it's not enough to change the max bars number on options and restart the platform...after that you need to go manually at begin of the data chart and wait.(or just wait some minutes)

Loading time for:

5.000 bars in chart: 0,2 s

500.000 bars in chart: 9 s

and this is not possible, cause the highest period is 900...after 900 bars back all other bars should be ignored, or have I missed something?

Thanks a lot

doc

 

...

Doc

"and this is not possible, cause the highest period is 900...after 900 bars back all other bars should be ignored, or have I missed something?"

It does not go like that. The indicator (CCI) will calculate values for all 500.000 bars and it will calculate using values for 900 previous bars for each and every bar, regardless if you ask just the current bar value. So in case of 500.000 bars on chart it is 500.000x(900+900) (if they do not use simplified SMA) or 500.000x900+900 loops if they use simplified SMA calculation (I do not know how do they calculate it in the built in version).

dr.house7:
Sorry mladen,

but I don't understand you ...I intentionally put the cci because I knew the complex calculation, with the only idea to show you how much different is metatrader in loading time from few bars in chart to many.

If you didn't see this difference, it's probably because you forget that on mt5 the procedure for change the max bars in chart is different from mt4... it's not enough to change the max bars number on options and restart the platform...after that you need to go manually at begin of the data chart and wait.(or just wait some minutes)

Loading time for:

5.000 bars in chart: 0,2 s

500.000 bars in chart: 9 s

and this is not possible, cause the highest period is 900...after 900 bars back all other bars should be ignored, or have I missed something?

Thanks a lot

doc
 
mladen:
Doc

"and this is not possible, cause the highest period is 900...after 900 bars back all other bars should be ignored, or have I missed something?"

It does not go like that. The indicator (CCI) will calculate values for all 500.000 bars and it will calculate using values for 900 previous bars for each and every bar, regardless if you ask just the current bar value. So in case of 500.000 bars on chart it is 500.000x(900+900) (if they do not use simplified SMA) or 500.000x900+900 loops if they use simplified SMA calculation (I do not know how do they calculate it in the built in version).

For me, what indicator does, is totally wrong...all the cci calculation needs only an "n" period time determined by user...

so you said "The indicator (CCI) will calculate values for all 500.000 bars" and I would ask you, is there a method for calculate only 900+1 bars back instead? Just for bypass this useless calculation.

Regards

doc

 

...

Here is a metatrader 4 example for that.

It will collect all the prices (but it is not a looping job) and will calculate only the required number of bars (so that is the case what you are looking for). To see a line at all set the number of bars to calculate to 2 since in the case of just 1 bar calculation you will have to wait till a new bar comes in to make the line visible, but in the data window you will see that the correct CCI value is there

dr.house7:
For me, what indicator does, is totally wrong...all the cci calculation needs only an "n" period time determined by user...

so you said "The indicator (CCI) will calculate values for all 500.000 bars" and I would ask you, is there a method for calculate only 900+1 bars back instead? Just for bypass this useless calculation.

Regards

doc
Reason: