请教阿火 下列代码 我想用两个条件得出不同的退出价exitprice 但是都使用同一变量名在随后的sell语句中退出 。测试时第一部分可以止损,
但第二部分使用均线止损满足条件没有平仓信号显示无法平仓 我查看说明好像是跟序列运行模式有关 导致用close赋给变量无效
应该怎么解决。或者是我这样写本身结构就不对
exitprice{初始化}
if 条件1 then
{ exitprice:= stoplossprice }
if 条件2 then
{ if cross(ma(close,60),close) then
exitprice: = close; }
sell(1,exitprice)
看不懂。语法错误 if then 的结构也是错的
金字塔不像开拓者那样使用 { }
不好意思,不是为了写成开拓者那样 ,是像搞清楚 第2部分用均线平仓是没信号的,我觉得是满足条件时得不得exitprice,和说明书里序列运行模式有关,但不知道怎么改写才对
if cond1 then begin
·········语句··········
exitprice:= stoplossprice ;
end
if cond2 then begin
if cross(ma(close,60),close) then
exitprice:= close ;
end
sell(1,exitprice)
cond3:=cross(ma(close,60),close) ;//放if结构外面
if cond2 then begin
if cond3 then
exitprice:= close ;
end