如何根据5minK线数据计算OHLC的标准差

5分钟K线表部分字段如图所示,如何计算每个时间节点(包括自身在内)的之前5个K线的open,high,low,close(一共20个数据)的标准差std

attachments-2022-08-eH5dwiQx630613812e5e1.png

请先 登录 后评论

1 个回答

Draco Chen

可以用高阶函数moving实现,moving用法参考https://dolphindb.cn/cn/help/Functionalprogramming/TemplateFunctions/moving.html

select *,moving(std, (fixedLengthArrayVector(close,high,low,open)),5) as std from t


请先 登录 后评论