以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  [求助]持仓与反手,急~~  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=8610)

--  作者:msy0985
--  发布时间:2011/10/25 21:41:32
--  [求助]持仓与反手,急~~

if holding>0 and (ek2) then begin
  sell(1,holding,limitr,c),ORDERQUEUE;
  buyshort(1 and time>091000,ss,limitr,c),ORDERQUEUE;
end

if holding<0 and (ed2) then begin
  sellshort(1,holding,limitr,c),ORDERQUEUE;
  buy(1 and time>091000,ss,limitr,c),ORDERQUEUE;
end

 

buy(ed1 and holding=0,ss,limitr,c);
buyshort(ek1 and holding=0,ss,limitr,c);

buy((d4) and holding=0,ss,limitr,c);
buyshort((k4) and holding=0,ss,limitr,c);

 

是这样:  当d4 k4持仓 遇到ed2 ek2不反手


--  作者:just
--  发布时间:2011/10/26 9:24:30
--  

不清楚楼主的 D4 K4等条件是什么,所以我自己随意的定义了下,测试结果是有反手的

ek2:=cross (ma(c,5),ma(c,10));
ed2:=cross (ma(c,10),ma(c,5));
ss:=10;
ed1:=c>ref(c,1);
ek1:=c<ref(c,1);
d4:=c>o;
k4:=c<h;

if holding>0 and (ek2) then begin
  sell(1,holding,limitr,c),ORDERQUEUE;
  buyshort(time>091000,ss,limitr,c),ORDERQUEUE;
end

if holding<0 and (ed2) then begin
  sellshort(1,holding,limitr,c),ORDERQUEUE;
  buy(time>091000,ss,limitr,c),ORDERQUEUE;
end

 

 

buy((d4) and holding=0,ss,limitr,c);
buyshort((k4) and holding=0,ss,limitr,c);

[此贴子已经被作者于2011-10-26 9:53:02编辑过]

--  作者:msy0985
--  发布时间:2011/10/26 10:25:37
--  
您误解了,我写的是 我需要得到的答案
--  作者:just
--  发布时间:2011/10/26 10:37:39
--  

 

反手1:=ed1 and time>091000;

反手2:=ek1 and time>091000;

if holding>0 and (ek2) then begin
  sell(1,holding,limitr,c),ORDERQUEUE;
  buyshort(反手1,ss,limitr,c),ORDERQUEUE;
end

if holding<0 and (ed2) then begin
  sellshort(1,holding,limitr,c),ORDERQUEUE;
  buy(反手2,ss,limitr,c),ORDERQUEUE;
end

 

buy(ed1 and holding=0,ss,limitr,c);
buyshort(ek1 and holding=0,ss,limitr,c);

buy((d4) and holding=0,ss,limitr,c);
buyshort((k4) and holding=0,ss,limitr,c);

 

是这样:  当d4 k4持仓 遇到ed2 ek2不反手

 

是这个意思吗?

[此贴子已经被作者于2011-10-26 10:38:28编辑过]