老师,行号17conditionLongEntry为什么总是无法识别,编译不成功,谢谢

Params

   Numeric Lots(1);          // 固定1手交易

   Numeric BreakThreshold(10); // 突破阈值10元

   Numeric LookBackPeriod(15); // 回溯周期15根K线

   

Vars

   Numeric longEntryPrice;  // 记录多单入场价

   Numeric shortEntryPrice; // 记录空单入场价

   Numeric highestAfterLong; // 多单持仓期间最高收盘价

   Numeric lowestAfterShort; // 空单持仓期间最低收盘价

   Bool conditionLongEntry;

   Bool conditionShortEntry;

   Bool conditionCloseLong;

   Bool conditionCloseShort;


// 开多条件:收盘价 > 15根K线最低收盘价 + 10

conditionLongEntry = Close > LowestFC(Close, LookBackPeriod) + BreakThreshold;


// 开空条件:收盘价 < 15根K线最高收盘价 - 10

conditionShortEntry = Close < HighestFC(Close, LookBackPeriod) - BreakThreshold;


// 多单平仓条件(同时开空):收盘价 < 开多后最高收盘价 - 10

If(MarketPosition == 1)

{

   highestAfterLong = Max(highestAfterLong, Close[1]); // 记录持仓期间最高价

   conditionCloseLong = Close < highestAfterLong - BreakThreshold;

}


// 空单平仓条件(同时开多):收盘价 > 开空后最低收盘价 + 10

If(MarketPosition == -1)

{

   lowestAfterShort = Min(lowestAfterShort, Close[1]); // 记录持仓期间最低价

   conditionCloseShort = Close > lowestAfterShort + BreakThreshold;

}


// 交易执行模块

If(MarketPosition == 0)

{

   If(conditionLongEntry)

   {

       Buy(Lots, Open);

       longEntryPrice = Close;

       highestAfterLong = Close[1]; // 初始化:取开仓前一根K线的收盘价

   }

   Else If(conditionShortEntry)

   {

       SellShort(Lots, Open);

       shortEntryPrice = Close;

       lowestAfterShort = Close[1]; // 初始化:取开仓前一根K线的收盘价

   }

}

Else If(MarketPosition == 1 And conditionCloseLong)

{

   Sell(Lots, Open);      // 平多

   SellShort(Lots, Open);  // 反手开空

   shortEntryPrice = Close;

   lowestAfterShort = Close[1];

}

Else If(MarketPosition == -1 And conditionCloseShort)

{

   BuyToCover(Lots, Open); // 平空

   Buy(Lots, Open);        // 反手开多

   longEntryPrice = Close;

   highestAfterLong = Close[1];

}老师能帮我修改一下吗、谢谢

总是提示错误:无法识别的字符串bar
为什么这段代码总是无法编译通过
CurrentBar 编译时 系统提示无法识别的字符串
各位兄台帮我看看 无法识别的字符串 谢谢
[编译错误提示] 无法识别的字符串DataFrame
无法识别的字符串
无法识别的字符串ArrayRef
无法识别的字符串End
请问编译这个公式时提示这一行“无法识别的字符串if”,如何修改使得可以正常编译。
NumericArray 无法识别么?

格式错了,AI不太给力

随便打开一个系统策略,看下格式

events下,程序主体要写在onbar里面

也就是你上面排除定义变量的语句都要放进onbar