以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://222.73.7.161/bbs/index.asp)
--  公式模型编写问题提交  (http://222.73.7.161/bbs/list.asp?boardid=4)
----  交易问题  (http://222.73.7.161/bbs/dispbbs.asp?boardid=4&id=155635)

--  作者:系统使用者
--  发布时间:2017/7/3 10:10:12
--  交易问题
if holding>0 and kkcond then sell(1,1,market);
if holding<0 and kdcond then sellshort(1,1,market);
if holding=0 and buycond then buy(1,1,market);
if holding=0 and sellcond then buyshort(1,1,market);
改为如下,出现限价单子?,未成交单
//后台持仓同步系统
cc:=holding;
if holding>0 and ref(kkcond,1) then sell(1,ss,marketr);
if holding<0 and ref(kdcond,1) then sellshort(1,ss,marketr);
if holding=0 and ref(buycond,1) then buy(1,ss,marketr);
if holding=0 and ref(sellcond,1) then buyshort(1,ss,marketr);
tm:=30;//撤单时间
wt:=tremainqty(0,\'\',stklabel);
buyhold:=tbuyholdingex(\'\',stklabel,1);
sellhold:=tsellholdingex(\'\',stklabel,1);
if wt>0.5 and tsubmit(0)>tm then tcancelex(1,0,\'\',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,SS,mkt,0,0,\'\');
 if kc2<-0.5 then tsellshort(1,SS,mkt,0,0,\'\');
 if sellhold<0.5 and kc1>0.5 then tbuy(1,SS,mkt,0,0,\'\');
 if buyhold<0.5  and kc2>0.5 then tbuyshort(1,SS,mkt,0,0,\'\');
end

--  作者:系统使用者
--  发布时间:2017/7/3 10:16:19
--  
还有
//交易系统 走完K线模式
if holding>0 and ref(kkcond,1) and not(islastbar) then sell(1,ss,marketr);
if holding<0 and ref(kdcond,1) and not(islastbar) then sellshort(1,ss,marketr);
if holding=0 and ref(buycond,1) and not(islastbar) then buy(1,ss,marketr);
if holding=0 and ref(sellcond,1) and not(islastbar) then buyshort(1,ss,marketr);
与这也出现未成交单子
//交易系统 走完K线模式
if holding>0 and kkcond and not(islastbar) then sell(1,ss,marketr);
if holding<0 and kdcond and not(islastbar) then sellshort(1,ss,marketr);
if holding=0 and buycond and not(islastbar) then buy(1,ss,marketr);
if holding=0 and sellcond and not(islastbar) then buyshort(1,ss,marketr);

这2者区别是什么?

--  作者:系统使用者
--  发布时间:2017/7/3 10:19:09
--  
勾选的是固定轮询模式,应该勾选走完K?
--  作者:pyd
--  发布时间:2017/7/3 10:22:15
--  

2楼的第一种写法相当于走完2个k,例如abc3根k线,在b这个k线判断a上是否满足条件,满足条件b走完,c生成时报单

第2种写法相当于走完1根k,判断b上是否满足条件,满足条件c生成时报单

 

[此贴子已经被作者于2017/7/3 10:22:34编辑过]

--  作者:系统使用者
--  发布时间:2017/7/3 10:30:26
--