## Formula Quick Reference

Market Data | Date Functions | Reference Functions | Logical Functions | Math Functions | Statistic Functions | Indicator Functions | Drawing Functions | Drawing Descriptors | Miscellaneous Functions | Formula Forum

Statistic Functions

 avedev avedev(x, n): x: an array of numbers, n: period number calculate the average of the absolute deviations of x in n periods. n := 20; # cci typ := (high + low + close)/3; cci := (typ-ma(typ, n))/(0.015*avedev(typ, n)); fillrgn(cci, 100), color963264; fillrgn(-100, cci), color963264; cci, colorf05a5a; var var(x, n): x: an array of numbers, n: period number estimate variance of x in n periods. # std(x, n) is very close to (var(x, n))^(1/2) n := 5; a:= pow(var(c, n), 0.5); b:= std(c, n); a-b, colorred; std std(x, n): x: an array of numbers, n: period number estimate standard deviation of x in n periods. n := 10; p := 3; bbi:(ma(close,3)+ma(close,6)+ma(close,12)+ma(close,24))/4; upr:bbi+p*std(bbi, n); dwn:bbi-p*std(bbi, n); slope slope(x, n): x: an array of numbers, n: period number use the least squares method to find the best fitting line of x in n periods and return the slope of the line. 0, colorred; slp:(close, 20); relate relate(x, n): relate(x, y, n): x: an array of numbers, y: an array of numbers, n: period number. relate(x, n): check the match of x with ascending straight lines in n periods and return the correlation coefficient; relate(x, y, n): check the match of x with y in n periods and return the correlation coefficient; n := 20; m := 1; sigline : 0.8, colorred; nasdaq_close := "^ixic\$ochl.c"; rel : relate(ref(c, m), nasdaq_close, n); signal_match : rel > sigline; Function Index abs | align | avedev | backset | barscount | barslast | barssince | between | capital | ceiling | circledot | close | color | colorstick | cost | count | cross | crossdot | date | datediff | day | dma | drawicon | drawline | drawnumber | drawtext | ema | every | exist | fillrgn | filter | finance | floor | hhv | hhvbars | high | if | intpart | iscamarket | isdown | isequal | islastbar | isup | isusmarket | last | linestick | linestyle | linethick | llv | llvbars | ln | log | longcross | low | ma | max | min | mod | month | not | open | partline | peak | peakbars | peaktrough | peaktroughbars | pointdot | polyline | pow | range | ref | relate | reverse | sar | sarturn | sgn | sigperform | slope | sma | std | stick | stickline | sum | sumbars | transparency | trough | troughbars | var | vertline | vol | volstick | weekday | winner | year | zig