以文本方式查看主题

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

--  作者:猴儿2004
--  发布时间:2013/3/1 13:49:47
--  [原创]

老师;请教1个模型的编写:交易周期15分钟周期,交易手数:2手,每天开仓只一次。交易思路:在每天开盘半小时后,接下来超过前半小时最高价1个点做多,低于前半小时最低价1个点做空。止损都是15个点。盈利脱离开仓价15个点止损就调到开仓价。盈利高过开仓价30点,止盈1手,超过70点止盈另1手,没到止损 止盈价,就以收盘前1分钟的收盘价平仓。谢谢老师!


--  作者:jinzhe
--  发布时间:2013/3/1 14:09:25
--  
请稍等,工作人员处理中
--  作者:猴儿2004
--  发布时间:2013/3/1 14:44:05
--  
谢谢老师,辛苦了!图片点击可在新窗口打开查看
--  作者:jinzhe
--  发布时间:2013/3/1 15:23:58
--  

input:n(2,1,100);
variable:n1=0;//计算次数

zuigao:valuewhen(time<=094500,hhv(h,todaybar));//前半个小时最高价
zuidi:valuewhen(time<=094500,llv(l,todaybar));//前半个小时最高价

if h>zuigao and todaybar>2 and n1=0 and time<151500 then begin
 buy(holding=0,1,market);
 n1:=1;
end

if l<zuidi and todaybar>2 and n1=0 and time<151500 then begin
 buyshort(holding=0,1,market);
 n1:=1;
end

if c-enterprice>=15*mindiff and holding<0 then sellshort(holding<0,0,market);

if enterprice-c>=15*mindiff and holding>0 then sell(holding>0,0,market);//止损

if c-enterprice>=30*mindiff and holding>0 then sell(holding>0,0,market);

if enterprice-c>=30*mindiff and holding<0 then sellshort(holding<0,0,market);//止盈

if time>=151500 then begin
 sell(holding>0,0,market);
 sellshort(holding<0,0,market);
 n1:=0;
end

if datatype<>3 then exit;

 

 

 

1盈利脱离开仓价15个点止损就调到开仓价,这句不懂

2一天只开一手仓,那么70点的二次止盈就没啥用了。


 


--  作者:猴儿2004
--  发布时间:2013/3/1 15:29:30
--  
原则:一天做多或做空空只开一次仓,交易手数:2手。如果做多,高过15点就把止损调到开仓价;如果做空,价格低过15点止损也调到开仓价。如果盈利有30点就先平1手,盈利到70点就平另1手。
--  作者:猴儿2004
--  发布时间:2013/3/1 15:31:08
--  
谢谢老师:不知我表述清楚了吗?
--  作者:猴儿2004
--  发布时间:2013/3/1 16:14:14
--  
请教老师:模型编写完了吗?谢谢!
--  作者:猴儿2004
--  发布时间:2013/3/1 16:32:20
--  
怎么没有回复呀?图片点击可在新窗口打开查看
--  作者:猴儿2004
--  发布时间:2013/3/1 16:39:22
--  
老师:在吗?
--  作者:jinzhe
--  发布时间:2013/3/1 16:59:27
--  

input:n(2,1,100);
variable:n1=0,n2=0;//计算次数
variable:yingli=0;
zuigao:valuewhen(time<=094500,hhv(h,todaybar));//前半个小时最高价
zuidi:valuewhen(time<=094500,llv(l,todaybar));//前半个小时最高价

if h>zuigao and todaybar>2 and n1=0 and time<151500 and holding=0 then begin
 buy(holding=0,1,market);
 yingli:=c-enterprice;
 n1:=1;
end

if c-enterprice>yingli then yingli:=c-enterprice;
if l<zuidi and todaybar>2 and n2=0 and time<151500 and holding=0 then begin
 buyshort(holding=0,1,market);
 n2:=1;
 yingli:=enterprice-c;
end
if enterprice-c>yingli then yingli:=enterprice;

if c-enterprice>=15*mindiff and holding<0 then sellshort(holding<0,0,market);

if enterprice-c>=15*mindiff and holding>0 then sell(holding>0,0,market);//止损

if yingli>15*mindiff and c<enterprice then sell(holding>0,0,market);

if yingli>15*mindiff and c>enterprice then sellshort(holding<0,0,market);//盈利15点后的止损

if c-enterprice>=30*mindiff and holding>0 then sell(holding>0,0,market);

if enterprice-c>=30*mindiff and holding<0 then sellshort(holding<0,0,market);//止盈

if c-enterprice>=70*mindiff and holding>0 then sell(holding>0,0,market);

if enterprice-c>=70*mindiff and holding<0 then sellshort(holding<0,0,market);//二次止盈


if time>=151500 then begin
 sell(holding>0,0,market);
 sellshort(holding<0,0,market);
 n1:=0;
 n2:=0;
end

if datatype<>3 then exit;