Du meinst sowas?
PHP-Code:
//+------------------------------------------------------------------+
//| Anzahl der Longpositionen |
//+------------------------------------------------------------------+
int CountLong(string countLongSymbol, int countLongMagic)
{
int CountLongReturn = 0;
if (OrdersTotal() > 0 )
{
for(int counterCountLong = 0; counterCountLong < OrdersTotal(); counterCountLong++)
{
OrderSelect(counterCountLong, SELECT_BY_POS, MODE_TRADES);
if(OrderSymbol() == countLongSymbol && OrderMagicNumber() == countLongMagic)
{
if(OrderType() == OP_BUY)
{
CountLongReturn++;
}
}
}
}
return (CountLongReturn);
}
//+------------------------------------------------------------------+
//| Anzahl der Shortpositionen |
//+------------------------------------------------------------------+
int CountShort(string countShortSymbol, int countShortMagic)
{
int CountShortReturn = 0;
if (OrdersTotal() > 0 )
{
for(int counterCountShort = 0; counterCountShort < OrdersTotal(); counterCountShort++)
{
OrderSelect(counterCountShort, SELECT_BY_POS, MODE_TRADES);
if(OrderSymbol() == countShortSymbol && OrderMagicNumber() == countShortMagic)
{
if(OrderType() == OP_SELL)
{
CountShortReturn++;
}
}
}
}
return (CountShortReturn);
}
So bekommst du mit
PHP-Code:
int AnzahlLong = CountLong(Symbol(),Magic);
int AnzahlShort = CountShort(Symbol(),Magic);
die jeweilige Anzahl der offenen Typen.