ss:=1; //手数
//variable:myenterbars=0;
maa:ema(c,2);
YC:ema(c,6),PRECIS2,COLOR00FFFF,LINETHICK1;
BU:=CROSS(maa,YC);
SEL:=CROSS(YC,maa);
DRAWTEXT(CROSS(BU,SEL),(L+(O-C)/8),'买'),COLORFF00FF;
DRAWTEXT(CROSS(SEL,BU),(H+(O-C)/8),'卖'),COLORFFFF00;
tt1:=CROSS(maa,yc);
tt2:=CROSS(yc,maa);
//当开始没有持仓
if holding=0 then begin
if tt1 then begin
buy(1,ss,l)
goto continueline;
end
if tt2 then begin
buyshort(1,ss,h);
goto continueline;
end
end
if tt1 and holding<0 and enterbars>=0 then begin
sellshort(1,ss,market);//平空
buy(1,ss,market);//开多
goto continueline;
end
if tt2 and holding>0 and enterbars>=0 then begin
sell(1,ss,market);//平多
buyshort(1,ss,market);//开空
goto continueline;
end
continueline@ 资产:tasset,linethick0;
持仓: holding,NODRAW
请老师帮忙给修改一下;就是一个:金叉做多,死叉做空模型;
buy(1,ss,l)
限价下单
要写成
buy(1,ss,limitr,l);
而且还少了一个分号
手数ss:=2;
//variable:myenterbars=0;
maa:ema(c,2);
YC:ema(c,6),PRECIS2,COLOR00FFFF,LINETHICK1;
BU:=CROSS(maa,YC);
SEL:=CROSS(YC,maa);
DRAWTEXT(CROSS(BU,SEL),(L+(O-C)/8),'买'),COLORFF00FF;
DRAWTEXT(CROSS(SEL,BU),(H+(O-C)/8),'卖'),COLORFFFF00;
tt1:=CROSS(maa,yc);
tt2:=CROSS(yc,maa);
//当开始没有持仓
if holding=0 then begin
if tt1 then begin
buy(1,ss,limitr,l);
goto continueline;
end
if tt2 then begin
buyshort(1,ss,limitr,l);
goto continueline;
end
end
if tt1 and holding<0 and enterbars>=0 then begin
sellshort(1,ss,market);//平空
buy(1,ss,market);//开多
goto continueline;
end
if tt2 and holding>0 and enterbars>=0 then begin
sell(1,ss,market);//平多
buyshort(1,ss,market);//开空
goto continueline;
end
continueline@ 资产:tasset,linethick0;
持仓: holding,NODRAW;
这样就0k了,谢谢!
我上次那个模型有结论了吗?
![]()
| |
![]() 金字塔—专业程序化交易量化投资平台 客户服务部 -----------------------------------------------------------欢迎您参加我公司的技术培训,具体培训需求请发邮件到service@weistock.com 您的宝贵建议或者投诉,请发往邮箱:weiwei@weistock.com |
9月29日的那个模型要求