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


Date Functions

day
weekday
month
year
day: return day in month from 1-31;

weekday: return weekday number from 1-7 (Sunday = 7);

month: return month number from 1-12;

year: return year number like 1970, 2001 etc.

d : day;
wd: weekday;
m : month; # on 20-oct-05, m =10, d = 20, wd = 4 (thu)
# happy new year
drawicon(year != ref(year, 1), low, 1), align2;

date

return integer number representing dates, e.g.,

700101: 1970-01-01
701231: 1970-12-31
1050101: 2005-01-01
1051231: 2005-12-31

# draw vertical lines between 01-sep-05 and 01-oct-05
vertline(date >= 1050901 and date <= 1051001);
# formula only valid before 31-oct-05
var := if(date < 1051231, 1, 0);
rsv := (close - llv(low, 9))/(hhv(high, 9) - llv(low, 9))*100;
k : sma(rsv, 3, 1)*var;
d : sma(k, 3, 1)*var;
datediff

datediff(date1, date2):

return date1 - date2, the day difference between date1 and date2

diff : datediff(date, 1050101); trading_day_diff : barslast(close > ma(close, 30));
natrual_day_diff : datediff(date, ref(date, trading_day_diff));

 

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