n:=rand(2);
if n=1 then
BUY(n=1,手数,MARKET);
if BARSLAST(n=1)=3 and
DYNAINFO(211)<= CLOSE then SELL(DYNAINFO(211)<= CLOSE,手数,MARKET);
ElseIF BARSLAST(n=1)>3
and REF(CLOSE,3)> CLOSE then SELL(REF(CLOSE,3)> CLOSE,手数,MARKET);
End
请找出这个语句的毛病,如何修改
n:=rand(2);
len:BARSLAST(n=1);
ref_c:REF(CLOSE,3);
if n=1 then
begin
BUY(n=1,手数,MARKET);
if len=3 and DYNAINFO(211)<= CLOSE
then
SELL(DYNAINFO(211)<= CLOSE,手数,MARKET);
else IF len>3 and ref_c> CLOSE then SELL(ref_c>CLOSE,手数,MARKET);
end
ref,BARSLAST 此类函数不能用在if下面,必须先计算好,然后在if下面调用。DYNAINFO(211)这种动态函数也是不能用在图表上的,会对历史信号代码很大的不利影响。