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


金字塔客服中心 - 专业程序化交易软件提供商金字塔软件公式模型编写问题提交 → 悬赏帖子。原来发的帖子不给力啊

   

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


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

主题:悬赏帖子。原来发的帖子不给力啊

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


加好友 发短信
等级:管理员 帖子:5082 积分:17642 威望:0 精华:6 注册:2010/7/15 9:05:58
  发帖心情 Post By:2011/3/14 16:36:23    Post IP:58.246.57.26[显示全部帖子]

逐周期模式,供参考.


{

平仓条件:跌10个最小变动价位平仓,盈利10个点且小于15个点,回撤到开仓价格+1个最小变动价位平仓,盈利15个最小变动价位以后,回撤10个最小变动价位平仓。
全用固定时间间隔1秒下单。图表交易,图标信号和实际平仓信号一致。

}
input:xx(20,10,100,1);
variable:maxprofit=0;//有仓位时最大获利

h20:=ref(hhv(h,xx),1);
l20:=ref(llv(l,xx),1);

long:=h>h20 and time>093000 and time<144500;//开多条件

short:=l<l20 and time>093000 and time<144500;//开空条件

 

if  long then //开多
begin
buy(holding=0 ,1,limitr,h20+3*mindiff);
maxprofit:=0;
end

if   short then //开空
begin
buyshort(holding=0 ,1,limitr,l20-3*mindiff);
maxprofit:=0;
end

sell(enterprice-10*mindiff,1,limitr,c+2*mindiff);//跌10个最小变动价位平仓
sellshort(enterprice+10*mindiff,1,limitr,c+2*mindiff);//涨10个最小变动价位平仓

win:=0;
win2:=0;

if holding > 0 and enterbars > 0 then
begin
 win:=c-enterprice; //记录最大盈利
 if win > maxprofit then
  maxprofit:=win;
 
 win2:=(maxprofit-win); //最大盈利后的回撤
end

 

if holding < 0 and enterbars > 0 then
begin
 win:=enterprice-c; //记录最大盈利
 if win > maxprofit then
  maxprofit:=win;
 
 win2:=maxprofit-win; //最大盈利后的回撤
end

 

//盈利10个点且小于15个点,回撤到开仓价格+1个最小变动价位平仓
sell(maxprofit>10*mindiff and maxprofit <15*mindiff and enterprice+mindiff,1,limitr,c-2*mindiff);
sellshort(maxprofit>10*mindiff and maxprofit <15*mindiff and enterprice-mindiff,1,limitr,c+2*mindiff);

 

//盈利15个最小变动价位以后,回撤10个最小变动价位平仓
sell(maxprofit>15*mindiff and win2>=10*mindiff,1,limitr,c-2*mindiff);
sellshort(maxprofit>15*mindiff and win2>=10*mindiff,1,limitr,c+2*mindiff);

 

if time > 150000 then //收盘平仓
 begin
 sell(holding > 0, 0, limitr,o);
 sellshort(holding < 0, 0, limitr,o);
 end

[此贴子已经被作者于2011-3-14 16:38:38编辑过]


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

客户服务部

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

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

service@weistock.com

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


查看使用道具详细信息
悬赏金币帖,要悬赏 0 个金币
 回到顶部
帅哥哟,离线,有人找我吗?
fly
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:管理员 帖子:5082 积分:17642 威望:0 精华:6 注册:2010/7/15 9:05:58
  发帖心情 Post By:2011/3/15 11:21:10    Post IP:58.246.57.26[显示全部帖子]

未成交标识:表明在那个条件,那个价位,成交不了.

用C加减2个最小变动价位,是为了促进成交.

 

只是按楼主的意思给出了个大概编程,具体细节,还需要楼主自己去实践



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

客户服务部

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

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

service@weistock.com

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

获得0个金币
 回到顶部