以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  求写关于5个周期内最高最低突破的简单策略  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=12790)

--  作者:zdhtc_aidi
--  发布时间:2012/7/5 9:42:48
--  求写关于5个周期内最高最低突破的简单策略

这里以3分钟图表为例

 

开仓条件

 

开盘5个周期后,价格突破前5个周期的最高价,并且5个周期内价格的最高减最低超过10个点,并且5日均线向上,则做多

 

开盘5个周期后,价格突破前5个周期的最低价,并且5个周期内价格的最高减最低超过10个点,并且5日均线向下,则做空

 

平仓条件

 

价格突破前5个周期的最高价,则平掉空单

价格突破前5个周期的最低价,则平掉多单

开盘最后第二个周期全部平仓,并且不再开单

 

要求能在免费版情况下使用

 

请问怎么解决,我是菜鸟,求指教,感激不尽


--  作者:jinzhe
--  发布时间:2012/7/5 9:51:59
--  
如何定义均线向上
--  作者:zdhtc_aidi
--  发布时间:2012/7/5 9:54:00
--  

当前K线的均线值比上一周期的均线值大,就是向上,反之向下


--  作者:jinzhe
--  发布时间:2012/7/5 10:30:19
--  

ma5:ma(c,5);
n1:=barslast(date<>ref(date,1))+1;
timet:= time>090300 and time<145700;
cond1:=c>ref(hhv(h,5),1) ;

cond2:=c<ref(llv(l,5),1);
cond3:=c>ref(hhv(h,5),1) and ref(hhv(h,5),1)-ref(llv(l,5),1)>=10*mindiff and ma5>ref(ma5,1);
cond4:=c<ref(llv(l,5),1) and ref(hhv(h,5),1)-ref(llv(l,5),1)>=10*mindiff and ma5<ref(ma5,1);
if n1>=5 and timet then begin
 if cond1 then sellshort(holding<0,0,market);
 if cond2 then sell(holding>0,0,market);
 if cond3  then buy(holding=0,1,market);
 if cond4  then buyshort(holding=0,1,market);
end
if time>=145700 and time<=150000 then begin
sell(1,0,market);
sellshort(1,0,market);
end

 


--  作者:zdhtc_aidi
--  发布时间:2012/7/5 15:15:43
--  
多谢高手指点,早上有事出去了,我马上测下