变量声明问题咨询
老师好,Average或Highest函数中的变量,按要求应当是序列数值型的。但我下面编写的公式(只是在比较不同变量声明的区别),变量N1声明为数值型时,但在N2及N3的公式中使用,仍可编译通过,并且N2及N3也能输出正确的值。 在此想请教一下 1、下例中,N1变量规范的声明方式,应当是Numeric还是Series<Numeric>? 2、下例中,如果N1变量声明为Numeric是错误的话,请问实际使用当中,会有什么影响? Vars Numeric N1; Numeric N2; Numeric N3; Events OnBar(ArrayRef<Integer> indexs) { N1 = Close; N2 = Average(N1,5); N3 = Highest(N1,5); PlotNumeric("N2",N2); Commentary("N1="+Text(N1)); Commentary("N2="+Text(N2)); Commentary("N3="+Text(N3)); }