- UID
- 2
- 积分
- 2874674
- 威望
- 1387366 布
- 龙e币
- 1487308 刀
- 在线时间
- 13156 小时
- 注册时间
- 2009-12-3
- 最后登录
- 2024-11-24
|
【Correlation_a】
- Inputs: IndArray[Xsize](NumericArrayRef), DepArray[Ysize](NumericArrayRef), ArraySize(Numeric);
- Variables: var0(0), var1(0), var2(0), var3(0), var4(0), var5(0), var6(0), var7(0), var8(0), var9(0);
-
- condition1 = MinList(Xsize, Ysize, ArraySize) > 0 ;
- If condition1 Then Begin
- var7 = 0;
- var8 = 0;
- var9 = 0;
- For value1 = 1 To ArraySize Begin
- var7 = var7 + (IndArray[value1] * DepArray[value1]);
- var8 = var8 + Square(IndArray[value1]);
- var9 = var9 + Square(DepArray[value1]);
- End;
- var3 = var7 - ArraySize * Average_a(IndArray, ArraySize) * Average_a(DepArray, ArraySize);
- var4 = var8 - ArraySize * Square(Average_a(IndArray, ArraySize));
- var5 = var9 - ArraySize * Square(Average_a(DepArray, ArraySize));
- condition1 = var4 * var5 > 0 ;
- If condition1 Then
- var6 = SquareRoot(var4 * var5)
- Else
- var6 = 0;
- If var6 <> 0 Then Begin
- var0 = var3 / var6;
- condition1 = var0 <= 1 AND var0 >= -1 ;
- If condition1 Then
- Correlation_a = var0
- Else
- Correlation_a = -2;
- End
- Else
- Correlation_a = -2;
- End
- Else
- Correlation_a = -2
复制代码 |
论坛官方微信、群(期货热点、量化探讨、开户与绑定实盘)
|