以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  关于多框架运行,持仓理论与实际仓位同步  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=99985)

--  作者:chenliping
--  发布时间:2016/7/3 9:47:06
--  关于多框架运行,持仓理论与实际仓位同步
老师您好,我想在多框架运行程序,但是持仓同步选秀 只能单框架运行,
我想在交易策略里面写入,程序自动检测,实际持仓与理论一致。

--  作者:王锋
--  发布时间:2016/7/3 9:51:19
--  
这个只能后台程序化中做到
--  作者:chenliping
--  发布时间:2016/7/3 9:55:44
--  
标题应该是 实际持仓 与理论同步
在程序里面写入,程序走完一根K先,自动检测,实际持仓与理论是否同步

--  作者:chenliping
--  发布时间:2016/7/3 19:19:11
--  

//用全局变量,实现次周期恢复持仓功能,供参考

 

buycond:=ref(count(c>o,2)=2,1);
sellcond:=ref(count(c<o,2)=2,1);

if holding>0 and sellcond and not(islastbar) then sell(1,1,marketr);
if holding<0 and buycond and not(islastbar) then sellshort(1,1,marketr);

if buycond and holding=0 and not(islastbar) then 
 begin 
 buy(1,1,marketr);
 end
 
if holding=0 and sellcond and not(islastbar) then buyshort(1,1,marketr);

 
if islastbar and tholding2<>holding then
 begin 
  if barpos=EXTGBDATA(\'kai\')+1 then//开仓信号消失,平仓恢复仓
  begin
  sell(tholding2>0,1,marketr);
  sellshort(tholding2<0,1,marketr);
  EXTGBDATASET( \'kai\',0);
  end
  
  if barpos=EXTGBDATA(\'ping\')+1 then//平仓信号消失,开仓恢复仓
  begin
  buy(holding>0,1,marketr);
  buyshort(holding<0,1,marketr);
  EXTGBDATASET( \'ping\',0);
  end    
 end

if holding>0 and sellcond and islastbar then 
begin
sell(1,1,marketr);
EXTGBDATASET( \'ping\',BARPOS);
end

if holding<0 and buycond and islastbar then 
begin
sellshort(1,1,marketr);
EXTGBDATASET( \'ping\',BARPOS);
end


//全局变量BAR,信号消失一根K线上也只开一次仓
if ISLASTBAR AND buycond and barpos>EXTGBDATA(\'kai\') and holding=0 then 
 begin 
 buy(1,1,marketr);
 EXTGBDATASET( \'kai\',BARPOS);
 end

if ISLASTBAR AND sellcond and barpos>EXTGBDATA(\'kai\') and holding=0 then 
 begin 
 buyshort(1,1,marketr);
 EXTGBDATASET( \'kai\',BARPOS);
 end



这是之前老师写的代码,需要怎样修改呢


 实际持仓 与理论同步

在程序里面写入,程序走完一根K先,自动检测,实际持仓与理论是否同步


[此贴子已经被作者于2016-7-3 19:19:42编辑过]

--  作者:jinzhe
--  发布时间:2016/7/4 9:32:19
--  
自动持仓同步参考系统自带的功能
--  作者:chenliping
--  发布时间:2016/7/4 11:22:08
--  
系统自带功能只能单框架运行, 如果多框架多 品种,运行如何解决呢
--  作者:jinzhe
--  发布时间:2016/7/4 11:27:50
--  
处理不了,这个功能和代码都是针对单框架的
--  作者:chenliping
--  发布时间:2016/7/4 11:40:19
--  
那我想问下,后台交易能够处理吗?
但我金字塔软件,交易选项  没有后台程式化交易这个选项呢

--  作者:chenliping
--  发布时间:2016/7/4 11:48:28
--  
另外加问一个问题,后台程式化交易,框架K线上会出现交易信号吗?
--  作者:chenliping
--  发布时间:2016/7/4 12:14:30
--  
我想问下,后台交易能够处理怎样进行持仓同步检测吗?
但我金字塔软件,交易选项  没有后台程式化交易这个选项呢,  另外后台程式化交易,怎样进行持仓同步检测?


另外加问一个问题,后台程式化交易,框架K线上,会出现交易信号显示在图表上吗?