![Rank: 1](static/image/common/star_level1.gif)
等级: 新手上路
- 注册:
- 2021-6-24
- 曾用名:
|
![](static/image/common/ico_lz.png)
楼主 |
发表于 2021-7-1 23:27
|
显示全部楼层
runmode:0;
Globalvariable:hold=drawnull;
cc13552719027:=holding;//???????????????????????????????????????K??????????????????
KD:c>o;
pd:c<o;
Buy(KD,1,MARKET);
sell(pd,1,market);
drawtextex(1,1,800,0,'虚拟持仓为:'+numtostr(cc13552719027,0));//在图表上输出虚拟持仓以便监控
if not(islastbar) or workmode<>1 then exit;
xiadan13552719027:=cc13552719027-hold;
if xiadan13552719027>0.5 then begin//为什么不是xiadan13552719027>1?
cang:=min(xiadan13552719027,abs(hold));
if hold<0 then tsellshort(1,cang,mkt,0,0,'13552719027'),allowrepeat;
cang:=xiadan13552719027+min(hold,0);
if cang>0 then tbuy(1,cang,mkt,0,0,'13552719027'),allowrepeat;
end
if xiadan13552719027<-0.5 then begin
cang:=min(abs(xiadan13552719027),abs(hold));
if hold>0 then tsell(1,cang,mkt,0,0,'13552719027'),allowrepeat;
cang:=abs(xiadan13552719027)-max(hold,0);
if cang>0 then tbuyshort(1,cang,mkt,0,0,'13552719027'),allowrepeat;
end
hold:=cc13552719027;
|
|