欢迎使用金字塔普通技术服务论坛,您可以在相关区域发表技术支持贴。
我司技术服务人员将优先处理 VIP客服论坛 服务贴,普通区问题处理速度慢,请耐心等待。谢谢您对我们的支持与理解。


金字塔客服中心 - 专业程序化交易软件提供商金字塔软件金字塔软件问题提交 → limitr交易函数必须要为系统控制符

   

欢迎使用金字塔普通技术服务论坛,您可以在相关区域发表技术支持贴。
我司技术服务人员将优先处理 VIP客服论坛 服务贴,普通区问题处理速度慢,请耐心等待。谢谢您对我们的支持与理解。    


  共有2224人关注过本帖树形打印复制链接

主题:limitr交易函数必须要为系统控制符

帅哥哟,离线,有人找我吗?
fjasmin
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:新手上路 帖子:5 积分:0 威望:0 精华:0 注册:2013/6/21 16:41:50
limitr交易函数必须要为系统控制符  发帖心情 Post By:2013/7/6 12:12:55 [只看该作者]

 //作者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
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:新手上路 帖子:28 积分:84 威望:0 精华:0 注册:2013/4/30 9:37:50
  发帖心情 Post By: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
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:3534 积分:10003 威望:0 精华:5 注册:2012/5/25 0:00:01
  发帖心情 Post By:2013/7/7 9:08:53 [只看该作者]

  buy(holding=0,limitr,1,h30)
写反了  自己好好看下函数说明
应该是   buy(holding=0,1,limitr,h30)
[此贴子已经被作者于2013/7/7 9:09:15编辑过]


金字塔—专业程序化交易量化投资平台

产品部

-----------------------------------------------------------

欢迎您参加我公司的技术培训,具体培训需求请发邮件到service@weistock.com

您的宝贵建议或者投诉,请发往邮箱:weiwei@weistock.com
 回到顶部
帅哥哟,离线,有人找我吗?
qwer123
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:小飞侠 帖子:1966 积分:0 威望:0 精华:1 注册:2013/6/15 21:56:35
  发帖心情 Post By: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;



 回到顶部