为什么回溯使用[]和ref输出结果不一样

Numeric num1KD=PriceScale*MinMove;

       Commentary("[]:"+text(count(IIF( H <= H[1] + num1KD AND L >= L[1] - num1KD,1,0),CurrentBar+1)));

       Commentary("ref:"+text(count(IIF( H <= ref(H,1) + num1KD AND L >= ref(L,1) - num1KD,1,0),CurrentBar+1)));

       Commentary("#");

       

       Commentary("[]:"+text(count(IIF(  L >= L[1] - num1KD,1,0),CurrentBar+1)));

       Commentary("ref:"+text(count(IIF(  L >= ref(L,1) - num1KD,1,0),CurrentBar+1)));

       Commentary("#");

       

       Commentary("[]:"+text(count(IIF( H <= H[1] + num1KD ,1,0),CurrentBar+1)));

       Commentary("ref:"+text(count(IIF( H <= ref(H,1) + num1KD ,1,0),CurrentBar+1)));

       Commentary("#");

       

       Commentary("[]:"+text(count(IIF(  L >= L[1] ,1,0),CurrentBar+1)));

       Commentary("ref:"+text(count(IIF(  L >= ref(L,1) ,1,0),CurrentBar+1)));

       Commentary("#");

       

       Commentary("[]:"+text(count(IIF( H <= H[1]  ,1,0),CurrentBar+1)));

       Commentary("ref:"+text(count(IIF( H <= ref(H,1)  ,1,0),CurrentBar+1)));

       Commentary("#");

       

       Commentary("[]:"+text(count(IIF( H <= H[1]  AND L >= L[1] ,1,0),CurrentBar+1)));

       Commentary("ref:"+text(count(IIF( H <= ref(H,1)  AND L >= ref(L,1) ,1,0),CurrentBar+1)));

ref是带序列的函数,不要在if里面处理

请问还有哪些函数会遇到相同的问题?易语言所有处理序列数据的函数吗

使用了ref,底层语言会自动生成一个序列变量,所以用在条件语句中会导致无法每次onbar都更新这个序列变量,而沿用了上一个K的数值?