等级: 专业版
- 注册:
- 2022-8-5
- 曾用名:
|
楼主 |
发表于 2022-12-22 09:40
|
显示全部楼层
老师这是我又调整过的代码,麻烦您帮忙看下对于下单的描述是哪里有问题,怎么就不下单委托呢
//1买入
if open>ref(close,1)*1.01 and open<ref(close,1)*1.04 and CURRENTTIME>092500 and currenttime<093000 then tbuy(1,10%,lmt,DYNAINFO( 51)),PERTRADER;
//另一种买入
if open>ref(close,1)*1.0401 and open<ref(close,1)*1.07 and CURRENTTIME>092500 and currenttime<093000 then tbuy(1,5%,lmt,DYNAINFO( 51)),PERTRADER;
if open>ref(close,1)*1.0401 and open<ref(close,1)*1.07 and CURRENTTIME>092500 and currenttime<093000 then tbuy(1,5%,mkt),PERTRADER;
//第三种买入
if open>ref(close,1)*1.0701 and CURRENTTIME>092500 and currenttime<093000 then tbuy(1,3%,lmt,DYNAINFO( 51)),PERTRADER;
if open>ref(close,1)*1.0701 and CURRENTTIME>092500 and currenttime<093000 then tbuy(1,4%,mkt),PERTRADER;
//用来标记是否执行过撤单
GLOBALVARIABLE:flag=0;
if CURRENTTIME>091000 and currenttime<092000 then flag:=0;
if TSUBMITEX( 1,'' ,'' )>5 and CURRENTTIME>092000 and currenttime<092500 then
begin
TCANCEL(1,1);
flag:=1;
end
//自动全部撤单,然后以9点30分开盘按卖2价格买入,买入仓位10%
if flag=1 and CURRENTTIME>093000 and currenttime<093100 then
begin
tbuy(1,10%,lmt,DYNAINFO( 35)),PERTRADER;
flag:=0;
end
//10点全部撤单
if CURRENTTIME>100000 then
begin
TCANCEL(1,1);
END
//卖出
GLOBALVARIABLE:flag2=0;
if tbuyholding(1)=0 then flag2:=0;
if currenttime>091000 and currenttime<093000 and flag2=1 then flag2:=2;
//持仓票高开卖出持仓25%
if open>ref(close,1)*1.025 then
begin
tsell(1,25%,mkt),PERTRADER;
end
//IF涨停卖出现有仓位30%
if close = DYNAINFO( 54) then
begin
flag2:=1;
tsell(1,30%,mkt),PERTRADER;
end
//剩余仓位在下一个交易日,开盘低于6%现价卖出现有仓位50%,2点50不涨停清仓,涨停继续持仓,后续交易日保持低于6%卖出50%,不涨停清仓滚动执行
if flag2=2 and open<ref(close,1)*(1-6/100) then tsell(1,50%,mkt),PERTRADER;
if flag2=2 and currenttime>145000 and currenttime<150000 and close<DYNAINFO( 54) then tsell(1,100%,mkt),PERTRADER;
//高开的情况下,现价低于上一日收盘价直接现价的买2价格清仓
//低开超过7%现价清仓,0.5%— -7%之间,开盘出50%仓位,9点40低于上一日收盘价,清仓
if open>ref(close,1)*1.01 and close<ref(close,1) then tsell(1,100%,lmt,DYNAINFO( 29)),PERTRADER;
if open<ref(close,1)*(1-7/100) and close<ref(close,1) then tsell(1,100%,mkt),PERTRADER;
if open>ref(close,1)*(1-7/100) and open<ref(close,1)*(1-0.5/100) then tsell(1,50%,mkt),PERTRADER;
if currenttime>094000 and currenttime<09450000 and close<ref(close,1) then tsell(1,100%,mkt),PERTRADER;
//9点40后,现价下穿均线,现价的买2价格清仓
//11点15后,现价低于均价,现价的买2价格清
if currenttime>094000 and cross(ma(close,5),close) then tsell(1,100%,lmt,DYNAINFO( 29)),PERTRADER;
if currenttime>111500 and close<ma(close,5) then tsell(1,100%,lmt,DYNAINFO( 29)),PERTRADER; |
|