红线上方 开多单。下破平仓 反手做空 50%仓位
绿线下方 开空单。上破平仓 反手做多 50%仓位
if VAR1>REF(VAR1,1) and c>var1 then buy(holding=0,1,thisclose);
if cross(var1,c) then begin
sell(holding>0,50%,thisclose);
buyshort(holding=0,1,thisclose);
end
if VAR1<REF(VAR1,1) and c<var1 then buyshort(holding=0,1,thisclose);
if cross(c,var1) then begin
sellshort(holding<0,50%,thisclose);
buy(holding=0,1,thisclose);
end
在上面那些带面后面加上这些
next 是什么?
PEL的FOR循环是不需要NEXT的