Hi,
I use this part of script to place a BuyStop order or SellStop order.
It works fine when I have one position of a type (Buy or Sell).
But when I have 2 position of the same type it places 2 orders at the same time even if I set to not do it with (TotalSellStop<1) (TotalBuyStop<1).
How can I fix that?
Thanks a lot! Please help me!
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()==m_magic)
{
if(m_position.PositionType()==POSITION_TYPE_BUY && (TotalSellStop<1) && (TotalBuyStop==0) && (type1==0))
OpenSellStop(InpLots,0,0);
if(m_position.PositionType()==POSITION_TYPE_SELL && (TotalBuyStop<1) && (TotalSellStop==0) && (type1==1))
OpenBuyStop(InpLots,0,0);
}