找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
首页论坛EAHub 外汇论坛
查看: 27|回复: 0

【编程封装函数】获取相同货币对买卖单手数总数的函数

[复制链接]

4万

主题

54

回帖

4万

积分

管理员

积分
45954
发表于 2026-8-27 20:46:00 | 显示全部楼层 |阅读模式
获取相同货币对买卖单手数总数的函数

int buyshoushu( )  //获取相同货币对买单单数的函数,括号中的变量为传出变量,传出的是修改后的真实值

    {
      int a=0;


      for (int i=0;i<OrdersTotal();i++)
         {
             if (OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==true)

               {
                   if (OrderSymbol()==Symbol()&& OrderType()==OP_BUY)
                       {
                           a=a+OrderLots();
                        }
               }

         }
         return(a);
    }

int sellshoushu( )   //获取相同货币对空单单数的函数

    {
      int a=0;


      for (int i=0;i<OrdersTotal();i++)
         {
             if (OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==true)

               {
                   if (OrderSymbol()==Symbol()&& OrderType()==OP_SELL )
                     {
                       a=a+OrderLots();
                      }
               }

         }
         return(a);
    }

    int zongshoushu()   //当前货币对总单量
       {
          int s;
         if( buyshoushu( )>sellshoushu( ))

           {
             s= buyshoushu( )-sellshoushu( );
           }
           else
             {
                s= sellshoushu( )-buyshoushu( );
             }
             return(s);

       }  
复制代码
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|EAHub外汇论坛

GMT+8, 2026-10-9 17:34 , Processed in 0.100876 second(s), 19 queries .

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表