老师,请教一下,在后台交易中,怎样编写开仓量的控制公式,具体想法是:无论是多开还是空开,均计算一次交易,在n小于3次的情况下,开仓量都为一手,在n小于是5次时,开仓量说2手~~当到最大开仓量时,之后的开仓量均取最大值,同时该函数怎样贯穿整个公式,请老师多多指教
n<=3 开1手
n>3 and n<=5 开2手
n>5 满仓开
ss:=if(n<=3,1,if(n<=5,2,0));
ss为所设定的手数
我是绝对菜鸟,请问是不是如下用法
GLOBALVARIABLE:n=0;
ss:=if(n<=3,1,if(n<=5,2,0));
if DYNAINFO(28)=75500 and tholding>0 then
begin
tsell(1,0,lmt,75600);
tbuyshort(1,n,lmt,75610);
end
if DYNAINFO(28)=75500 and tholding>0 then
begin
tsell(1,0,lmt,75600);
tbuyshort(1,n,lmt,75610);
end
GLOBALVARIABLE:n=0,tt=0;
ss:=if(n<=3,1,if(n<=5,2,0));
if DYNAINFO(28)=75500 and tholding<0 and tt<>time then
begin
tsellshort(1,0,lmt,75600);
tbuy(1,ss,lmt,75610);
tt:=time;
n:=n+1;
end
if DYNAINFO(28)=75500 and tholding>0 and tt<>time then
begin
tsell(1,0,lmt,75600);
tbuyshort(1,ss,lmt,75610);
tt:=time;
n:=n+1;
end
[此贴子已经被作者于2015/10/16 13:15:54编辑过]