Rss & SiteMap

金字塔客服中心 - 专业程序化交易软件提供商 http://www.weistock.com/bbs/

专业程序化软件提供商
共11 条记录, 每页显示 10 条, 页签: [1] [2]
[浏览完整版]

标题:slastbar编写前后对应?

1楼
系统使用者 发表于:2017/5/26 13:13:11
//交易系统
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楼
系统使用者 发表于:2017/5/26 13:16:13
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楼
系统使用者 发表于:2017/5/26 13:17:33
走完K线模式
4楼
FexTel 发表于:2017/5/26 13:25:17
NOT(ISLASTBAR)  //你这个只能用走完K线模式,固定时间间隔当前K线不会存在信号的。   
另外我看你止损止盈又是实时出场

你现在是要实现?
5楼
系统使用者 发表于:2017/5/26 13:47:33
止损止盈又是实时出场
就是这里,改不改NOT(ISLASTBAR)

6楼
yukizzc 发表于:2017/5/26 13:55:16

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

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

7楼
系统使用者 发表于:2017/5/26 14:14:39
处理历史交易信号的
8楼
系统使用者 发表于:2017/5/26 14:15:42
止损,实时出场
9楼
系统使用者 发表于:2017/5/26 14:16:54
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楼
系统使用者 发表于:2017/5/26 14:42:23
//自动恢复持仓功能
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 条记录, 每页显示 10 条, 页签: [1] [2]


Powered By Dvbbs Version 8.3.0
Processed in 0.02930 s, 3 queries.