Params
NumericSeries Price(1);
Numeric Length(10); Vars
Numeric KurtValue(0);
Numeric P1(0);
Numeric P2(0);
Numeric P3(0);
Numeric Mean;
Numeric SDev;
Numeric i; Begin
If (Length >3)
{
Mean = Average( Price, Length ) ; //求平均值
SDev = StandardDev( Price, Length, 2 ) ; //计算标准差
if (SDev > 0)
{
for i = 0 to Length - 1
{
P2 = P2 + Power( ( Price[i] - Mean ) / SDev, 4 ) ;
}
P1 = Length * ( Length + 1 ) / ( ( Length - 1 ) * ( Length - 2 ) * ( Length - 3 ) ) ;
P3 = 3 * Sqr( Length - 1 ) / ( ( Length - 2 ) * ( Length - 3 ) ) ;
KurtValue = P1 * P2 - P3 ;
}
}
Return KurtValue; End |
Params
NumericSeries Price(1);
Numeric Length(10); Vars
Numeric KurtValue(0);
Numeric P1(0);
Numeric P2(0);
Numeric P3(0);
Numeric Mean;
Numeric SDev;
Numeric i; Begin
If (Length >3) //length 是参数,也就是计算天数
{
Mean = Average( Price, Length ) ; //求平均值
SDev = StandardDev( Price, Length, 2 ) ; //计算标准差
if (SDev > 0)
{
for i = 0 to Length - 1
{
P2 = P2 + Power( ( Price[i] - Mean ) / SDev, 4 ) ; 求幂
}
P1 = Length * ( Length + 1 ) / ( ( Length - 1 ) * ( Length - 2 ) * ( Length - 3 ) ) ;
P3 = 3 * Sqr( Length - 1 ) / ( ( Length - 2 ) * ( Length - 3 ) ) ;
KurtValue = P1 * P2 - P3 ;
}
}
Return KurtValue; End 就是在金字塔里面创建一个自定义函数 |
这两个定义不同在哪里?后面的数字是不是参数值?
这两个定义不同在哪里?后面的数字是不是参数值?
第一个相当于close ,第二个相当于周期,后面是参数