📅 财经日历 📊 实时波动 📈 大盘云图 📶 行情走势 🆚 投机情绪 🚀 今日热点

    统计持仓订单的多空单数量及总数量

    老周 LV16
    2017-03-21 · 3560 阅读
    函数统计持仓订单的多空单数量及总数量。

    1. int CheckOpenPositions()
    2. {
    3. int cnt, total, NumPositions;
    4. int NumBuyTrades, NumSellTrades; // Number of buy and sell trades in this symbol
    5. NumBuyTrades = 0;
    6. NumSellTrades = 0;
    7. total=OrdersTotal();
    8. for(cnt=0;cnt<TOTAL;CNT++)
    9. {
    10. OrderSelect (cnt, SELECT_BY_POS, MODE_TRADES);
    11. if ( OrderSymbol() != Symbol()) continue;
    12. if ( OrderMagicNumber() != MagicNumber) continue;
    13. if(OrderType() == OP_BUY ) NumBuyTrades++;
    14. if(OrderType() == OP_SELL ) NumSellTrades++;
    15. }
    16. NumPositions = NumBuyTrades + NumSellTrades;
    17. return (NumPositions);
    18. }
    复制代码


    ""
    还没有人打赏,支持一下
    回复

    举报

     
    您需要登录后才可以回帖 登录 | 注册

    提醒: 禁止引战、谩骂、灌水内容

    微信二维码

    有问题联系客服