# 数据仓库 / N日 ## `deltaOfNDay(exp, n)` 当前值-前N日值。 | 参数 | 类型 | 说明 | | ----- | ------ | ------------------ | | `exp` | string | 字符串。统计表达式 | | `n` | int | 整数。天数 | 返回:float ### 示例 ```tsl SetSysParam(pn_stock(),"SH600585"); SetSysParam(pn_date(),20231010T); return DeltaOfNDay(@close(),5); ``` ## `percentRankOfNDay(exp, n, cache_str)` 当前值在最近N天的百分位排名,Nan值不参与排名。 | 参数 | 类型 | 说明 | | ----------- | ------ | ------------------ | | `exp` | string | 字符串。统计表达式 | | `n` | int | 整数。天数 | | `cache_str` | string | 字符串。缓存串 | 返回:float ### 示例 ```tsl SetSysParam(pn_stock(),"SH600585"); SetSysParam(pn_date(),20231030T); return PercentRankOfNDay(@close(),10,""); ``` ## `signedPower(exp, n)` 符号次方。特殊当x=0时,N<0,返回Nan;N=0, 返回1;N>0, 返回0。 | 参数 | 类型 | 说明 | | ----- | ------ | ------------------ | | `exp` | string | 字符串。函数表达式 | | `n` | int | 实数。次方 | 返回:float ### 示例 ```tsl SetSysParam(pn_stock(),"SH600585"); SetSysParam(pn_date(),20231030T); return SignedPower(@close(),3); ``` ## `slopeofNday(exp1, exp2, n, cache_str)` N日线性回归系数。 | 参数 | 类型 | 说明 | | ----------- | ------ | -------------------- | | `exp1` | string | 字符串。因变量表达式 | | `exp2` | string | 字符串。自变量表达式 | | `n` | int | 整数。交易日天数 | | `cache_str` | string | 字符串。缓存字段 | 返回:float ### 示例 ```tsl SetSysParam(pn_stock(),"SH600585"); SetSysParam(pn_date(),20231030T); return SlopeofNday(@close(),@open(),30,""); ``` ## `wmaofNday(exp, n, cache_astr)` N日衰减加权。最新值权重最大,权重归一化,结果同DecayAvgOfNDay。 | 参数 | 类型 | 说明 | | ------------ | ------ | ------------------ | | `exp` | string | 字符串。函数表达式 | | `n` | int | 整数。天数 | | `cache_astr` | string | 字符串。缓存串 | 返回:float ### 示例 ```tsl SetSysParam(pn_stock(),"SH600585"); SetSysParam(pn_date(),20231030T); return WmaofNday(@open(),30,""); ```