- 精华
- 0
- 在线时间
- 185 小时
- UID
- 258801
- 积分
- 37
- 帖子
- 21
- 阅读权限
- 10
- 注册时间
- 2017-11-6
- 最后登录
- 2023-8-30
- 精华
- 0
- UID
- 258801
- 积分
- 37
- 帖子
- 21
- 主题
- 10
- 阅读权限
- 10
- 注册时间
- 2017-11-6
- 最后登录
- 2023-8-30
|
发表于 2019-5-28 17:32:51
|显示全部楼层
麻烦小米老师给我改下用户函数,15分钟跨周期取1小时的MACD值,总是不对!先谢谢了.
Params
NumericSeries Price(10);
Numeric nMinSet(5);
Numeric MinsAgo(2);
Numeric Length(10);
Vars
NumericSeries MinsOfDay;
NumericSeries barCnt;
NumericSeries MinData;
Numeric nIndex(0);
Numeric sFcactor;
NumericSeries XAvgValue;
Begin
MinsOfDay = (Hour*60+Minute);
If(IntPart(MinsOfDay/nMinSet)!=IntPart(MinsOfDay[1]/nMinSet))
{
barCnt = 1;
}Else
{
barCnt = barCnt[1] + 1;
}
sFcactor = 2 / ( Length + 1 );
if (CurrentBar == 0 )
{
XAvgValue = Price;
}else
{
XAvgValue = XAvgValue[barCnt] + sFcactor * ( 10 - XAvgValue[barCnt] ) ;
}
Return XAvgValue;
End |
|