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


金字塔客服中心 - 专业程序化交易软件提供商金字塔软件公式模型编写问题提交 → slastbar编写前后对应?

   

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


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

主题:slastbar编写前后对应?

帅哥哟,离线,有人找我吗?
系统使用者
  1楼 | QQ | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:黑侠 帖子:808 积分:667 威望:0 精华:0 注册:2011/4/9 16:17:57
slastbar编写前后对应?  发帖心情 Post By:2017/5/26 13:13:11    Post IP:110.184.39.14[只看该作者]

//交易系统
temp_ll:=llv(l,2);
if buycond and not(islastbar) then
begin
   sellshort(holding<0,ss,marketr);
   buy(holding=0,ss,marketr);
   ll:=temp_ll;
end
bstop:=l<ll-1*MINDIFF;
 if enterbars>0 and bstop and holding>0 and not(islastbar) then sell(1,ss,marketr);//止损止盈,实时出场
 if h>valuewhen(bstop,hhv(fh,4))and bifx=1 and holding=0 and not(islastbar) then buy(1,ss,marketr);
 if sellcond and not(islastbar) and holding>0 then sell(1,ss,marketr);
 
temp_hh:=hhv(h,2);
if sellcond and not(islastbar) then
begin
   sell(holding>0,ss,marketr);
   buyshort(holding=0,ss,marketr);
   hh:=temp_hh;
end
sstop:=h>hh+1*MINDIFF;
 if enterbars>0 and sstop and holding<0 and not(islastbar) then sellshort(1,ss,marketr);
 if l<valuewhen(sstop,llv(fl,4)) and bifx=-1 and holding=0 and not(islastbar) then buyshort(1,ss,marketr);
 if buycond and not(islastbar) and holding<0 then sellshort(1,ss,marketr);
//自动恢复持仓功能
if islastbar and tholding2<>holding then
 begin 
  if barpos=EXTGBDATA('kai')+1 then//开仓信号消失  平仓
  begin
  sell(tholding2>0,ss,marketr);
  sellshort(tholding2<0,ss,marketr);
  EXTGBDATASET( 'kai',0);
 end
  
  if barpos=EXTGBDATA('ping')+1 then//平仓信号消失  开仓恢复
  begin
  buy(holding>0,ss,marketr);
  buyshort(holding<0,ss,marketr);
  EXTGBDATASET( 'ping',0);
  end    
 end
if holding>0 and sellcond and islastbar then 
begin
 sell(1,ss,marketr);
 EXTGBDATASET( 'ping',BARPOS);
end
if holding<0 and buycond and islastbar then 
begin
 sellshort(1,ss,marketr);
 EXTGBDATASET( 'ping',BARPOS);
end

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


加好友 发短信
等级:黑侠 帖子:808 积分:667 威望:0 精华:0 注册:2011/4/9 16:17:57
  发帖心情 Post By:2017/5/26 13:16:13    Post IP:110.184.39.14[只看该作者]

temp_ll:=llv(l,2);
if buycond and not(islastbar) then
begin
   sellshort(holding<0,ss,marketr);
   buy(holding=0,ss,marketr);
   ll:=temp_ll;
end
bstop:=l<ll-1*MINDIFF;
 if enterbars>0 and bstop and holding>0 and not(islastbar) then sell(1,ss,marketr);//止损止盈,实时出场
 if h>valuewhen(bstop,hhv(fh,4))and bifx=1 and holding=0 and not(islastbar) then buy(1,ss,marketr);
 if sellcond and not(islastbar) and holding>0 then sell(1,ss,marketr);
与后面同步持仓(次周期交易),应该使用not(islastbar)?

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


加好友 发短信
等级:黑侠 帖子:808 积分:667 威望:0 精华:0 注册:2011/4/9 16:17:57
  发帖心情 Post By:2017/5/26 13:17:33    Post IP:110.184.39.14[只看该作者]

走完K线模式

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


加好友 发短信
等级:超级版主 帖子:5960 积分:0 威望:0 精华:2 注册:2014/6/12 11:29:04
  发帖心情 Post By:2017/5/26 13:25:17    Post IP:180.169.30.6[只看该作者]

NOT(ISLASTBAR)  //你这个只能用走完K线模式,固定时间间隔当前K线不会存在信号的。   
另外我看你止损止盈又是实时出场

你现在是要实现?


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

产品部

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

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

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


加好友 发短信
等级:黑侠 帖子:808 积分:667 威望:0 精华:0 注册:2011/4/9 16:17:57
  发帖心情 Post By:2017/5/26 13:47:33    Post IP:110.184.39.14[只看该作者]

止损止盈又是实时出场
就是这里,改不改NOT(ISLASTBAR)


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


加好友 发短信
等级:超级版主 帖子:21598 积分:0 威望:0 精华:1 注册:2010/7/31 16:35:30
  发帖心情 Post By:2017/5/26 13:55:16    Post IP:180.169.30.6[只看该作者]

你2楼的代码是用来当前交易的段落,还是处理历史交易信号的

建议类似代码用户可以加上些注释来方便工作人员理解,毕竟直接读源代码也是一件累事


 回到顶部
帅哥哟,离线,有人找我吗?
系统使用者
  7楼 | QQ | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:黑侠 帖子:808 积分:667 威望:0 精华:0 注册:2011/4/9 16:17:57
  发帖心情 Post By:2017/5/26 14:14:39    Post IP:110.184.39.14[只看该作者]

处理历史交易信号的

 回到顶部
帅哥哟,离线,有人找我吗?
系统使用者
  8楼 | QQ | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:黑侠 帖子:808 积分:667 威望:0 精华:0 注册:2011/4/9 16:17:57
  发帖心情 Post By:2017/5/26 14:15:42    Post IP:110.184.39.14[只看该作者]

止损,实时出场

 回到顶部
帅哥哟,离线,有人找我吗?
系统使用者
  9楼 | QQ | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:黑侠 帖子:808 积分:667 威望:0 精华:0 注册:2011/4/9 16:17:57
  发帖心情 Post By:2017/5/26 14:16:54    Post IP:110.184.39.14[只看该作者]

if enterbars>0 and bstop and holding>0 and not(islastbar) then sell(1,ss,marketr);//止损,实时出场
 if h>valuewhen(bstop,hhv(fh,4))and bifx=1 and holding=0 and not(islastbar) then buy(1,ss,marketr);//突破次周期交易
 if sellcond and not(islastbar) and holding>0 then sell(1,ss,marketr);//止盈次周期

 回到顶部
帅哥哟,离线,有人找我吗?
系统使用者
  10楼 | QQ | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:黑侠 帖子:808 积分:667 威望:0 精华:0 注册:2011/4/9 16:17:57
  发帖心情 Post By:2017/5/26 14:42:23    Post IP:110.184.39.14[只看该作者]

//自动恢复持仓功能
if islastbar and tholding2<>holding then
 begin 
  if barpos=EXTGBDATA('kai')+1 then//开仓信号消失  平仓
  begin
  sell(tholding2>0,ss,marketr);
  sellshort(tholding2<0,ss,marketr);
  EXTGBDATASET( 'kai',0);
 end
  
  if barpos=EXTGBDATA('ping')+1 then//平仓信号消失  开仓恢复
  begin
  buy(holding>0,ss,marketr);
  buyshort(holding<0,ss,marketr);
  EXTGBDATASET( 'ping',0);
  end    
 end
if holding>0 and sellcond and islastbar then 
begin
 sell(1,ss,marketr);
 EXTGBDATASET( 'ping',BARPOS);
end
if holding<0 and buycond and islastbar then 
begin
 sellshort(1,ss,marketr);
 EXTGBDATASET( 'ping',BARPOS);
end

实盘不执行持仓同步

 回到顶部
总数 11 1 2 下一页