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


金字塔客服中心 - 专业程序化交易软件提供商金字塔软件公式模型编写问题提交 → 请教开仓问题

   

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


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

主题:请教开仓问题

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


加好友 发短信
等级:新手上路 帖子:15 积分:13 威望:0 精华:0 注册:2012/8/10 16:49:50
请教开仓问题  发帖心情 Post By:2013/8/2 15:30:40    Post IP:218.66.82.77[只看该作者]

RSI:=ref(SMA(MAX(CLOSE-REF(CLOSE,1),0),N1,1)/SMA(ABS(CLOSE-REF(CLOSE,1)),N1,1)*100,1);
UP:=ref(hhv(h,20),1);
LD:=ref(llv(l,20),1);

开多条件:=H>UP AND RSI<80;

开空条件:=L<LD AND RSI>20;

 

我的思路是价格突破20天高点时并且RSI值小于80开仓,如果大于80,则这个交易到下一个空单之前不开多单,但上面这种写法是一旦RSI回到80一下,就会开多但,这个是我不想要的,请高手指点!


 回到顶部
帅哥哟,离线,有人找我吗?
jinzhe
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:罗宾汉 帖子:46311 积分:50819 威望:0 精华:2 注册:2011/3/23 8:50:25
  发帖心情 Post By:2013/8/2 15:35:14    Post IP:58.246.57.26[只看该作者]

把原来的代码都贴出来



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

客户服务部

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

您的宝贵建议或者投诉,请发往邮箱:weiwei@weistock.com

 回到顶部
帅哥哟,离线,有人找我吗?
he3617
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:新手上路 帖子:15 积分:13 威望:0 精华:0 注册:2012/8/10 16:49:50
  发帖心情 Post By:2013/8/2 15:41:43    Post IP:218.66.82.77[只看该作者]

input:lots(1,0,9,1);
input:n(4,0,9,1);
input:n1(0.002,0.001,1,0.001);
input:M(30,0,50,1);
VARIABLE:maxprofit=0;
win:=0;
win2:=0;
cc:=ref(c,1);
cyc:=barslast(date>ref(date,1))+1;
今高:=HHV(H,cyc);
今低:=llv(l,cyc);
BF:=ref(今高-今低,1);
今开:=if(cyc=1,open,ref(open,cyc-1));
昨收:="RXMA.ZC#DAY";
昨高:="RXMA.ZH#DAY";
昨低:="RXMA.ZL#DAY";
10日平均波幅:="RXMA.MA10#DAY";
RSI:=ref(SMA(MAX(CLOSE-REF(CLOSE,1),0),N1,1)/SMA(ABS(CLOSE-REF(CLOSE,1)),N1,1)*100,1);
UP:=ref(hhv(h,20),1);
LD:=ref(llv(l,20),1);
if time>=091600 and time<150500  then begin
 
  if holding=0 then begin
 
    if h>=up and RIS<80 then begin
      buy(holding=0,lots,limitr,max(open,up));
      maxprofit:=0;
  
    end
   
    if l<=ld AND RIS>20 then begin
      buyshort(holding=0,lots,limitr,min(open,ld));
      maxprofit:=0;
     
    end
  end
end
 if holding>0 and enterbars>0 then begin
    win:=c-enterprice;
    if win>maxprofit then
     maxprofit:=win;
     win2:=(maxprofit-win)/maxprofit*100;
   end
     if holding>0 and enterbars>0 then begin
   多止损:sell(win<=-10,lots,LIMITR,c);
   多止盈:sell(maxprofit>20 and win2>=60 and openprofit>0,lots,limitr,c);
  end

  if holding<0 and enterbars>0 then begin
    win:=enterprice-c;
    if win>maxprofit then
    maxprofit:=win;
    win2:=(maxprofit-win)/maxprofit*100;
  end
  if holding<0 and enterbars>0 then begin
    空止损:sellshort(win<=-10,lots,limitr,c);;
    空止盈:sellshort(maxprofit>20 and win2>=60 and openprofit>0,lots,limitr,c);
   end  

     
if holding<0 then begin
   if h>=up then begin
   sellshort(holding<0,0,limitr,max(open,up));
  end
   if time>=151400 then begin
    sellshort(1,lots,thisclose);
    
  end
 end
if holding>0 then begin
  if l<=ld then begin
   sell(holding>0,0,limitr,min(open,ld));
  end
  if time>=151400 then begin
    sell(1,lots,thisclose);
   
  end
 end

这是源码,有其他不妥的地方也请高手指点!


 回到顶部
帅哥哟,离线,有人找我吗?
he3617
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:新手上路 帖子:15 积分:13 威望:0 精华:0 注册:2012/8/10 16:49:50
  发帖心情 Post By:2013/8/2 15:47:18    Post IP:218.66.82.77[只看该作者]

input:lots(1,0,9,1);
input:n(4,0,9,1);
input:n1(0.002,0.001,1,0.001);
input:M(30,0,50,1);
VARIABLE:maxprofit=0;
win:=0;
win2:=0;

RSI:=ref(SMA(MAX(CLOSE-REF(CLOSE,1),0),N1,1)/SMA(ABS(CLOSE-REF(CLOSE,1)),N1,1)*100,1);
UP:=ref(hhv(h,20),1);
LD:=ref(llv(l,20),1);
if time>=091600 and time<150500  then begin
 
  if holding=0 then begin
 
    if h>=up and Rsi<80 then begin
      buy(holding=0,lots,limitr,max(open,up));
      maxprofit:=0;
  
    end
   
    if l<=ld AND Rsi>20 then begin
      buyshort(holding=0,lots,limitr,min(open,ld));
      maxprofit:=0;
     
    end
  end
end
 if holding>0 and enterbars>0 then begin
    win:=c-enterprice;
    if win>maxprofit then
     maxprofit:=win;
     win2:=(maxprofit-win)/maxprofit*100;
   end
     if holding>0 and enterbars>0 then begin
   多止损:sell(win<=-10,lots,LIMITR,c);
   多止盈:sell(maxprofit>20 and win2>=60 and openprofit>0,lots,limitr,c);
  end

  if holding<0 and enterbars>0 then begin
    win:=enterprice-c;
    if win>maxprofit then
    maxprofit:=win;
    win2:=(maxprofit-win)/maxprofit*100;
  end
  if holding<0 and enterbars>0 then begin
    空止损:sellshort(win<=-10,lots,limitr,c);;
    空止盈:sellshort(maxprofit>20 and win2>=60 and openprofit>0,lots,limitr,c);
   end  

     
if holding<0 then begin
   if h>=up then begin
   sellshort(holding<0,0,limitr,max(open,up));
  end
   if time>=151400 then begin
    sellshort(1,lots,thisclose);
    
  end
 end
if holding>0 then begin
  if l<=ld then begin
   sell(holding>0,0,limitr,min(open,ld));
  end
  if time>=151400 then begin
    sell(1,lots,thisclose);
   
  end
 end


 回到顶部
帅哥哟,离线,有人找我吗?
jinzhe
  5楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:罗宾汉 帖子:46311 积分:50819 威望:0 精华:2 注册:2011/3/23 8:50:25
  发帖心情 Post By:2013/8/2 16:01:29    Post IP:58.246.57.26[只看该作者]

给你在开平仓那里做个限定

 

variable:n=0,m=0;

if n=0 and 其他开多条件 then begin

buy;

n:=1;

m:=0;

end

 

if m=0 and 其他开空条件 then begin

buyshort;

m:=1;

n:=0;

end



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

客户服务部

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

您的宝贵建议或者投诉,请发往邮箱:weiwei@weistock.com

 回到顶部
帅哥哟,离线,有人找我吗?
he3617
  6楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:新手上路 帖子:15 积分:13 威望:0 精华:0 注册:2012/8/10 16:49:50
  发帖心情 Post By:2013/8/2 16:55:29    Post IP:218.66.82.77[只看该作者]

谢谢


 回到顶部