以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://www.weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://www.weistock.com/bbs/list.asp?boardid=4)
----  对应策略平仓  (http://www.weistock.com/bbs/dispbbs.asp?boardid=4&id=145321)

--  作者:fxrock4
--  发布时间:2016/12/27 14:05:06
--  对应策略平仓
kd1的单子用pd1平仓
kd2的单子用pd2平仓
开空同理。
老师如何编写,多谢。

--  作者:jinzhe
--  发布时间:2016/12/27 14:19:34
--  
开多1和开多2是互斥(只有一个会开)还是能并行的(两个都能开,两个条件的单子并存)
--  作者:fxrock4
--  发布时间:2016/12/27 14:21:57
--  
开仓要求互斥的。
--  作者:jinzhe
--  发布时间:2016/12/27 14:33:26
--  

variable:bj=0;

 

if 开多条件1 and holding=0 and bj=0 then begin

     bj:=1;

     buy(1,1,thisclose);

end

 

if 开多条件2 and holding=0  and bj=0 then begin

    bj:=2;

    buy(1,1,thisclose);

end

 

 

if 平多条件1 and holding>0 and bj=1 then begin

   sell(1,0,thisclose);

   bj:=0;

end

 

if 平多条件2 and holding>0 and bj=2 then begin

   sell(1,0,thisclose);

   bj:=0;

end

 

用全局变量定义个BJ,BJ=0时可以开仓,=1时平开多条件1的仓,=2时平开多条件2的仓


--  作者:fxrock4
--  发布时间:2016/12/28 9:07:54
--  
按此代码写的交易系统,如何再写一个对应的开多平多播放声音的代码。多谢
--  作者:jinzhe
--  发布时间:2016/12/28 9:13:02
--  

if 平多条件1 and holding>0 and bj=1 then begin

   sell(1,0,thisclose);

   bj:=0;

   playsound(1,\'声音文件1路径\');

end

 

if 平多条件2 and holding>0 and bj=2 then begin

   sell(1,0,thisclose);

   bj:=0;

    playsound(2,\'声音文件2路径\');

end


--  作者:fxrock4
--  发布时间:2016/12/28 9:38:53
--  
playsound(2,\'D:\\Weisoft Stock\\mp3\\平多.wmv\');
照做了,还是没播放声音。

--  作者:jinzhe
--  发布时间:2016/12/28 9:44:11
--  
你把声音文件所在的路径截图发一下
--  作者:fxrock4
--  发布时间:2016/12/28 9:58:20
--  
好吧,上传了。
图片点击可在新窗口打开查看此主题相关图片如下:8.jpg
图片点击可在新窗口打开查看

--  作者:jinzhe
--  发布时间:2016/12/28 10:01:47
--  
有没有MP3格式的?