how to count buy and sell positions at the same time?
Please use the button
to insert the code (the first time I corrected your message)
Function for calculating BUY and SELL positions:
//+------------------------------------------------------------------+ //| Calculate all positions Buy and Sell | //+------------------------------------------------------------------+ void CalculateAllPositions(int &count_buys,int &count_sells) { count_buys=0; count_sells=0; for(int i=PositionsTotal()-1; i>=0; i--) if(m_position.SelectByIndex(i)) // selects the position by index for further access to its properties if(m_position.Symbol()==m_symbol.Name() && m_position.Magic()==InpMagic) { if(m_position.PositionType()==POSITION_TYPE_BUY) count_buys++; if(m_position.PositionType()==POSITION_TYPE_SELL) count_sells++; } //--- return; }
This code of mine was not counting only buy positions it count also sell position but I want it to count it separately to have a value of how many buy and sell position I have.
Please help me find the problem.