if long and cc<=3 then
begin
buy(holding>= 0 , 45%,thisclose);
cc:=cc+1;
end
if LONGSELL then
begin
sell(holding > 0, 0,thisclose);
cc:=0;
end
用CC变量控制加仓次数,好像不能控制,想知道怎么控制加仓次数
//画出多头的止损线
partline(holding>0,LL,colorred);
LONGSELL:=C<LL;
if LONGSELL then
begin
sell(holding > 0, 0,thisclose);
cc:=0;
end
DRAWnumber(c>0,c*1.001,cc,0);
//建立多头的进场条件
long :=c>upperband and time>N and time<143000 ;
if long and cc<=3 then
begin
buy(holding>= 0 , 45%,thisclose);
cc:=cc+1;
end
//画出空头的止损线
partline(holding<0, HH, colorgreen);
SHORTSELL:=C>HH;
if SHORTSELL then
begin
sellSHORT(holding < 0, 0,thisclose);
dd:=0;
end
DRAWnumber(c>0,c*1.002,dd,0);
//开空条件
short :=c<lowerband and time > N and time <143000;
if short and dd<=3 then
begin
buyshort(holding <= 0 , 45%, thisclose);
dd:=dd+1;
end
好了,开空和开多分别用CC和DD控制就可以了,如果开空和开多都用CC控制,就会出现问题。
都用CC控制的时候,把HOLDING条件提上来也没有问题的。
是我模型中开多的时候,平空条件满足了,把CC赋值0的缘故。