您现在的位置:好股网 >> 股票公式 >> 金字塔公式 >> 一键转帖:后台持仓同步的写法【金字塔软件 源码 贴图】

后台持仓同步的写法【金字塔软件 源码 贴图】


指标功能:[B]国产软件[/B]
指标类型:简体中文
所需积分:0
推荐星级:
授权方式:共享版
公式大小:0 Bytes
更新时间:2016-05-10 09:17:00
公式简介:

最近怎么老是有人求助 后台持仓同步 的写法
这里简单写一下
//适用软件:金字塔

//注意:不勾选软件自带追单功能,此模型自带
//固定1秒轮询
cc:=holding;
if holding>0 and c<ref(c,1) then sell(1,1,market);
if holding<0 and c>ref(c,1) then sellshort(1,1,market);
if holding=0 and c>ref(c,1) then buy(1,1,market);
if holding=0 and c<ref(c,1) then buyshort(1,1,market);
if not(islastbar) or workmode<>1 then exit;
tm:=30;//撤单时间
ac:='800988';//下单账户
wt:=tremainqty(0,ac,stklabel);
buyhold:=tbuyholdingex(ac,stklabel,1);
sellhold:=tsellholdingex(ac,stklabel,1);
if wt>0.5 and tsubmit(0)>tm then tcancelex(1,0,ac,stklabel);//如果用软件自带的撤单功能,这句删除。
if wt<0.5 then begin
kc1:=max(cc,0)-buyhold;
kc2:=abs(min(cc,0))-sellhold;
if kc1<-0.5 then tsell(1,abs(kc1),mkt,0,0,ac),allowrepeat;
if kc2<-0.5 then tsellshort(1,abs(kc2),mkt,0,0,ac),allowrepeat;
if sellhold<0.5 and kc1>0.5 then tbuy(1,kc1,mkt,0,0,ac),allowrepeat;
if buyhold<0.5 and kc2>0.5 then tbuyshort(1,kc2,mkt,0,0,ac),allowrepeat;
end


 



[url=http://www.goodgupiao.com/gupiaogongshi/41264.html][B]后台持仓同步的写法【金字塔软件 源码 贴图】[/B][/url]