| kisacik 7 posts
 msg #51318
 - Ignore kisacik
 | 4/25/2007 5:47:13 AM 
 I am trying to design a custom indicator and find the standard deviations of it from a moving average. For simplicity, I used the closing price instead of my custom indicator that I called "foo". The below example works, but is there a simpler way like StdDev(foo, 20, 1) to get the result quickly with less typing?
 
 set {foo, close}
 set {foo2, foo * foo}
 set {ave, CMA(foo, 30)}
 set {ave2, ave * ave}
 set {cum_ave, 30 * ave}
 set {cum_ave2, 30 * ave2}
 set {cum_foo2, sum(foo2, 30)}
 set {cum_cross, sum(foo, 30) * ave}
 set {cum_2cross, 2 * cum_cross}
 set {sum1, cum_ave2 + cum_foo2}
 set {sum2, sum1 - cum_2cross}
 set {dev2, sum2 / 30}
 set {std_dev, sqrt(dev2)}
 
 close is between 100 and 101
 and draw std_dev
 and draw standard deviation(30, 1)
 
 
 
 | 
| kisacik 7 posts
 msg #51319
 - Ignore kisacik
 modified
 | 4/25/2007 6:10:45 AM 
 The function cstddev(foo, 30) does this apparently, not in the documentation though, it is in the Q&A help pages. I am yet to find how to modify the smoothing parameter, by default it is 7. So, cstddev(foo, 30) is the same as standard deviation(foo, 30, 7). So...
 
 and draw cstddev(foo, 30)
 
 
 |