Rss & SiteMap

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

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

标题:帮忙写一个策略

1楼
allen23 发表于:2017/1/5 23:32:26

请问一下

5分钟图上的策略

1、今天开盘价比昨日收盘价低就做空,高就做多;

2、止损止盈都是1个百分点;

3、每天只做一单;

请问怎么编写

谢谢!

2楼
jinzhe 发表于:2017/1/6 8:52:02

variable:bj=0;

 

cc:=ref(close,todaybar);

 

if todaybar=1 and holding=0 and bj=0 and o>cc then begin

   buy(1,1,marketr);

   bj:=1;

end

 

if todaybar=1 and holding=0 and bj=0 and o<cc then begin

   buyshort(1,1,marketr);

   bj:=1;

end

 

if holding>0 and c>enterprice*1.01 and enterbars>0 then sell(1,0,marketr);

 

if holding>0 and c<enterprice*0.99 and enterbars>0 then sell(1,0,marketr);

 

if holding<0 and c>enterprice*1.01 and enterbars>0 then sellshort(1,0,marketr);

 

if holding<0 and c<enterprice*0.99 and enterbars>0 then sellshort(1,0,marketr);

 

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

3楼
allen23 发表于:2017/1/6 13:55:11

谢谢!

问一下, 

buy(1,1,marketr)中,第二个1是表示1手吧?那第一个1什么意思?

4楼
jinzhe 发表于:2017/1/6 14:03:08
表示条件恒成立,因为外面的if写了条件,这里写1是省略写条件
5楼
allen23 发表于:2017/1/6 14:13:57
加入收盘平仓的条件,怎么加?
6楼
jinzhe 发表于:2017/1/6 14:20:56

if time=closetime(0) then begin

   sell(1,0,marketr);

   sellshort(1,0,marketr);

end

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


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