界面在tick级别图表上,订阅了1分钟的bar,
我理解图层0就是tick级别,图层1是1分钟级别
在OnBar我获取图层0 tick的数据为什么包含分钟级别的数据,或者有什么办法过滤掉非本图层的数据吗
策略源码如下:
OnInit()
{
SubscribeBarCounts(symbol,1m,80 * 2,0);
//与数据源有关
Range[0:0]
{
}
SetInitCapital(100000); //设置初始资金为10万
SetTradeSide(1);//交易方向:0-普通(默认),1-双向持仓,2-单向多头,3-单向空头,4-空转多头,5-多转空头
PrintClear();
}
//在所有的数据源准备完成后调用,应用在数据源的设置等操作
OnReady()
{
Print(BarCount: + Text(BarCount));
Print(DataCount: + Text(DataCount()));
}
//Bar更新事件函数,参数indexs表示变化的数据源图层ID数组
OnBar(ArrayRef<Integer> indexs)
{
Integer di;
range[0:0]
{
//if(ArrayFind(indexs,di))
//{
////执行操作
//Print(Bar时间: + DateTimeToString(date + Time + Second ) + 图层: + text(di) + 状态: + text(BarExistStatus)) );
//}
Integer ii;
For ii = 0 To GetArraySize(indexs)
{
//if (ii<>0)return;
Print(Bar时间: + DateTimeToString(data[indexs[ii]].date + data[indexs[ii]].Time , true ) + 图层: + text(di) + indexs: + text(ii) + 周期: + Frequency + BarExistStatus: + text(BarExistStatus) ) ;
}
Print(---------------------------------------- ) ;
}
}
好像以下写法可以过滤
Integer di=0;
range[0:0]
{
if(ArrayFind(indexs,di))
{
//执行操作
Print(\"Bar时间: \" + DateTimeToString(data[di].date + data[di].Time , true ) + \" 图层: \" + text(di) + \" indexs: \" + text(di) + \" 周期: \" + Frequency + \" BarExistStatus: \" + text(BarExistStatus) ) ;
}
}