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