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


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

   

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


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

主题:求助

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


加好友 发短信
等级:论坛游侠 帖子:150 积分:735 威望:0 精华:0 注册:2012/1/30 10:53:14
  发帖心情 Post By:2012/7/16 13:38:23    Post IP:180.175.21.90[显示全部帖子]

以下是引用kingmoonwang在2012-7-16 12:44:21的发言:

1.收盘价同时在5日线以及10日线之上时开仓,这时怎样记录开仓位置K线的最高点。

 

2. 以股指为例,开仓同上,盈利20点以后开始保本止盈,也就是回撤到开仓价+1点时平仓出局。

 

 

请问以上语句怎样写啊?多谢。

第一个问题:以hh来表示开仓位置K线最高点

第一种方法:

buycond:=c>ma(c,5) and c>ma(c,10);
selcond:=c<ma(c,5) and c<ma(c,10);
if holding>0 and selcond then sell(1,1,limitr,c);
if holding<0 and buycond then sellshort(1,1,limitr,c);
if holding=0 and buycond then buy(1,1,limitr,c);
if holding=0 and selcond then buyshort(1,1,limitr,c);

hh:=ref(h,enterbars);

 

第二种方法:

buycond:=c>ma(c,5) and c>ma(c,10);
selcond:=c<ma(c,5) and c<ma(c,10);
if holding>0 and selcond then sell(1,1,limitr,c);
if holding<0 and buycond then sellshort(1,1,limitr,c);
if holding=0 and buycond then begin
 buy(1,1,limitr,c);
 hh:=h;
end
if holding=0 and selcond then 
buyshort(1,1,limitr,c);

 

第二个问题:

见【阿火秘笈】之二

http://www.weistock.com/bbs/dispbbs.asp?boardid=10&Id=9439


 回到顶部