以文本方式查看主题 - 金字塔客服中心 - 专业程序化交易软件提供商 (http://weistock.com/bbs/index.asp) -- 公式模型编写问题提交 (http://weistock.com/bbs/list.asp?boardid=4) ---- 统计亏损这么写不对求助 (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=100047) |
-- 作者:netfox -- 发布时间:2016/7/4 11:14:52 -- 统计亏损这么写不对求助 以下内容为程序代码:
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次,后面就不交易了。
可是上面怎么看上去不对啊? |
-- 作者:jinzhe -- 发布时间:2016/7/4 11:21:08 -- 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
|
-- 作者:netfox -- 发布时间:2016/7/7 9:27:55 -- 原来这么算,不过我还是遇到问题 由于我平仓条件多,因此我是在 if holding =0 then begin xxxxxxxxxxxx 这样模式写,但是似乎不对啊 if numprofit(1)<0 then n:=n+1;
if numprofit(1)>0 then n:=0; 这2句莫非必须要在所有平仓条件都跟? 而不是检测仓位状况后再执行? |
-- 作者:jinzhe -- 发布时间:2016/7/7 9:30:28 -- 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
这样的是一定要 条件判断+持仓判断 一起的,不然条件满足但是没持仓的也给算进去 和开仓条件没什么关系 |
-- 作者:netfox -- 发布时间:2016/7/7 9:35:53 -- 这就是说我8个平仓方式必须全部跟上这些句子。。。。? |
-- 作者:jinzhe -- 发布时间:2016/7/7 9:38:17 -- 是的,有多少加多少 |