Rss & SiteMap

金字塔客服中心 - 专业程序化交易软件提供商 http://www.weistock.com/bbs/

专业程序化软件提供商
共3 条记录, 每页显示 10 条, 页签: [1]
[浏览完整版]

标题:请帮忙看看这二段开多仓有什么不同

1楼
淡定688 发表于:2011/7/14 18:14:59

//////开多仓1/////////////

if holding=0 and  buycond then  //开多
    begin
      sellshort(holding<0,0,market);
      buy(holding=0,3,market);
      maxprofit:=0;
      MAXPROFjw:=0;
    end

//////开多仓2/////////////

if holding<0 then
  begin
    sellshort(buycond,0,market);  //平空仓
  end   
 
if holding=0 and buycond  then begin
     buy(1,3,market);      //开多
     maxprofit:=0;
     MAXPROFjw:=0;
 end

 

2楼
小小虾米 发表于:2011/7/14 22:20:02

1 如果当前没有仓位或持有多仓,这两段代码运行结果一致;

2 如果当前持有空仓,第一段代码没有任何动作;第二段代码将平掉空仓然后开多仓。

 

将第一段代码的语句“if holding=0 and  buycond then  //开多”,改为:

if holding<=0 and  buycond then  //开多
那么两段代码实现的功能将是一模一样的了!图片点击可在新窗口打开查看

[此贴子已经被作者于2011-7-14 22:21:47编辑过]
3楼
淡定688 发表于:2011/7/15 10:58:52
非常感谢!我试一试看看!图片点击可在新窗口打开查看
共3 条记录, 每页显示 10 条, 页签: [1]


Powered By Dvbbs Version 8.3.0
Processed in 0.03125 s, 3 queries.