以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://www.weistock.com/bbs/index.asp)
--  金字塔软件问题提交  (http://www.weistock.com/bbs/list.asp?boardid=2)
----  limitr交易函数必须要为系统控制符  (http://www.weistock.com/bbs/dispbbs.asp?boardid=2&id=53680)

--  作者:fjasmin
--  发布时间:2013/7/6 12:12:55
--  limitr交易函数必须要为系统控制符
 //作者FJASMIN
//需要准备的中间变量
h30:=ref(hhv(h,30),1);//引用上个周期三十分钟以来的最高点
l30:=ref(llv(h,30),1);

h20:=ref(hhv(h,20),1);//二十分钟线
l20:=ref(llv(h,20),1);

//进仓的条件

long:=h30>h and time >093000 and time < 145200;//当现在的最高价超越了30分钟之前的最高价,(设置的时间区段是九点30分到下午两点52分为期货交易的高峰期)
if long then
begin
    sellshort(holding,0,holding,limitr,h30) //平掉前三十分钟的仓
    buy(holding=0,limitr,1,h30); //开仓的价格要与30分钟前的价格相同
end

partline (holding >0,h30,colorred);

//建立多头的止损条件

longX:=l<h20 and holding>0;
if longX then
begin
sell(1,0,limitr,h20);
end





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

if short then
begin
    sell(holding,0,0,limitr,h30);//平仓的价格与三十分钟的价格相同
    buyshort(holding = 0,0,limitr,h30);
    
    partline (holding <0,h30,colorgreen);
    
//建立了空头的止损条件    
shortX:=h>h20 and holding<0;

if shortX then begin
sellshort (1,0,limitr,h20);
end

//收盘兼平仓的语句

sell(time > 145500 and holding 0,0,thisclose);//如果我们在手盘的时候还有多单的话,就以最后K线的收盘价平掉
sellshort(time>145500 and holding,0,0,thisclose);//如果我们手中有空单的话在当日交易结束的时候以K线的最后价格平掉
//实现全部清仓的目的?

持仓:holding,linethick0;
资产:asset,noaxis;
可用现金:cash(0),linethick0;


--  作者:a1121648703
--  发布时间:2013/7/6 20:03:44
--  


 //作者FJASMIN
//需要准备的中间变量
h30:=ref(hhv(h,30),1);//引用上个周期三十分钟以来的最高点
l30:=ref(llv(h,30),1);

h20:=ref(hhv(h,20),1);//二十分钟线
l20:=ref(llv(h,20),1);

//进仓的条件

long:=h30>h and time >093000 and time < 145200;//当现在的最高价超越了30分钟之前的最高价,(设置的时间区段是九点30分到下午两点52分为期货交易的高峰期)
if long then
begin
    sellshort(holding<0,holding,limitr,h30) ;//平掉前三十分钟的仓
    buy(holding=0,1,limitr,h30); //开仓的价格要与30分钟前的价格相同
end

partline (holding >0,h30,colorred);

//建立多头的止损条件

longX:=l<h20 and holding>0;
if longX then
begin
sell(1,0,limitr,h20);
end

 

 

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

if short then
begin
    sell(holding>0,holding,limitr,h30);//平仓的价格与三十分钟的价格相同
    buyshort(holding = 0,1,limitr,h30);
    end
   
    partline (holding <0,h30,colorgreen);
   
//建立了空头的止损条件   
shortX:=h>h20 and holding<0;

if shortX then begin
sellshort (1,0,limitr,h20);
end

//收盘兼平仓的语句

sell(time > 145500 and holding >0,0,thisclose);//如果我们在手盘的时候还有多单的话,就以最后K线的收盘价平掉
sellshort(time>145500 and holding<0,0,thisclose);//如果我们手中有空单的话在当日交易结束的时候以K线的最后价格平掉
//实现全部清仓的目的?

持仓:holding,linethick0;
资产:asset,noaxis;
可用现金:cash(0),linethick0;

 

 
 

你这个指标不可用效率太低
--  作者:RogarZ
--  发布时间:2013/7/7 9:08:53
--  
  buy(holding=0,limitr,1,h30)
写反了  自己好好看下函数说明
应该是   buy(holding=0,1,limitr,h30)
[此贴子已经被作者于2013/7/7 9:09:15编辑过]

--  作者:qwer123
--  发布时间:2013/7/7 9:35:27
--  
思路没有问题,中间有点错误,如果是我我会这样写这个策略


    //表头-------必要的说明
//作者FJASMIN
//需要准备的中间变量
h30:=ref(hhv(h,30),1);//引用上个周期三十分钟以来的最高点
l30:=ref(llv(l,30),1);

h20:=ref(hhv(h,20),1);//二十分钟线
l20:=ref(llv(l,20),1);

hd:=if(islastbar,5,0.6);//触发价发单的滑点,
hd1:=if(islastbar,5,0.2);//一根k线走完的滑点,这样在交易费的地方只要填写实际的交易费率。

p1:=time>093000 and time<145200;

//进仓的条件

if h>=h30 and p1 then {这样检查比较方便}
begin 
    sellshort(holding<0,0,limitr,h30+hd) //平掉前三十分钟的仓
    buy(holding=0,1,limitr,h30+hd); //开仓的价格要与30分钟前的价格相同
end

//建立多头的止损条件

if l<=h20 and holding>0 then sell(1,0,limitr,h20-hd);

//j建立空头进场的条件
if l<=l30 and p1 then 
begin 
    sell(holding>0,0,limitr,h30-hd);//平仓的价格与三十分钟的价格相同
    buyshort(holding=0,0,limitr,h30-hd);
    end
    
//建立了空头的止损条件    
if h>=l20 and holding<0 then sellshort (1,0,limitr,l20+hd);

//收盘兼平仓的语句
if time>145457 then {时间比k线结束提前3秒}
begin
sell(1,0,limitr,c-hd1);
sellshort(1,0,limitr,c+hd1);
end

partline (holding >0,h30,colorred); 
partline (holding <0,l30,colorgreen); 

持仓:holding,linethick0;
资产:asset,noaxis;
可用现金:cash(0),linethick0;