mt4 have the AVEDEV fuction?

zdj229
166
mt4 have the AVEDEV fuction?  I want use the AVEDEV,what can i do
Fernando Carreiro
9942
zdj229: mt4 have the AVEDEV fuction?  I want use the AVEDEV,what can i do

Average Deviation is not a built in function or indicator in MetaTrader, but you can code it yourself instead:

Equation

The average of the absolute deviations of data points from their mean. Average Deviation is a measure of the variability in a data set.
zdj229
166
zdj229  
Fernando Carreiro #:

Average Deviation is not a built in function or indicator in MetaTrader, but you can code it yourself instead:

My source code is this

double TYP=(High[0]+Low[0]+Close[0])/3;

double a=iMA(Symbol(),0,14,0,MODE_EMA,0,0);

double CCI= (TYP-a)/(0.015*AVEDEV(TYP,14));


can you help me transformation the  AVEDEV fuction for me?

thank you very much



William Roeder
27545
William Roeder  
zdj229 #: can you help me transformation the  AVEDEV fuction for me?

Help you with what? You haven't stated a problem, you stated a want. Show us your attempt (using the CODE button) and state the nature of your difficulty. Fernando gave you the math.
          No free help (2017)

Or pay someone. Top of every page is the link Freelance.
          Hiring to write script - General - MQL5 programming forum (2018)

We're not going to code it for you (although it could happen if you are lucky or the problem is interesting).
          No free help (2017)

zdj229
166
zdj229  
William Roeder #:

Help you with what? You haven't stated a problem, you stated a want. Show us your attempt (using the CODE button) and state the nature of your difficulty. Fernando gave you the math.
          No free help (2017)

Or pay someone. Top of every page is the link Freelance.
          Hiring to write script - General - MQL5 programming forum (2018)

We're not going to code it for you (although it could happen if you are lucky or the problem is interesting).
          No free help (2017)

sorry,My english is very poor,so Maybe what I said was impolite

zdj229
166
zdj229  
zdj229 #:

sorry,My english is very poor,so Maybe what I said was impolite

What I said is translated by software. I'm sorry

Fernando Carreiro
9942
zdj229 #: My source code is this ... can you help me transformation the  AVEDEV fuction for me?
double TYP=(High[0]+Low[0]+Close[0])/3;
double a=iMA(Symbol(),0,14,0,MODE_EMA,0,0);
double CCI=(TYP-a)/(0.015*AVEDEV(TYP,14));
If you require that someone code an Average Deviation (AVEDEV) indicator for you, then please place a job request in the Freelance section. Describe the issue, and state your budget, and I am sure you will receive offers from several developers for the job.
maximo
1971
maximo  
zdj229:
mt4 have the AVEDEV fuction?  I want use the AVEDEV,what can i do

 

extern int                CCIPeriod  = 50;             // CCI period
extern ENUM_APPLIED_PRICE CCIPrice   = PRICE_TYPICAL;  // Price

   for(int i=limit,k; i>=0; i--)
   {
      prices[i] = iMA(NULL,0,1,0,MODE_SMA,CCIPrice,i);
      double avg=0; for(k=0; k<CCIPeriod && (i+k)<Bars; k++) avg +=         prices[i+k];      avg /= (CCIPeriod);
      double dev=0; for(k=0; k<CCIPeriod && (i+k)<Bars; k++) dev += MathAbs(prices[i+k]-avg); dev /= (CCIPeriod);  // Average Deviation
      cci[i]   = (dev!=0) ? (prices[i]-avg)/(0.015*dev) : 0;

   }