以文本方式查看主题 - 金字塔客服中心 - 专业程序化交易软件提供商 (http://weistock.com/bbs/index.asp) -- 公式模型编写问题提交 (http://weistock.com/bbs/list.asp?boardid=4) ---- 请教怎么实现每小姐达到盈利目标该小节就不再交易 (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=147954) |
-- 作者:a383623133 -- 发布时间:2017/2/20 11:17:53 -- 请教怎么实现每小姐达到盈利目标该小节就不再交易 举个例子:上午盈利达到1000块的话,上午就不再开仓,下午才能允许开仓 |
-- 作者:jinzhe -- 发布时间:2017/2/20 11:26:02 -- 做个标记 variable:bj=0; variable:yl=0; 开仓条件加入bj=0
if 平多条件 and holding>0 then begin sell(1,0,marketr); yl:=yl+numprofit(1); if yl>=1000 then bj:=1; end
if 平空条件 and holding<0 then begin sellshort(1,0,marketr); yl:=yl+numprofit(1); if yl>=1000 then bj:=1; end
if time=closetime(1) then bj:=0; if time=closetime(0) then bj:=0;
|
-- 作者:a383623133 -- 发布时间:2017/2/20 12:28:38 -- 后台程序化的怎么编写? |
-- 作者:jinzhe -- 发布时间:2017/2/20 13:18:58 -- globalvariable:bj=0; globalvariable:yl=0; 开仓条件加入bj=0
if 平多条件 and tholding>0 then begin tsell(1,0,mkt); yl:=yl+numprofit(1); if yl>=1000 then bj:=1; end
if 平空条件 and tholding<0 then begin tsellshort(1,0,mkt); yl:=yl+numprofit(1); if yl>=1000 then bj:=1; end
if time=closetime(1) then bj:=0; if time=closetime(0) then bj:=0;
这样用要走完k线下单,不然会重复累加的迭代 |
-- 作者:a383623133 -- 发布时间:2017/2/20 14:18:26 -- 用间隔1秒模式不行吗? |
-- 作者:jinzhe -- 发布时间:2017/2/20 14:28:18 -- 后台的全局变量和图表的不一样,弄不好就是在同根k线上反复的自我迭代累加,所以用走完k线下单比较好 |