获取相同货币对买卖单手数总数的函数
- 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);
-
- }
复制代码
|