以下內(nèi)容為程序代碼:
1 損數(shù):NUMSEQLOSS,NODRAW;
2 限制:=valuewhen(month<>ref(month,1),損數(shù)),NODRAW;
3 if 損數(shù)>3 then
4 BEGIN
5 drawtextex(1,1,500,500,'月?lián)p益過(guò)大停止運(yùn)行,下月再戰(zhàn)');
6 exit;
7 END;
怎么好像它不歸零啊?
我是想每月1號(hào)開(kāi)始統(tǒng)計(jì),如果本月連續(xù)虧損3次,后面就不交易了。
可是上面怎么看上去不對(duì)啊?
vairable:n=0;
if month<>ref(month,1) then n:=0;
if 平倉(cāng)條件 and holding>0 then begein
sell(1,0,market);
if numprofit(1)<0 then n:=n+1;
if numprofit(1)>0 then n:=0;
end
if n>=3 then BEGIN
drawtextex(1,1,500,500,'月?lián)p益過(guò)大停止運(yùn)行,下月再戰(zhàn)');
exit;
END;
if numprofit(1)>0 then n:=0;
這2句莫非必須要在所有平倉(cāng)條件都跟? 而不是檢測(cè)倉(cāng)位狀況后再執(zhí)行?
if 平倉(cāng)條件 and holding>0 then begein
sell(1,0,market);
if numprofit(1)<0 then n:=n+1;
if numprofit(1)>0 then n:=0;
end
這樣的是一定要 條件判斷+持倉(cāng)判斷 一起的,不然條件滿(mǎn)足但是沒(méi)持倉(cāng)的也給算進(jìn)去
和開(kāi)倉(cāng)條件沒(méi)什么關(guān)系