多个数据源条件下,为什么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里面多次递减了)?这正常吗

当然是运行多次咯,具体是几次看你怎么订阅的多图层了。 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事件的数据更新源,即数据源索引(或者叫图层号也行)。