资产:ASSET,LINETHICK0;
可用现金:CASH(0),LINETHICK0;
持仓:HOLDING,LINETHICK0;
N:=BARSLAST(DATE<>REF(DATE,1))+1;
H1:=VALUEWHEN(TIME=091300,HHV(H,N));
L1:=VALUEWHEN(TIME=091300,LLV(L,N));
bpk:=c>H1 and time>091300 and time<145700;
spk:c<L1 and time>091300 and time<145700;
sellshort(holding<0,holding,0);
buy(bpk and not(type(1)=1),10%,0);
sell(holding>0,holding,0);
buyshort(spk and not(type(3)=1),10%,0);
这个是我日内交易的模型,为什么加载以后图形上仅看到一根绿线,不仅信号看不到图形也没有。是否哪里有问题,谢谢!
你忘设平仓条件了,而且spk:c<L1 and time>091300 and time<145700; 少个=号,造成图形失真
我设为收盘前平仓,加个条件:time>145700
你试试
资产:ASSET,LINETHICK0;
可用现金:CASH(0),LINETHICK0;
持仓:HOLDING,LINETHICK0;
N:=BARSLAST(DATE<>REF(DATE,1))+1;
H1:=VALUEWHEN(TIME=091300,HHV(H,N));
L1:=VALUEWHEN(TIME=091300,LLV(L,N));
bpk:=c>H1 and time>091300 and time<145700;
spk:=c<L1 and time>091300 and time<145700;
sellshort(holding<0 and time>145700,holding,0);
buy(bpk and not(type(1)=1),10%,0);
sell(holding>0 and time>145700,holding,0);
buyshort(spk and not(type(1)=3),10%,0);
你忘设平仓条件了,而且spk:c<L1 and time>091300 and time<145700; 少个=号,造成图形失真
我设为收盘前平仓,加个条件:time>145700
你试试
资产:ASSET,LINETHICK0;
可用现金:CASH(0),LINETHICK0;
持仓:HOLDING,LINETHICK0;
N:=BARSLAST(DATE<>REF(DATE,1))+1;
H1:=VALUEWHEN(TIME=091300,HHV(H,N));
L1:=VALUEWHEN(TIME=091300,LLV(L,N));
bpk:=c>H1 and time>091300 and time<145700;
spk:=c<L1 and time>091300 and time<145700;
sellshort(holding<0 and time>145700,holding,0);
buy(bpk and not(type(1)=1),10%,0);
sell(holding>0 and time>145700,holding,0);
buyshort(spk and not(type(1)=3),10%,0);
谢谢,这个问题我注意到了,图形能显示出来了。你改以后模型发现一个问题,就是平仓条件不匹配了。根据你的修改,一定要在time>145700以后才会平仓。如果我希望实现满足平仓条件就平,同时如果盘中平仓条件不到达,那么在让其当time>145700以后强制平仓,应该如何操作。