求问下,金字塔 qq 发送消息里面的 WWSCommon.dll 是不是对 策略使用 的数目有限制?
之前我在3个策略 代码里面 添加了 qq 发送消息 的代码都正常,当我使用同样方法在 添加在 后面几个策略 里面,QQ发消息 只是显示
交易系统信号发布 2016/3/31 0:07:12
信号 PR 778.00000 OB 778.00000 OS 775.50000
该消息由金字塔交易决策系统提供。
而且每走完一根K线发送一次,不是 按正常发送的。
买卖 代码 都是相同的(包括里面插入的QQ发消息代码,我直接从可以正常发的里面贴过来的),不同的只是开仓和平仓条件,就是问下金字塔 qq 发送消息里面的DLL 是不是对 策略使用的数目有限制?
以下是 代码
runmode:0;
INPUT:N1(0.09,0.01,1,0.01),M(10,1,60,5);
INPUT:atrlength(20,5,30,5);
INPUT:riskratio(10,1,30,1);//资金账户风险度
VARIABLE:times=0;//进场次数
GLOBALVARIABLE:bb=0;
ATR2:=ref(EMA(tr,20),1);
上轨:=ref(C,1)+(1.5*ATR2);
下轨:=ref(C,1)-(1.5*ATR2);
ATR:=ref(ma(tr,atrlength),1);//波动率
marginratio:=10/100;//保证金率
name:=STKNAME;//返回品种名称
多单止损价:=ENTERPRICE-(1.5*ATR);
空单止损价:=ENTERPRICE+(1.5*ATR);
多头止损条件:=close<多单止损价;
空头止损条件:=close>空单止损价;
H30:=REF(HHV(H,M),1);
L30:=REF(LLV(L,M),1);
MID:=(H30+L30)/2;
开多条件1:=(high>H30) AND (H30-MID)/MID<N1;
开空条件1:=(low<L30) AND (MID-L30)/MID<N1;
开多条件2:=C>上轨;
开空条件2:=C<下轨;
开多条件:=开多条件1 and 开多条件2;
开空条件:=开空条件1 and 开空条件2;
平多条件:=C<下轨;
平空条件:=C>上轨;
if islastbar and bb<>barpos and not(开多条件) and not(开空条件) and not(平多条件) and not(平空条件) then
begin
bb:= barpos;
extgbstringSet('QQSTR','PR '+numtostr(close,5) + ' OB '+numtostr(h,5)+' OS '+numtostr(l,5) );
VQQM:=QQMSGX(1,close);
end
if HOLDING=0 then BEGIN//开多单
price:=0;
lots:=0;
if 开多条件 then
price:=max(open,上轨);
if price>0 then begin
当前资金:=CASH(0);
lots1:=INTPART(当前资金/(price*MULTIPLIER*marginratio));//资金允许可开最大手数
lots2:=INTPART((当前资金*riskratio/100)/(ATR*MULTIPLIER));//每一手下单量
lots:=max(1,min(lots1,lots2));
end
if lots>=1 then BEGIN
buy(1,lots,LIMITR,price);
PLAYSOUND(1,'D:\Program Files (x86)\Sound\KM.wav');
times:=1;
if islastbar and bb<>barpos then begin
bb:= barpos;
extgbstringSet('QQSTR','波动突破,开多▲▲▲:'+STKNAME);
VQQM:=QQMSGX(1,close);
end
end
end
if holding>0 then BEGIN//多加仓
while high>=enterprice+(ATR/2) and times<4 do begin
PRICE:=min(open,enterprice+(ATR/2));
lots:=0;
if price>0 then begin
当前资金:=CASH(0);
lots1:=INTPART(当前资金/(price*MULTIPLIER*marginratio));//资金允许可开最大手数
lots2:=INTPART((当前资金*riskratio/100)/(ATR*MULTIPLIER));//每一手下单量
lots:=max(1,min(lots1,lots2));
end
if lots>=1 then BEGIN
buy(1,lots,LIMITR,PRICE);
times:=TIMES+1;
end
end
end
if HOLDING=0 then BEGIN//开空单
price:=0;
lots:=0;
if 开空条件 then
price:=min(open,下轨);
if price>0 then begin
当前资金:=CASH(0);
lots1:=INTPART(当前资金/(price*MULTIPLIER*marginratio));//资金允许可开最大手数
lots2:=INTPART((当前资金*riskratio/100)/(ATR*MULTIPLIER));//每一手下单量
lots:=max(1,min(lots1,lots2));
end
if lots>=1 then BEGIN
buyshort(1,lots,LIMITR,PRICE);
PLAYSOUND(1,'D:\Program Files (x86)\Sound\KM.wav');
times:=1;
if islastbar and bb<>barpos then begin
bb:= barpos;
extgbstringSet('QQSTR','波动突破,开空▼▼▼:'+STKNAME);
VQQM:=QQMSGX(1,close);
end
end
end
if holding<0 then BEGIN//空加仓
while low<=enterprice-(ATR/2) and times<4 do begin
PRICE:=max(open,enterprice-(ATR/2));
lots:=0;
if price>0 then begin
当前资金:=CASH(0);
lots1:=INTPART(当前资金/(price*MULTIPLIER*marginratio));//资金允许可开最大手数
lots2:=INTPART((当前资金*riskratio/100)/(ATR*MULTIPLIER));//每一手下单量
lots:=max(1,min(lots1,lots2));
end
if lots>=1 then BEGIN
buyshort(1,lots,LIMITR,PRICE);
times:=TIMES+1;
end
end
end
if holding >0 then begin //平多单+平止损
PRICE:=0;
if 平多条件 then
price:=min(open,下轨);
if 多头止损条件 and enterbars>=1 then
pirce:=max(open,多单止损价);
if price>0 then begin
sell(1,HOLDING,LIMITR,PRICE);
PLAYSOUND(1,'D:\Program Files (x86)\Sound\JB2.wav');
if islastbar and bb<>barpos then begin
bb:= barpos;
extgbstringSet('QQSTR','波动突破,平多●●●:'+STKNAME);
VQQM:=QQMSGX(1,close);
end
end
end
if holding <0 then begin //平空单+平止损
PRICE:=0;
if 平空条件 then
price:=max(open,上轨);
if 空头止损条件 and enterbars>=1 then
pirce:=min(open,空单止损价);
if price>0 then begin
sellshort(1,HOLDING,LIMITR,PRICE);
PLAYSOUND(1,'D:\Program Files (x86)\Sound\JB2.wav');
if islastbar and bb<>barpos then begin
bb:= barpos;
extgbstringSet('QQSTR','波动突破,平空◎◎◎:'+STKNAME);
VQQM:=QQMSGX(1,close);
end
end
end
资产:asset,noaxis,COLORGRAY;
//次数:totaltrade,linethick0;
收益:(asset-1000000)/1000000,linethick0;
胜率:percentwin,linethick0;
出击:totaltrade/(count(date<>ref(date,1),0)+1),linethick0;
连亏:maxseqloss,linethick0;
连赢:maxseqwin,linethick0;
持仓:holding,linethick0;
可用现金:cash(0),linethick0;
而且每走完一根K线发送一次,不是 按正常发送的。
用户认为的“正常发送”应该是什么样的状态
这个 好像 每走完 一根K线 都会 发送一次
,而且是类似
交易系统信号发布 2016/3/31 0:07:12
信号 PR 778.00000 OB 778.00000 OS 775.50000
该消息由金字塔交易决策系统提供。
看不明白
你是放在图表上的吗,还是?
if islastbar then
begin
bb:= barpos;
extgbstringSet('QQSTR','第二个'+numtostr(close,5));
VQQM:=QQMSGX(1,close);
end
你用这个简单的测试下呢,弄4个策略每个策略里的输出文字改下,我这边4个策略输出如下都没有问题的
您这代码是什么逻辑???
if islastbar and bb<>barpos and not(开多条件) and not(开空条件) and not(平多条件) and not(平空条件) then
begin
bb:= barpos;
extgbstringSet('QQSTR','PR '+numtostr(close,5) + ' OB '+numtostr(h,5)+' OS '+numtostr(l,5) );
VQQM:=QQMSGX(1,close);
end
这边是条件不满足你先去做了一个输出记录,并且做了bb=barpos的赋值操作,那么后面当然会不满足bb<>barpos这个条件了。
这段代码是您自己写的吗?否则怎么没理清这个先后关系呢??
代码参考:http://www.weistock.com/bbs/dispbbs.asp?boardid=5&ID=11344
金字塔公式中:
GLOBALVARIABLE: bb=0;
VBuy:l<=o;
VSell:h>=o;
if islastbar and bb<>barpos and not(VBuy) and not(VSell) then
begin
bb:= barpos;
extgbstringSet('QQSTR','PR '+numtostr(close,5) + ' OB '+numtostr(h,5)+' OS '+numtostr(l,5) );
VQQM:=QQMSGX(1,close);
end
if VBuy then
begin
buy(1,1,limitr,c); {开多}
if islastbar and bb<>barpos then
begin
bb:= barpos;
extgbstringSet('QQSTR','1分钟超卖,尝试开多:'+numtostr(close,5));
VQQM:=QQMSGX(1,close);
end
end;
你要把你所有的非交易条件都放进去,另外能不能先简单的试验??
别弄那么多代码??按照那楼主的例子,一个简单开平条件下输出看过没》》?
你会输出PR就是我上面给你复制过来的这段话满足了条件然后进行了输出,导致后的b<>barpos这个条件不满足。你或者把这段话去掉试试呢