等级: 免费版
- 注册:
- 2024-5-13
- 曾用名:
|
代码只开一笔,然后平仓在最后的K线。即指定日期开仓,结束日期平仓。怎么修改也一样。找不出原因
手数:=1;
持仓量:=50000;
日多空线:=stkindi('','引用指标.多空线',0,6,0),NOdraw;
日ma10:=stkindi('','引用指标.ma10',0,6,0),Nodraw;
//中间变量
多空线:=50-((100*(hhv(h,周期参数)-c))/(HHV(h,周期参数)-LLv(1,周期参数))),NOAXIS;
//平仓
if holding>0 and 多空线<0 then sell(1,0,LIMITR,c);
if holding<0 and 多空线>0 then sellshort(1,0,LIMITR,c);
//开仓
if ref (OPENINT,1)>持仓量 and holding=0 and 多空线>30 and 日多空线>30 and o>日ma10 then begin
开多:BUY(1,手数,LIMITR,c);//按指令价平仓
end
if ref (OPENINT,1)>持仓量 and holding=0 and 多空线<-30 and 日多空线<-30 and o<日ma10 then begin
开空:BUYSHORT(1,手数,LIMITR,c);
|
|