Download MetaTrader 5
To add comments, please log in or register
Have you found an interesting application? Publish it in Code Base - millions of traders will appreciate that!
bplturner
32
bplturner 2016.09.29 16:55 

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
13641
whroeder1 2016.09.29 18:00  
  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
32
bplturner 2016.09.30 02:58  

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
13641
whroeder1 2016.09.30 11:32  
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