【问题标题】:Error occurs in select clause querying for technical analysis module in DolphinDBDolphinDB技术分析模块select子句查询出错
【发布时间】:2021-12-29 06:36:30
【问题描述】:

图为表架构:

查询数据时该行报错:

select *,bBands(close, 5, 2, 2, 0) as `high`mid`low  from kline

错误信息是:

The calculated column was not initialized or an exception was raised.

但是,我试过的另一个脚本没有报错:

close = 7.2 6.97 7.08 6.74 6.49 5.9 6.26 5.9 5.35 5.63 3.81 3.935 4.04 3.74 3.7 3.33 3.64 3.31 2.69 2.72
date = (2020.03.02 + 0..4 join 7..11).take(20)
symbol = take(`F,10) join take(`GPRO,10)
t = table(symbol, date, close) 
select *, bBands(close, 5, 2, 2, 2) as `high`mid`low from t context by symbol

为什么会出现错误以及如何在我的代码中避免它?

【问题讨论】:

    标签: select initialization dolphindb


    【解决方案1】:

    出现此错误是因为列的名称与布林带的 UP 和 DN 一致。

    您可以使用以下代码:

    select *,bBands(close, 5, 2, 2, 0) as `bBand_high`mid`bBand_low  from kline. 
    

    【讨论】: