Suppose there is a factor defined as follows:
@state
def abc(close){
....
return value
}
I intend to calculate the current factor value based on the previous one, similar to recursive calculation, as shown below:
ouput[i] = close * α + output[i-1]
How to achieve this in DolphinDB?
You can use the iterate function, please see https://docs.dolphindb.cn/en/help200/FunctionsandCommands/FunctionReferences/i/iterate.html?highlight=iterate
Here is an example script: