Forum on trading, automated trading systems and testing trading strategies
Where is iStdDevOnArray on mt5?
Ernst Van Der Merwe, 2019.08.29 12:59
Instead of price, pass a handle as parameter.
int OnInit() { //--- indicator buffers mapping SetIndexBuffer(0,StdDevBuffer,INDICATOR_DATA); SetIndexBuffer(1,RSIBuffer,INDICATOR_CALCULATIONS); //--- if((handleRSI=iRSI(_Symbol,_Period,RSIPeriod,RSIPrice))==INVALID_HANDLE || (handleStdDev=iStdDev(_Symbol,_Period,StdDevPeriod,0,MODE_SMA,handleRSI))==INVALID_HANDLE) return(INIT_FAILED); //--- return(INIT_SUCCEEDED); }
Forum on trading, automated trading systems and testing trading strategies
Where is iStdDevOnArray on mt5?
Chris70, 2019.08.29 11:22
not sure if there's something like that somewhere in the standard library, but either way you might be looking for something like:
double ArrayStdDev(double &arr[]) { int elements=ArraySize(arr); double mean=0; for (int i=0;i<elements;i++){mean+=arr[i];} mean/=elements; double mdev2sum=0; for (int i=0;i<elements;i++){mdev2sum+=pow(arr[i]-mean,2);} return sqrt(mdev2sum/elements); }
(I just quickly wrote this down; not tested)
Learn to use the Search functionality. I found the above in less than a minute.
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
In mql4 there is iStdDevOnArray and also iMAOnArray, but not in mql5.
can somebody here create them for free ?