之前老师有专门讲到quant3优化了,可以避免同品种跨周期的数据没对齐的问题。
在开发跨品种套利策略时,经常会遇到跨品种同周期的数据不好对齐,特别容易造成信号闪烁,请问有好的解决思路没有,谢谢。
以下跨品种价差,如何数据对齐,不会闪烁呢?
OpenPrice = Data0.Open*D0 - Data1.Open*D1;
ClosePrice = Data0.Close*D0 - Data1.Close*D1;
If(OpenPrice == InvalidNumeric) Return;
If(ClosePrice == InvalidNumeric) Return;
HH = Max(OpenPrice,ClosePrice);
LL = Min(OpenPrice,ClosePrice);
//PlotKline(OpenPrice,Max(ClosePrice,OpenPrice),Min(ClosePrice,OpenPrice),ClosePrice);
If(Data[0].BarExistStatus * Data[1].BarExistStatus != 1) return;
对齐后再做
这个可能会引起新的问题
不要tick做
bar上没问题
跨品种那就真没办法了
因为不同的品种,99.99%,tick是对不齐的
If(Data[0].BarExistStatus * Data[1].BarExistStatus != 1) return; 策略里面有这种强制对齐的代码。用的是1小时周期,确定是会闪烁的。
若把入场出场放到更小周期上,如1分钟,是不是能够规避闪烁呢?
没用的。
这个有可能会引起新的问题。