以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://www.weistock.com/bbs/index.asp)
--  金字塔软件问题提交  (http://www.weistock.com/bbs/list.asp?boardid=2)
----  [注意]图上k线价格无法刷新  (http://www.weistock.com/bbs/dispbbs.asp?boardid=2&id=154043)

--  作者:qwer123
--  发布时间:2017/5/24 14:20:56
--  [注意]图上k线价格无法刷新
V4.1
运行序列程序:


//股指期货自动交易程序(净单交易)
//编制:
//日期:

//********************************
rr1:=stkindiex(\'RB00\',\'SP32.持仓(76)\',0,2,0,600),linethick0;
rr2:=stkindiex(\'RB00\',\'SP32.持仓(79)\',0,2,0,600),linethick0;
rr3:=stkindiex(\'RB00\',\'SP32.持仓(82)\',0,2,0,600),linethick0;
rr4:=stkindiex(\'RB00\',\'SP32.持仓(85)\',0,2,0,600),linethick0;
rr5:=stkindiex(\'RB00\',\'SP32.持仓(88)\',0,2,0,600),linethick0;
rr6:=stkindiex(\'RB00\',\'SP32.持仓(91)\',0,2,0,600),linethick0;
rr7:=stkindiex(\'RB00\',\'SP32.持仓(94)\',0,2,0,600),linethick0;
rr8:=stkindiex(\'RB00\',\'SP32.持仓(97)\',0,2,0,600),linethick0;
rr9:=stkindiex(\'RB00\',\'SP32.持仓(100)\',0,2,0,600),linethick0;
rr10:=stkindiex(\'RB00\',\'SP32.持仓(103)\',0,2,0,600),linethick0;
rr11:=stkindiex(\'RB00\',\'SP32.持仓(106)\',0,2,0,600),linethick0;
rr12:=stkindiex(\'RB00\',\'SP32.持仓(109)\',0,2,0,600),linethick0;

r12:=rr1+rr2+rr3+rr4+rr5+rr6+rr7+rr8+rr9+rr10+rr11+rr12;

//******************************
if holding=0 and r12>0 then buy(1,r12,limitr,c);
if holding=0 and r12<0 then buyshort(1,abs(r12),limitr,c);

if holding>0 and r12>0 and holding>r12 then sell(1,holding-r12,limitr,c);
if holding>0 and r12>0 and holding<r12 then buy(1,r12-holding,limitr,c);
if holding>0 and r12<0 then
begin
sell(1,holding,limitr,c);
buyshort(1,abs(r12),limitr,c);
end

if holding<0 and r12<0 and holding>r12 then buyshort(1,holding-r12,limitr,c);
if holding<0 and r12<0 and holding<r12 then sellshort(1,r12-holding,limitr,c);
if holding<0 and r12>0 then
begin
sellshort(1,abs(holding),limitr,c);
buy(1,r12,limitr,c);
end 
if r12=0 and holding>0 then sell(holding>0,holding,limitr,c);
if r12=0 and holding<0 then sellshort(holding<0,abs(holding),limitr,c);
//********************************
盈亏:asset-1000000,colorred,linethick1,noaxis;
日盈亏:asset-ref(asset,todaybar),noaxis,colorred,linethick0;
持仓:holding,linethick0;

variable:hc=0;
回撤:hhv(盈亏,3000)-盈亏,linethick0,coloryellow;
if 回撤>hc then hc:=回撤;
最大回撤:hc,linethick0,coloryellow;

服务器8核8G,高频扫描,数据接收正常,CPU20%左右,但启动交易后图表的k线就不刷新了。不启动交易没有问题。应该是卡住了。
SP32是一个1000行的程序。

--  作者:qwer123
--  发布时间:2017/5/24 14:22:48
--  
延迟刷新500毫秒
--  作者:wenarm
--  发布时间:2017/5/24 14:33:58
--  

启动后,看下内存等资源占用是多少?


--  作者:qwer123
--  发布时间:2017/5/24 14:51:22
--  
8g的内存只使用了2G多一点。
--  作者:qwer123
--  发布时间:2017/5/26 7:39:45
--  
这个问题有没有说法啊?CPU占用不高,内存也不高,数据接收正常,就是不刷新,

你们可以测试一下,自己编一个SP32,才12个引用就运行不下去,不应该吧。

--  作者:马良
--  发布时间:2017/5/26 8:17:32
--  
建议提供一下sp32公式代码
--  作者:qwer123
--  发布时间:2017/5/26 8:28:20
--  
这个是我的实盘程序,不方便提供,你们自己编写一个吧,里面可以加循环来调准计算量。
--  作者:qwer123
--  发布时间:2017/5/26 8:41:05
--  
再:把引用减小到4个,可以平稳运行。
--  作者:yukizzc
--  发布时间:2017/5/26 8:49:39
--  
这个还是计算量太大,用自定义数据看下有否效果
--  作者:qwer123
--  发布时间:2017/5/26 9:46:10
--  
是的,但金字塔把计算机的资源利用的不好,CPU才20%,内存才2G,就卡死了。
自定义数据到是没有问题,但刷新频率最快1秒,满足不了要求。
还有我发现自定义的数据得出的持仓量和用STKINDIEX得到的持仓量不一致,stkindiex得出的是正确的。这个还没有仔细去测试,现在还不知道什么问题,也许我自定义的方法不对。