Download MetaTrader 5

iStdDevOnArray

To add comments, please log in or register
bplturner
54
bplturner  

Hello,

 Is there any difference between

 

double dev = double  iStdDevOnArray(0, 0, MODE_SMA, 0, MA_LENGTH, i); 

 AND 

 

double dev = double  iStdDevOnArray(0, MA_LENGTH, MODE_SMA, 0, MA_LENGTH, i); 

I don't see the point in calculating the standard deviation on the whole array if I can calculate it on just a segment equal to the moving average length.  It seems like the second should be much faster and give the same answer.

 

Am I missing something here?

whroeder1
15934
whroeder1  
  1. Neither one will work if you don't pass the array.
  2. We have no idea if it calculates only the asked for value or caches all values.
  3. It takes 20 ms and bars take minutes, faster is irrelevant.
bplturner
54
bplturner  

Oops.  I forgot to pass the array.  I guess I meant to ask if we need to count the whole array, of just the X amounts of bars you want to take where X is the period we specified.  Do they give the same answers?


I'm not too concerned about the speed in live, but running an optimization pass with thousands of parameters makes me want to make sure I have everything as quick as possible.

whroeder1
15934
whroeder1  
bplturner: , but running an optimization pass with thousands of parameters makes me want to make sure I have everything as quick as possible.
Don't do per tick what you can do per bar. Don't do per bar what you can do when price reaches a condition.
To add comments, please log in or register