"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.

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.

mladen: 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

So instead of simply calling the cci, I need to create it? I cannot declare rates_total array instead?

Just hopping in but this is how probably the calculation you are looking for should be done in metatrader 5. That is the calculation that will not calculate all the bars, but just the necessary ones. Try it out

Try out this version and let me know what happens. It is using thee "simple" one from the previous post instead of the the built in CCI. Results (as far as calculations are concerned) are the same. I am curious what is the difference in speed (I would like to pinpoint the problem, since I hate the "not knowing" what is happening ) since it seems that we need a lot to learn about metatrader 5 (about what to do and what to expect from it)

mladen: Doc
Try out this version and let me know what happens. It is using thee "simple" one from the previous post instead of the the built in CCI. Results (as far as calculations are concerned) are the same. I am curious what is the difference in speed (I would like to pinpoint the problem, since I hate the "not knowing" what is happening ) since it seems that we need a lot to learn about metatrader 5 (about what to do and what to expect from it)

Mladen,

a lot of stuff here, thank you...I need to think about how to proceed, but personally I thought it was much simple than this...the best functional way seems to be the creation inside the code of each single indicator needed (the function icustom is really too slow)...

by the way, I love this:

int window = ChartWindowFind();
checkObject(window,"cci1" , 50,15);

mladen:Doc

"

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).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?"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

docFiles:Trend alexcud CCI + alert

Small variation to trend alexcud...instead of moving averages, it calculates multi tf cci at typical price.

Regards

doc

p.s.

(alerts are fixed thanks to mladen!)

Files:mladen: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

So instead of simply calling the cci, I need to create it? I cannot declare rates_total array instead?

Best regards

doc

...

Doc

Just hopping in but this is how probably the calculation you are looking for should be done in metatrader 5. That is the calculation that will not calculate all the bars, but just the necessary ones. Try it out

Files:Metatrader 5 version of CCI simple indicator

Metatrader 5 version of CCI simple indicator. The same as the metatrader 4 version this one too allows limiting the number of bars calculated

Files:...

Doc

Try out this version and let me know what happens. It is using thee "simple" one from the previous post instead of the the built in CCI. Results (as far as calculations are concerned) are the same. I am curious what is the difference in speed (I would like to pinpoint the problem, since I hate the "not knowing" what is happening ) since it seems that we need a lot to learn about metatrader 5 (about what to do and what to expect from it)

Files:mladen:Doc Try out this version and let me know what happens. It is using thee "simple" one from the previous post instead of the the built in CCI. Results (as far as calculations are concerned) are the same. I am curious what is the difference in speed (I would like to pinpoint the problem, since I hate the "not knowing" what is happening ) since it seems that we need a lot to learn about metatrader 5 (about what to do and what to expect from it)

Mladen,

a lot of stuff here, thank you...I need to think about how to proceed, but personally I thought it was much simple than this...the best functional way seems to be the creation inside the code of each single indicator needed (the function icustom is really too slow)...

by the way, I love this:

It's really zen!

Best regards

doc

MA multiple crosses signal

This indicator show the cross of 2 moving averages...

...but you can view up to 4 ma's crosses together (you need to change the 1st input from 1 to 4)

Best regards

doc

Files:CCI multiple crosses signal

Same job here but with the CCI

Regards

doc

Files: