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


金字塔客服中心 - 专业程序化交易软件提供商金字塔软件公式模型编写问题提交 → 持仓与实盘同步模块

   

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


  共有4559人关注过本帖平板打印复制链接

主题:持仓与实盘同步模块

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


加好友 发短信
等级:论坛游民 帖子:169 积分:0 威望:0 精华:0 注册:2016/8/28 16:11:16
持仓与实盘同步模块  发帖心情 Post By:2016/12/1 13:56:13    Post IP:119.138.53.164[只看该作者]


按阿火思路改编,持仓与实盘同步模块,模拟没反应,是什么原因?

input:p(5,1,200,1);

input:length(75,10,300,10);

input:zs(4,1,50,1);

input:k1(4,1,50,1);

globalvariable:myhoiding=0;


line:ma(ref(c,1),30),colorblue,linethick2;

drawnumber(islastbar,line,line,0,colorblue);

tr1 :=max(max((high-low),abs(ref(close,1)-high)),abs(ref(close,1)-low));

atr:=ma(tr1,length);  

zsx:=ifelse(zs*ref(atr,1)<0.02*ref(c,1),0.02*ref(c,1),zs*ref(atr,1));

dstop1:=hhv(h,ttypebar(1,1))-k1*ref(atr,1);//平多价

kstop1:=llv(l,ttypebar(1,3))+k1*ref(atr,1);//平空价

long:=cross(c,line);

short:= cross(line,c) ;

//建立多头的进场条件

    if myhoiding<0 and  long then myhoiding=p;
  
    if myhoiding>0 and short then myhoiding=-p;

    if myhoiding>0 and c<=max(tavgenterpriceex2('6142521','',0)-zsx,dstop1) then myhoiding=0;

    if myhoiding<0 and c>=min(tavgenterpriceex2('6142521','',1)+zsx,kstop1) then myhoiding=0;

    if myhoiding=0 and long and ref(c,1)>ref(c,4) then myhoiding=p;

    if myhoiding=0 and short and ref(c,1)<ref(c,4) then myhoiding=-p;

    cc614251:=myhoiding;//账户的下单系数
    
    drawtextex(1,1,800,0,'虚拟持仓为:'+numtostr(cc614251,0));//在图表上输入虚拟持仓以便监控

if not(islastbar) or dynainfo(207)<91500 then exit;
///////////////////////////////////////////////////以下是账户800043的下单语句,其他账户下单,修改800043为相应账户,接在程序后面即可

lcc614251:=tbuyholdingex('614251','',1)-tsellholdingex('614251','',1);

xiadan614251:=cc614251-lcc614251;

if lcc614251<>extgbdata('lcc614251') then begin//有单子成交,则下单开关设为0,允许下单 extgbdataset('abb800043',0);

 extgbdataset('lcc614251',lcc614251);

end

if tremainqty(0,'614251',stklabel)>=1 or (cc614251<>lcc614251 and timetot0(currenttime)-extgbdata('abb614251')>10) then begin
   //下单后10秒内仍发现委托单,则允许下单。可能是堵单,可能是交易账户网络暂时中断
 
 extgbdataset('abb614251',0);

end

if xiadan614251>0 then begin

 if lcc614251<0 and extgbdata('abb614251')=0 and tremainqty(0,'614251',stklabel)=0 then begin
  
  tsellshort(1,min(xiadan614251,abs(lcc614251)),mkt,0,0,'614251'),allowrepeat;
  
  extgbdataset('abb614251',timetot0(currenttime));
  
   end
 
 if tsellholdingex('614251','',1)=0 and tremainqty(4,'614251',stklabel)=0 and tremainqty(1,'614251',stklabel)=0 and extgbdata('abb614251')=0 then begin
  
  tbuy(xiadan614251+min(lcc614251,0)>0,xiadan614251+min(lcc614251,0),mkt,0,0,'614251'),allowrepeat;
  
  extgbdataset('abb614251',timetot0(currenttime));
 
 end

end

if xiadan614251<0 then begin
 
 if lcc614251>0 and extgbdata('abb614251')=0 and tremainqty(0,'614251',stklabel)=0 then begin
  
  tsell(1,min(abs(xiadan614251),abs(lcc614251)),mkt,0,0,'614251'),allowrepeat;
  
  extgbdataset('abb614251',timetot0(currenttime));

 end
 
 if tbuyholdingex('614251','',1)=0 and tremainqty(2,'614251',stklabel)=0 and tremainqty(3,'614251',stklabel)=0 and extgbdata('abb614251')=0 then begin
  
  tbuyshort(abs(xiadan614251)-max(lcc614251,0)>0,abs(xiadan614251)-max(lcc614251,0),mkt,0,0,'614261'),allowrepeat;
  
  extgbdataset('abb614251',timetot0(currenttime));
 
 end

end

 回到顶部
总数 37 1 2 3 4 下一页