統(tǒng)計(jì)虧損這么寫不對(duì)求助 [金字塔]
- 咨詢內(nèi)容:
以下內(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益過大停止運(yùn)行,下月再戰(zhàn)');
6 exit;
7 END;怎么好像它不歸零啊?
我是想每月1號(hào)開始統(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益過大停止運(yùn)行,下月再戰(zhàn)');
exit;
END; - 用戶回復(fù):
原來這么算,不過我還是遇到問題
由于我平倉(cāng)條件多,因此我是在 if holding =0 then begin xxxxxxxxxxxx
這樣模式寫,但是似乎不對(duì)啊if numprofit(1)<0 then n:=n+1;if numprofit(1)>0 then n:=0;
這2句莫非必須要在所有平倉(cāng)條件都跟? 而不是檢測(cè)倉(cāng)位狀況后再執(zhí)行?
- 網(wǎng)友回復(fù):
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)判斷 一起的,不然條件滿足但是沒持倉(cāng)的也給算進(jìn)去
和開倉(cāng)條件沒什么關(guān)系
- 網(wǎng)友回復(fù): 這就是說我8個(gè)平倉(cāng)方式必須全部跟上這些句子。。。。?
有思路,想編寫各種指標(biāo)公式,程序化交易模型,選股公式,預(yù)警公式的朋友
可聯(lián)系技術(shù)人員 QQ: 511411198 進(jìn)行 有償 編寫!(不貴!點(diǎn)擊查看價(jià)格!)
相關(guān)文章
-
沒有相關(guān)內(nèi)容