(Highest(High,Weekday)-Close) > 2* atr20 加了这句 后,策略编译的时候提示 for if else中包含序列函数,可能存在逻辑错误,请问我这样编写会有问题吗?
//空头止盈止损
For i =0 to GetArraySize(idl)-1
{
atr20 = AvgTrueRange(20);
If (Data[idl[i]].MarketPosition == -1 and Close > EntryPrice*1.03 And BarsSinceEntry > 0) //亏3%止损
{
Data[idl[i]].BuyToCover(0,Close);
}
If (Data[idl[i]].MarketPosition == -1 and (close - Lowest(Low,Weekday)) > 2* atr20 And BarsSinceEntry > 0) //回撤2倍atr20出
{
Data[idl[i]].BuyToCover(0,Close);
}
}
highest lowest等函数建议在if外部计算完成,通过变量使用