以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  线之上只开多,平多。线之下只开空平空。  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=64934)

--  作者:aim
--  发布时间:2014/5/13 9:38:35
--  线之上只开多,平多。线之下只开空平空。

你好:这是我现在的模型,我想实现开盘价在OEE4之上只开多,平多。在OEE4之下只开空,平空。请详细的帮我写一下公式。谢谢

 

 


图片点击可在新窗口打开查看此主题相关图片如下:7777.jpg
图片点击可在新窗口打开查看

 

 

现在我的开平条件和公式

//开多
   IF   kdtj    THEN
  BEGIN
    sellshort(holding<0,holding, THISCLOSE);//检查是否有空单,若有,市价平掉已有空单
  buy(holding=0,1,THISCLOSE);
 END

 

IF kktj  THEN
  BEGIN
   SELL(holding>0,holding,THISCLOSE);
   BUYSHORT(holding=0,1,THISCLOSE);
END

 


--  作者:jinzhe
--  发布时间:2014/5/13 9:48:02
--  
IF   kdtj   and open>oee4 THEN
  BEGIN
    sellshort(holding<0,holding, THISCLOSE);//检查是否有空单,若有,市价平掉已有空单
  buy(holding=0,1,THISCLOSE);
 END

 

IF kktj   and open<oee4 THEN
  BEGIN
   SELL(holding>0,holding,THISCLOSE);
   BUYSHORT(holding=0,1,THISCLOSE);
END

 



--  作者:aim
--  发布时间:2014/5/13 13:16:38
--  

 

 我想要的开平图形如下,平多后等待下次再开多机会。我要单独定义平仓条件,你看看怎么写?

 



图片点击可在新窗口打开查看此主题相关图片如下:88888.jpg
图片点击可在新窗口打开查看

--  作者:aim
--  发布时间:2014/5/13 13:19:29
--  


图片点击可在新窗口打开查看此主题相关图片如下:1111111.jpg
图片点击可在新窗口打开查看

 

这是您写的公式的图形。谢谢

 


--  作者:jinzhe
--  发布时间:2014/5/13 13:26:07
--  
我是按照你的思路写的,如果k线信号和你想象的信号不一样,那么你再改下自己的思路
--  作者:aim
--  发布时间:2014/5/13 15:26:22
--  

我这样把它分别分开来写你看看可以吗?
//开多条件

kdtj:= L1>ref(L1,60) and gg2 and open >HEE4+10;


//开多
    IF   kdtj    THEN
  BEGIN
    sellshort(holding<0,holding, THISCLOSE);//检查是否有空单,若有,市价平掉已有空单
  buy(holding=0,1,THISCLOSE);
 END
//平多条件

pdtj:= h1<ref(h1,60) AND OO<REF(OO,60)  and  gg2 and OPEN >HEE4;


//平多
    IF   pdtj    THEN
  BEGIN
    sellshort(holding<0,holding, THISCLOSE);//检查是否有空单,若有,市价平掉已有空单
  SELL(holding>0,holding,THISCLOSE);
 END
//开空条件
    kktj:={ h1<ref(h1,60) AND }OO<REF(OO,60)  {and  gg2 and open <LEE4-10};

IF kktj  THEN
  BEGIN
      SELL(holding>0,holding,THISCLOSE);
      BUYSHORT(holding=0,1,THISCLOSE);
 END
//平空条件

pktj:= {L1>ref(L1,60) AND }OO >ref(OO,60) {and gg2 and open<LEE4 };


//平空
    IF   pktj    THEN
  BEGIN
       SELL(holding>0,holding,THISCLOSE); 
    sellshort(holding<0,holding, THISCLOSE);//检查是否有空单,若有,市价平掉已有空单
  
 END


--  作者:aim
--  发布时间:2014/5/13 16:10:36
--  
可以吗?
--  作者:jinzhe
--  发布时间:2014/5/13 16:36:32
--  
如果能实现目的,那么自然可以