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