![Rank: 1](static/image/common/star_level1.gif)
等级: 新手上路
- 注册:
- 2021-6-24
- 曾用名:
|
![](static/image/common/ico_lz.png)
楼主 |
发表于 2021-7-2 11:34
|
显示全部楼层
runmode:0;
Globalvariable:hold=drawnull;
MA1:MA(CLOSE,5);
MA2:MA(CLOSE,3);
cc13552719027:=holding;//调用图表模型持仓,这句放在信号稳定的地方,即时下单的,就放图表下单语句的后面,K线走完下单的就放到图表下单语句的前面
SELLSHORT(CROSS(MA1,MA2),1,MARKET);
SELL(CROSS(MA1,MA2),1,MARKET);
BUY(CROSS(MA1,MA2),1,MARKET);
BUYSHORT(CROSS(MA1,MA2),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
cang:=min(xiadan13552719027,abs(hold));
if hold<0 then tsellshort(1,cang,mkt,0,0,'13552719027'),allowrepeat;
cang:=xiadan13552719027+min(hold,0);
debugfile('c:\13552719027.txt',numtostr(hold,0)+' '+numtostr(cc13552719027,0)+' ?? %.0f',cang);
if cang>0 then tbuy(1,cang,mkt,0,0,'13552719027'),allowrepeat;
debugfile('c:\13552719027.txt',numtostr(hold,0)+' '+numtostr(cc13552719027,0)+' ?? %.0f',cang);
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);
debugfile('c:\13552719027.txt',numtostr(hold,0)+' '+numtostr(cc13552719027,0)+' ?? %.0f',cang);
if cang>0 then tbuyshort(1,cang,mkt,0,0,'13552719027'),allowrepeat;
debugfile('c:\13552719027.txt',numtostr(hold,0)+' '+numtostr(cc13552719027,0)+' ?? %.0f',cang);
end
hold:=cc13552719027;
是这个意思吗? |
|