Rss & SiteMap

金字塔客服中心 - 专业程序化交易软件提供商 http://www.weistock.com/bbs/

专业程序化软件提供商
共6 条记录, 每页显示 10 条, 页签: [1]
[浏览完整版]

标题:条件执行一次

1楼
c100011689 发表于:2017/6/5 15:28:49
在开仓后,close>enterprice+10时加仓,可系统会一直在条件满足时加仓,我的想法是条件满足时,只执行一次就可以了,请问该怎么弄呢
2楼
gxx978 发表于:2017/6/5 15:50:50
可以使用函数barslast,满足条件后多久内不再加仓。或使用全局变量,标记加仓次数。
3楼
qq代人发帖 发表于:2017/6/5 15:51:17

可以做一个全局变量的控制,

variable:cond=1;

....

if cond and close>enterprice+10 then

begin

加仓语句;

cond:=0;

end

....

....

 

if time=closetime(0)then cond:=1;//到时间重置下全局变量

4楼
c100011689 发表于:2017/6/5 15:51:53
ok,谢谢,我试试
5楼
c100011689 发表于:2017/6/5 15:55:16
请问,if cond and close>enterprice+10 then,这句里用写cond=1吗
6楼
qq代人发帖 发表于:2017/6/5 15:56:34
以下是引用c100011689在2017/6/5 15:55:16的发言:
请问,if cond and close>enterprice+10 then,这句里用写cond=1吗

这个不需要,就这样OK的。

共6 条记录, 每页显示 10 条, 页签: [1]


Powered By Dvbbs Version 8.3.0
Processed in 0.04639 s, 2 queries.