Rss & SiteMap

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

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

标题:[求助]

1楼
kumingtc 发表于:2015/6/1 16:20:23

如何编写代码记住每天最后一个开仓信号的价格,然后第二天根据这个交易。比如当第二天价格高于第一天最后那个信号的价格就开多,低于那个价格就开空!

2楼
jinzhe 发表于:2015/6/1 16:28:32

nn:=todaybar;

t1:=ref(typebar(1,3),nn);

t2:=ref(typebar(1,1),nn);

 

ee1:=ref(ref(enterprice,typebar(1,3)),nn);

ee2:=ref(ref(enterprice,typebar(1,1)),nn);

 

if t1<t2 then ee:=e1;

if t1>t2 then ee:=e2;

ee为所求的价格

 

3楼
kumingtc 发表于:2015/6/1 22:32:58
老师,有两个问题在请教一下!
t1:=ref(typebar(1,3),nn); 这个是最后一个交易信号是做空,那要是最后一个交易信号是做多呢?
2.我是将这个规则用来每日确定开盘后的第一次交易,所以只希望每日开盘后第一次交易按这个规则执行。
谢谢!
4楼
jinzhe 发表于:2015/6/2 9:07:04

1.typebar(1,1)就是做多

2.用全局变量来进行统计,每天第一次就按照这个开仓,收盘时归0

比如

variable:n=0;

 

if n=0 and h>ee and holding=0 then  begin

    开多...;

    n:=n+1;

end

if n=0 and l<ee  and holding=0 then begin

    开空...;

    n:=n+1;

end

 

然后在其他开仓语句里面也加上

 n:=n+1的判断

 

下面这一句放在最后

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

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


Powered By Dvbbs Version 8.3.0
Processed in 0.01563 s, 3 queries.