RSV:= (CLOSE-LLV(LOW,N1))/(HHV(HIGH,N1)-LLV(LOW,N1))*100;
K:=SMA(RSV,M1,1);
D:=SMA(K,M2,1);
J:=3*K-2*D;
cond1:=CROSS(K,D);//開多條件
cond2:=CROSS(D,K);//開空條件
tbuy(time=090100,100,lmt,o,0);
tbuyshort(time=090100,100,lmt,o,0);
tsell(cond1,10,mkt);
tsellshort(cond2,10,mkt);
1)若其中有單子沒有成交,撤單并且以市價平掉這筆單子。
2)當(dāng)持倉為0時,在繼續(xù)重復(fù)第一次開多開空同等數(shù)量。繼續(xù)執(zhí)行程序。
這樣編寫對否?
還有后臺使用ORDERQUEUE可以否?
if TISREMAIN(0)>0 then begin
tsell(TCANCEL(1,0),10,mkt);
tsellshort(TCANCEL(1,0),10,mkt);
End
if THOLDING2=0 then begin
tbuy(CURRENTTIME,100,lmt,O,0);
tbuyshort(CURRENTTIME,100,lmt,O,0);
End
tsell(cond1,10,mkt);
tsellshort(cond2,10,mkt);
if CURRENTTIME=145800 then
tsell(1,0,mkt);
tsellshort(1,0,mkt);
1.單子沒成交那你應(yīng)該是撤單而不是平倉啊,你沒成交哪里能夠平單子
if tisremain(0)>0 then
tcancel(1,0);
end
2. orderqueue可以用在后臺
3. 時間判斷時,用time可以用=判斷,可以time=090100;
但是用currenttime,你需要用一個時間段來控制,比如這樣 currenttime>145800 and currenttime<=145900
tsellshort(cond2,10,mkt);
if CURRENTTIME=145800 then
tsell(1,0,mkt);
tsellshort(1,0,mkt);
這樣可以了嗎? 老大