以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  浮盈加仓  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=139628)

--  作者:qq代人发帖
--  发布时间:2016/9/14 16:40:24
--  浮盈加仓

1、程序里写入满足条件浮盈加仓,但是如何设置加仓的次数

 

 

 

2、请问 每次收盘前30分钟 不开仓 怎么写


--  作者:jinzhe
--  发布时间:2016/9/14 16:46:18
--  

1比如你要加仓3次

variable:n=0;

//定义全局变量,用来计算加仓次数

if n<3 and 加仓条件  and 持仓判断 then begin

    加仓语句;

    n:=n+1;

end

//加仓语句

if time=closetime(0) then n:=0;

//最后收盘时重置变量为0

if

2

(1)首先是要在开仓条件加入一个时间条件

  tt:=time0<timetot0(closetime(0))-60*30;限定开仓在收盘前30分钟

(2)然后写收盘平仓代码

 if time0>=timetot0(closetime(0))-60*30 then begin

  sell(1,0,market);

  sellshort(1,0,market);

 end