35 lines
1.1 KiB
Plaintext
35 lines
1.1 KiB
Plaintext
Function StocktTrailingAvgByEndT(Endt,RefType,Exp,IsExcludeIPO,N);
|
||
Begin
|
||
{** ======================================================================//
|
||
%% @explain(说明):
|
||
获取基于指定日推移阶段的日均指标
|
||
%% 输入:
|
||
%% @param(EndT)(TDateTime) 日期,区间截止日
|
||
%% @param(RefType) 用户自定义,选择所推移类型,取值如下:
|
||
0: 最近1周
|
||
1: 最近1月
|
||
...
|
||
12:成立以来
|
||
%% @param(Exp)(exp) 指标表达式,如@close(),@stockzdf3()
|
||
%% @param(IsExcludeIPO)(Bool) 是否剔除上市日区间行情
|
||
%% @param(N)(Int) 剔除天数
|
||
%% 输出: 值(real)
|
||
%% @remark(更新日志) 2021-07-14 TS业务框架
|
||
|
||
%%//====================================================================== **}
|
||
ov := BackupSystemParameters2();
|
||
if ifnil(IsExcludeIPO) then IsExcludeIPO:=0;
|
||
if ifnil(N) then N:=1;
|
||
setsysparam(pn_date(),endt);
|
||
setsysparam(pn_cycle(),cy_day());
|
||
begt := StockRefDatebyEndt(Endt,RefType);
|
||
ND := tradedays(begt,endt);
|
||
if IsExcludeIPO then
|
||
begin
|
||
MD := tradedays(firstday(),sp_time());
|
||
ND := MD-ND<=N?MD-N:ND;
|
||
end
|
||
return MA(eval(Exp),ND);
|
||
|
||
End;
|