I try to convert my indicator to mt5 version but I'm looking for iStdDevOnArray .
its not on MQL5 Reference. anybody can help me?
toptunes:
I try to convert my indicator to mt5 version but I'm looking for iStdDevOnArray .
its not on MQL5 Reference. anybody can help me?
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)
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); }
Files:
StdDevOnRSI.mq5
3 kb
I can't believe that. I spent all my time to learn mt4 and heard today mt4 will be dying soon . and all our indicators will gone. and I GOT IT today
there are many different is between mt4 and mt5. WHY? it's unbelievable this level of the difference. I know C#, PHP, javascript but I can't
understand why mt5 is so hard to learn !! but I will try !! and thank you Ernst and Chris70
Where did you hear that MT4 will be dying soon?
I don't believe that Metaquotes have made any announcement.
Keith Watford:
The Earth will burn too. Incredible !
Where did you hear that MT4 will be dying soon?
I don't believe that Metaquotes have made any announcement.
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