 
等级: 超级版主
- 注册:
- 2021-5-18
- 曾用名:
- gxx978
|
本帖最后由 技术010 于 2022-12-28 10:23 编辑
那就不要用tholding来作为开仓条件的判断了,可以使用全局变量来控制,参考如下结构,例如:
globalvariable:kg=0;
ss:=intpart(20000/(c*multiplier*taccount(41)));
a10:=jdma20>0.62 and jdupper>0 and jdma5>1 and h>upper and (c-ref(c,1))/ref(c,1)*100>=0.08 and (h-ref(c,1))/ref(c,1)*100>=0.12;
a21:=jdma20<=0 and jdma5<=0;
a22:=c<ref(l,tenterbars+1) and l<ma5;
if a10 and kg=0 then begin
tbuy(1 ,ss ,mkt); kg:=1;
end
if c<tenterprice then begin
tsell(a22 ,tbuyholding(1) ,mkt);
kg:=0;
end
if c<tenterprice then begin
tsell(a21 ,tbuyholding(1) ,mkt);
kg:=0;
end
if c>tenterprice then begin
tsell(a21 ,tbuyholding(1) ,mkt);
kg:=0;
end
b10:=jdma20<-0.62 and jdlower<-0 and jdma5<-1 and l<lower and (ref(c,1)-c)/c*100>=0.08 and (ref(c,1)-c)/c*100>=0.12 ;
b21:=jdma20>=0 and jdma5>=0;
b22:=c>ref(h,tenterbars+1) and h>ma5;
if b10 and kg=0 then begin
tbuyshort(1 ,ss ,mkt);
kg:=1;
end
if c>tenterprice then begin
tsellshort(b22 ,tsellholding(1) ,mkt);
kg:=0;
end
if c>tenterprice then begin
tsellshort(b21 ,tsellholding(1) ,mkt);
kg:=0;
end
if c<tenterprice then begin
tsellshort(b21 ,tsellholding(1) ,mkt);
kg:=0;
end
|
|