知识库 > 金融建模 > 公用函数 > 扩展函数 > .Net扩展函数 > 技术分析 > 动量指标 > 计算公式

RSI_f(N, type,dates)    

简述
相对强弱指标。
定义
RSI_f(N:Integer,type:Integer,dates:Date): Real/Table
参数

N:天数
Type:结果类型

dates:截止日

返回:
Type返回类型
0实数
1数组

  • 算法:
    (1)若dates=证券首日,则Ex=0;
    若dates<>证券首日,则Ex=收盘价-昨收盘价
    (2)Z1= N日的Ex的平滑移动平均,权重为1。(若Ex<0,则取0)。
    (3)Z2= N日的Ex的平滑移动平均,权重为1。(若Ex<0,则取相反数)。
    (4)若dates=证券首日,则Z=0;
    若dates<>证券首日,Z=Z1/Z2*100;
    (5)Type=0,返回dates截止日的Z值。
    (6)Type=1,返回dates截止日往前推共nDay个Z序列。
    nDay由系统参数PN_nDay()设置,默认值为180。
    (7)与系统证券pn_stock()、系统时间pn_date()、系统周期pn_cycle()、复权方式pn_rate()、复权基准日pn_rateday()、执行点数PN_nDay()相关
    范例:

    //计算白云机场截止日2011年9月8日6天内的相对强弱指标。
    oV:=BackUpSystemParameters2();
    setsysparam(pn_stock(),'SH600004');
    setsysparam(pn_cycle(),cy_day());
    setsysparam(pn_rate(),0);
    N:=6;
    v:=RSI_f(N,0,inttodate(20110908));
    return v;
    //结果:76.4


    //计算白云机场截止2011年9月8日向前推共5天的相对强弱序列。
    oV:=BackUpSystemParameters2();
    setsysparam(pn_stock(),'SH600004');
    setsysparam(pn_cycle(),cy_day());
    setsysparam(pn_rate(),0);
    setsysparam(pn_nday(),5);
    N:=6;
    v:=RSI_f(N,1,inttodate(20110908));
    return v;
    //结果:


相关