Code snippets - page 4 1234567891011...13 New comment Mladen Rakic 2014.06.21 14:14 #31 A very simple function to calculate CCI : _cci.mq4 The advantage is that you can calculate cci of any value using this function (without a need to allocate one more buffer, as iCCIOnArray requires) : double workCci[][1]; double iCci(double price, int period, int r, int instanceNo=0) { if (ArrayRange(workCci,0)!= Bars) ArrayResize(workCci,Bars); r=Bars-r-1; // // // // // workCci[r] = price; double tcci = 0; double avg = 0; for(int k=0; k=0; k++) avg += workCci[r-k]; avg /= period; double dev = 0; for( k=0; k=0; k++) dev += MathAbs(workCci[r-k]-avg); dev /= period; if (dev!=0) tcci = (price-avg)/(0.015*dev); return(tcci); } Files: _cci.mq4 2 kb Something interesting, old thread T3 RSI of Moving Average Mladen Rakic 2014.06.21 18:09 #32 Examples (for those that want experiment with CCI of "something") : cci of average and cci of stochastic Files: cci_examples.gif 77 kb sebatian 2014.06.21 19:58 #33 mladen:Examples (for those that want experiment with CCI of "something") : cci of average and cci of stochastic Were those posted somewhere? Mladen Rakic 2014.06.21 20:22 #34 sebastianK:Were those posted somewhere? CCI using average for instead of raw price was posted here (the upper one on that example) : https://www.mql5.com/en/forum/175321/page3 sebatian 2014.06.21 21:04 #35 mladen:CCI using average for instead of raw price was posted here (the upper one on that example) : https://www.mql5.com/en/forum/175321/page3 Thanks sebatian 2014.06.22 08:42 #36 mladen:CCI using average for instead of raw price was posted here (the upper one on that example) : https://www.mql5.com/en/forum/175321/page3 Could not find the version using stochastic. Can you post the link to it, please? Mladen Rakic 2014.06.22 09:30 #37 sebastianK:Could not find the version using stochastic. Can you post the link to it, please? That version was not posted Here it is : cci_of_stochastic_2.mq4 Files: cci_of_stochastic_2.mq4 4 kb cci_of_stochastic.gif 75 kb sebatian 2014.06.22 10:41 #38 mladen:That version was not posted Here it is : cci_of_stochastic_2.mq4 Thank you sebatian 2014.06.22 20:01 #39 mladen:That version was not posted Here it is : cci_of_stochastic_2.mq4 PS: did you try CCI on some more indicators? Mladen Rakic 2014.06.22 21:40 #40 sebastianK:PS: did you try CCI on some more indicators? sebastianK Not for now 1234567891011...13 New comment
A very simple function to calculate CCI : _cci.mq4
The advantage is that you can calculate cci of any value using this function (without a need to allocate one more buffer, as iCCIOnArray requires) :
double iCci(double price, int period, int r, int instanceNo=0)
{
if (ArrayRange(workCci,0)!= Bars) ArrayResize(workCci,Bars); r=Bars-r-1;
//
//
//
//
//
workCci[r] = price;
double tcci = 0;
double avg = 0; for(int k=0; k=0; k++) avg += workCci[r-k]; avg /= period;
double dev = 0; for( k=0; k=0; k++) dev += MathAbs(workCci[r-k]-avg); dev /= period;
if (dev!=0)
tcci = (price-avg)/(0.015*dev);
return(tcci);
}Examples (for those that want experiment with CCI of "something") : cci of average and cci of stochastic
Examples (for those that want experiment with CCI of "something") : cci of average and cci of stochastic
Were those posted somewhere?
Were those posted somewhere?
CCI using average for instead of raw price was posted here (the upper one on that example) : https://www.mql5.com/en/forum/175321/page3
CCI using average for instead of raw price was posted here (the upper one on that example) : https://www.mql5.com/en/forum/175321/page3
Thanks
CCI using average for instead of raw price was posted here (the upper one on that example) : https://www.mql5.com/en/forum/175321/page3
Could not find the version using stochastic. Can you post the link to it, please?
Could not find the version using stochastic. Can you post the link to it, please?
That version was not posted
Here it is : cci_of_stochastic_2.mq4
That version was not posted Here it is : cci_of_stochastic_2.mq4
Thank you
That version was not posted Here it is : cci_of_stochastic_2.mq4
PS: did you try CCI on some more indicators?
PS: did you try CCI on some more indicators?
sebastianK
Not for now