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


金字塔客服中心 - 专业程序化交易软件提供商金字塔软件公式模型编写问题提交 → 加入止盈止损后 出现问题

   

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


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

主题:加入止盈止损后 出现问题

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


加好友 发短信 量化投资
等级:论坛游民 帖子:148 积分:653 威望:0 精华:0 注册:2010/9/27 16:08:27
加入止盈止损后 出现问题  发帖心情 Post By:2011/11/8 17:12:58    Post IP:116.25.200.174[显示全部帖子]

加入止盈止损后  出现问题

runmode:0;

dayopen:=valuewhen(date>ref(date,1),o);

upperband:dayopen+dayopen*0.005;
dnband:dayopen-dayopen*0.005;
centre:(upperband+dnband)/2;
enterlongcond:=high>=upperband;
entershortcond:=low<=dnband;

atr:=ref(ma(tr,10),1);

exittime:=time>1458;


   if enterlongcond and time<=145800 then begin
   sellshort(holding<0 and enterbars>=1,1,limitr,upperband);
   buy(holding=0,1,limitr,upperband);
   end
  
   if entershortcond and time<=145800 then begin
   sell(holding>0 and enterbars>=1,1,limitr,dnband);
   buyshort(holding=0,1,limitr,dnband);
   end

//止损
if ref(c,1)>centre then sellshort(holding<0,holding,limitr,centre+mindiff);
if ref(c,1)<centre then sell(holding>0,holding,limitr,centre-mindiff);

//止盈
if ref(c,1)>enterprice+atr then sell(holding>0,holding,limitr,thisclose);
if ref(c,1)<enterprice-atr then sellshort(holding<0,holding,limitr,thisclose);


if exittime then begin
   sell(holding>0,1,thisclose);
   sellshort(holding<0,1,thisclose);
end


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


加好友 发短信 量化投资
等级:论坛游民 帖子:148 积分:653 威望:0 精华:0 注册:2010/9/27 16:08:27
  发帖心情 Post By:2011/11/8 17:36:10    Post IP:116.25.200.174[显示全部帖子]

我换成close发委托  ,依然很多  白色无效信号, 所有问题都是加入止盈控制语句后出现
[此贴子已经被作者于2011-11-8 17:37:45编辑过]

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


加好友 发短信 量化投资
等级:论坛游民 帖子:148 积分:653 威望:0 精华:0 注册:2010/9/27 16:08:27
  发帖心情 Post By:2011/11/9 9:20:25    Post IP:58.60.218.95[显示全部帖子]

顶一下 请高手们回复


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


加好友 发短信 量化投资
等级:论坛游民 帖子:148 积分:653 威望:0 精华:0 注册:2010/9/27 16:08:27
  发帖心情 Post By:2011/11/9 14:58:06    Post IP:58.60.218.95[显示全部帖子]

我想确认一下我的模型逻辑是没问题的?     先是两个正反手指令,然后加入止损,再加入入止盈指令。     是否止盈止损指令可以加入到正反手的指令里?

 回到顶部