以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  【求助】如何解决平仓后当前周期不再开仓的问题?  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=427)

--  作者:toby907
--  发布时间:2009/12/9 21:56:37
--  【求助】如何解决平仓后当前周期不再开仓的问题?


 

 

我的公式

BUY((CLOSE>HHV(REF(HIGH,1),20) AND HOLDING<N AND TIME<=145900),N,THISCLOSE);
TBUY((CLOSE>HHV(REF(HIGH,1),20) AND THOLDING<N AND TIME<=145900),N,MKT);

 

SELL((CLOSE<LLV(REF(LOW,1),10)  OR CLOSE>=(ENTERPRICE+10) OR CLOSE<=(ENTERPRICE-5)),N,THISCLOSE);
TSELL((CLOSE<LLV(REF(LOW,1),10)  OR CLOSE>=(ENTERPRICE+10) OR CLOSE<=(ENTERPRICE-5)),N,MKT);

 

N=1


 

我用3秒刷新,在刷新时平的仓,可是过了不久刷新的时候又会开仓。。。

 

 

针对我的公式。如何解决平仓后当前周期不再开仓的问题?

 

谢谢

[此贴子已经被作者于2009-12-9 22:05:48编辑过]

--  作者:Likai
--  发布时间:2009/12/9 22:22:06
--  

参考如下的写法,请尽量遵循这个模版。

 视频讲座里面也有例子

 

//《30 分钟的日内翻转系统》
//适用于1分钟图表
//Designed by LIKAI
//QQ=475049

 

//准备需要的中间变量
h30:= ref(hhv(h,30),1);
l30:=ref(llv(l,30),1);

//建立多头的进场的条件
Long:= h>h30 and time>093000 and time < 145200 ;

if Long then
 begin
 sellshort(holding<0, holding, limitr, h30) ;
 buy(holding=0, 1, limitr, h30) ;
 end

//画出多头的止损线
partline(holding>0, l30, colorred) ;


//建立空头的进场条件
Short:= l<l30 and time>093000 and time < 145200 ;

if Short then
 begin
 sell(holding>0, 0, limitr, l30) ;
 buyshort(holding=0, 1, limitr, l30) ;
 end

//画出空头的止损线
partline(holding<0, h30, colorgreen);

//收盘前平仓
sell(time>145500 and holding>0, 0, thisclose) ;
sellshort(time>145500 and holding<0,0,thisclose) ;

资产:ASSET,LINETHICK0;
可用现金:CASH(0),LINETHICK0;
持仓:HOLDING,LINETHICK0;

[此贴子已经被作者于2009-12-10 10:07:43编辑过]

--  作者:toby907
--  发布时间:2009/12/9 22:25:19
--  
THANK YOU
--  作者:admin
--  发布时间:2009/12/10 15:57:26
--  

TBUY((CLOSE>HHV(REF(HIGH,1),20) AND THOLDING<N AND TIME<=145900 AND TEXITBARS > 0),N,MKT);

增加上次平仓历时的判断即可解决同周期平仓后不再开仓的问题。


--  作者:toby907
--  发布时间:2009/12/10 18:13:10
--  

OK..明天试试 希望能行


--  作者:wzywzy292
--  发布时间:2009/12/10 19:20:36
--  
以下是引用Likai在2009-12-9 22:22:06的发言:

参考如下的写法,请尽量遵循这个模版。

 视频讲座里面也有例子

 

//《30 分钟的日内翻转系统》
//适用于1分钟图表
//Designed by LIKAI
//QQ=475049

 

//准备需要的中间变量
h30:= ref(hhv(h,30),1);
l30:=ref(llv(l,30),1);

//建立多头的进场的条件
Long:= h>h30 and time>093000 and time < 145200 ;

if Long then
 begin
 sellshort(holding<0, holding, limitr, h30) ;
 buy(holding=0, 1, limitr, h30) ;
 end

//画出多头的止损线
partline(holding>0, l30, colorred) ;


//建立空头的进场条件
Short:= l<l30 and time>093000 and time < 145200 ;

if Short then
 begin
 sell(holding>0, 0, limitr, l30) ;
 buyshort(holding=0, 1, limitr, l30) ;
 end

//画出空头的止损线
partline(holding<0, h30, colorgreen);

//收盘前平仓
sell(time>145500 and holding>0, 0, thisclose) ;
sellshort(time>145500 and holding<0,0,thisclose) ;

资产:ASSET,LINETHICK0;
可用现金:CASH(0),LINETHICK0;
持仓:HOLDING,LINETHICK0;

[此贴子已经被作者于2009-12-10 10:07:43编辑过]

学习了,谢谢!!!
--  作者:蔡宛宏
--  发布时间:2012/1/20 12:56:33
--  
图片点击可在新窗口打开查看