怎么获取上次金叉的bar???
比如:我现在有10均线和20均线,怎么获取上次金叉的位置(距离当前最新bar的根数)??? 类似LowestBar ()这种的
比如:我现在有10均线和20均线,怎么获取上次金叉的位置(距离当前最新bar的根数)??? 类似LowestBar ()这种的
用nthcon就可以,大致如下: Numeric ma1 = AverageFC(Close,10); Numeric ma2 = AverageFC(Close,20); bool cond1 = CrossOver(ma1,ma2); Integer barOffset = nthcon(cond1,1); Commentary("barOffset="+Text(barOffset)); 具体变量应该如何定义根据策略需要再修改。
回复:非常感谢!