n:=5;
x:=1;
m:=10;
y:=1;
豆粕:callstock('m05',vtclose,-1);
菜粕:callstock('RM05',vtclose,-1)+500,COLORBROWN,LINEDOT;
T1:=豆粕<菜粕+N;
T2:=豆粕>菜粕-N;
IF STRCMP(STKLABEL,'m05') = 0 and t1 and abs(holding)<m THEN begin
sellshort(1,0,market);
sell(1,0,market);
buy(holding=0,x,market);
end
IF STRCMP(STKLABEL,'m05') = 0 and t2 and abs(holding)<m THEN begin
sellshort(1,0,market);
sell(1,0,market);
buyshort(holding=0,x,market);
end
IF STRCMP(STKLABEL,'rm05') = 0 and t1 and abs(holding)<m THEN begin
sellshort(1,0,market);
sell(1,0,market);
buyshort(holding=0,y,market);
end
IF STRCMP(STKLABEL,'rm05') = 0 and t2 and abs(holding)<m THEN begin
sellshort(1,0,market);
sell(1,0,market);
buy(holding=0,y,market);
end