等级: 免费版
- 注册:
- 2023-10-12
- 曾用名:
|
想请老师帮看下为什么在这根k上(也就是光标定位的那根k)不出开多的信号了,按shift+Q调试发现各项条件因子都是正常,但是cond_buy却显示为0,有点疑惑
//申明参数
input:n(1,1,100,1),ss(1,1,100,1),nmin(10,1,100,1),long_co(1,0.001,1.1,0.001),short_co(1,0.001,1.1,0.001);
//技术指标
up_line:ref(hhv(h,n),1)*long_co;
down_line:ref(llv(l,n),1)*short_co;
middle_line:(up_line+down_line)/2;
//交易条件
buytime:=time>opentime(1) and time<closetime(0)-nmin*100;
selltime:=time>=closetime(0)-nmin*100;
//交易主体
cond_buy:=ref(c>up_line and buytime and holding=0,1);
if cond_buy then begin
buy(1,ss,thisclose);
end
if c<middle_line and holding>0 then begin
sell(1,holding,thisclose);
end
cond_buyshort:=ref(c<down_line and buytime and holding=0,1);
if cond_buyshort then begin
buyshort(1,ss,thisclose);
end
if c>middle_line and holding<0 then begin
sellshort(1,holding,thisclose);
end
//收盘平仓
if selltime then begin
sell(holding>0,0,thisclose);
sellshort(holding<0,0,thisclose);
end
持仓:holding,linethick0;
资产:asset,noaxis,linethick0;
可用现金:cash(0),linethick0;
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有帐号?
x
|