以文本方式查看主题 - 金字塔客服中心 - 专业程序化交易软件提供商 (http://weistock.com/bbs/index.asp) -- 公式模型编写问题提交 (http://weistock.com/bbs/list.asp?boardid=4) ---- [求助]连亏之后限损 (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=59426) |
-- 作者:skylands -- 发布时间:2013/12/2 12:33:19 -- [求助]连亏之后限损 求教如何表达: 日内连亏N次之后,平仓离场,当日不再交易;次日重新遵循原系统开始。
|
-- 作者:jinzhe -- 发布时间:2013/12/2 13:15:48 -- varaible:n=0; if numprofit(1)<0 and numprofit(2)<0 and ref(平多条件,1) and ref(holding>0,1) and holding<=0 then begin n:=N+1; end
if numprofit(1)<0 and numprofit(2)<0 and ref(平空条件,1) and ref(holding<0,1) and holding>=0 then begin n:=N+1; end
if time=closetime(0) then n:=0; if n>=既定的连亏次数 then exit;
|
-- 作者:skylands -- 发布时间:2013/12/2 14:07:38 -- 我好好消化一下,多谢先…… |
-- 作者:skylands -- 发布时间:2013/12/2 14:29:29 -- 能不能请你用文字解释一下……那么多个and连接起来后我有点云山雾绕的……资质愚钝,拜托! |
-- 作者:jinzhe -- 发布时间:2013/12/2 14:32:26 -- if numprofit(1)<0 and numprofit(2)<0 and ref(平多条件,1) and ref(holding>0,1) and holding<=0 then begin
numprofit(1)<0 and numprofit(2)<0判断连亏 ref(平多条件,1) and ref(holding>0,1) and holding<=0判断上根k线是否平仓
连亏+平仓,都满足之后,才能记录连亏的次数
|
-- 作者:skylands -- 发布时间:2013/12/2 15:21:26 -- 5楼仁兄能否详细解释一下你的解决方案……好像你这里numprofit并不能看出是盈是亏的判断? |
-- 作者:jinzhe -- 发布时间:2013/12/2 15:23:54 --
[此贴子已经被作者于2013/12/2 15:24:25编辑过]
|
-- 作者:skylands -- 发布时间:2013/12/2 15:25:38 -- jinzhe: 我是要将其嵌入一个“平仓即反手”的系统中的。你这里关于仓位判断的部分要怎么改? |
-- 作者:jinzhe -- 发布时间:2013/12/2 15:27:35 -- 写在你的那个系统后面 |
-- 作者:jinzhe -- 发布时间:2013/12/2 15:33:36 -- 想了一下,你的连亏应该是要这个
varaible:m=0; if numprofit(1)<0 and numprofit(2)<0 and ........numprofit(n)<0 then begin m:=1; end
if time=closetime(0) then m:=0; if m:=1 then exit; |