[PEL] 复制代码 IF 1-TCASH/TASSET<FX/100 THEN
EXIT;
MAXLOSS:=0;
PCL:=0;
THC:=THOLDCOUNT('');
FOR I=1 TO THC DO BEGIN
THL:=THOLDINDEXLABEL(I,'');
THBN:=TBUYHOLDINGEX('',THL,1);
THSN:=TSELLHOLDINGEX('',THL,1);
IF THBN>0 THEN
TBLS:=(DYNAINFO2(7,THL)-TAVGENTERPRICEEX2('','',0))*MULTIPLIER*THBN*TACCOUNT(41);
IF THSN>0 THEN
TSLS:=(TAVGENTERPRICEEX2('','',1)-DYNAINFO2(7,THL))*MULTIPLIER*THBN*TACCOUNT(42);
LOSS:=TBLS+TSLS;
IF LOSS<MAXLOSS THEN BEGIN
MAXLOSS:=LOSS;
PCL:=I;
END;
END;
THL:=THOLDINDEXLABEL(PCL,'');
THBN:=TBUYHOLDINGEX('',THL,1);
THSN:=TSELLHOLDINGEX('',THL,1);
TSELL(THBN>0, 0, LMT, CLOSE-MINDIFF,0,THL);
TSELLSHORT(THSN>0, 0, LMT, CLOSE+MINDIFF,0,THL);
看下这样行不? |