Download MetaTrader 5

Something interesting, old thread - page 3

To add comments, please log in or register
Mladen Rakic
72258
Mladen Rakic  

...

Doc

Can you post the version that is causing you that problems?

dr.house7:
Dear mladen,

I don't try to make a loop, but I would like to have a right calculation...probably as you said it's a metatrader problem, because if I attach this indy to a 10.000 bars chart and than to a 30.000 bars chart, I see a big difference (3x times slower) and I don't understand the reason cause it shouldn't count all bars but only what needed, so the max ma's value and nothing more...

How could I have something like this:

rates_total= max ma's value (so it calculates only the right bar's number needed)

Is it possible?

Regards

doc
drhouse7
704
drhouse7  
mladen:
Doc Can you post the version that is causing you that problems?

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

Files:
prova3.mq5 20 kb
Mladen Rakic
72258
Mladen Rakic  

...

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
drhouse7
704
drhouse7  
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

drhouse7
704
drhouse7  
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

Mladen Rakic
72258
Mladen Rakic  

...

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:
drhouse7
704
drhouse7  
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

Mladen Rakic
72258
Mladen Rakic  

...

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
drhouse7
704
drhouse7  
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

Mladen Rakic
72258
Mladen Rakic  

...

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
To add comments, please log in or register