多个数据源条件下,为什么onbarclose运行了7次?

   OnBarOpen(ArrayRef<Integer> indexes)

   {

       // 更新时间冷却计数器

       for i = 0 to GetArraySize(timerecord1)-1

       {

           if(timerecord1[i] > 0)

           {

               timerecord1[i] = timerecord1[i] - 1;

           }

       }

   }



OnBarClose(ArrayRef<Integer> indexes)

{

   

print("-----------------");


print(DateTimeToString(date + time)+TextArray(timerecord1));

}

我在onbaropen里为timerecord1这个变量进行递减操作,同时在onbarclose里输出,在订阅了9个数据源的情况下,为什么onbarclose运行了7次呢?看起来onbaropen也运行了多次(timerecord1在同一根bar里面多次递减了)?这正常吗

多数据源条件下,都是1分钟数据源,如何让onbarclose与onbaropen里的代码只运行一次?
onbarclose为什么会在刚开盘执行
多个数据源操作,用range函数,可否奇数数据源和偶数数据源分开?
不同数据源的数据时间起点不同,在多个图层存在的情况下如何判断某个时刻有哪些数据源有数据。
实测数据源策略函数中多个函数持续返回0
【BarCount】在图表加载多个数据源时数据异常
关于 OnBarClose
策略单元中有多个数据源时 分割方式选择的问题
关于提前发单代码及OnBarClose的疑问
关于OnBarClose

当然是运行多次咯,具体是几次看你怎么订阅的多图层了。

https://tbq3.tbquant.net/helper?product_id=991&keyword=440&content_id=2595&selectedkey=3824&type=article

这样订阅,怎么让每分钟的onbaropen和onbarclose只运行一次呢


OnBarClose(ArrayRef<Integer> indexes)

这里面的indexes有什么作用呢


OnBarClose(ArrayRef<Integer> indexes)

这里面的indexes有什么作用呢

indexes是个数组,里面的元素是驱动本次OnBarClose事件的数据更新源,即数据源索引(或者叫图层号也行)。