Ich werde immer die komplette Lösung des Problem hier am Ende anfügen.
Stichworte Filter Selekt select auswahl Order Auftrage Trades Filtern
PHP-Code:
//+------------------------------------------------------------------+
//| Offenetrades.mq4 |
//| Copyright 2018, MetaQuotes Software Corp. |
//| https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2018, MetaQuotes Software Corp."
#property link "https://www.mql5.com"
#property version "1.00"
#property strict
int MagicNumber;
int zaehler;
void OnTick()
{
//---
int offeneorders=0; //Speichert die Anzahl der Orders zur späteren Verwendung
int ordersohnestop=0; //Speichert die Anzahl der Orders ohne ein Stoploss
int anzahlorders=OrdersTotal();
for(zaehler=0;zaehler<anzahlorders;zaehler++)
{
bool Select = OrderSelect(zaehler, SELECT_BY_POS, MODE_TRADES);
if (Select == True && OrderSymbol()== Symbol() && OrderMagicNumber()==MagicNumber)
{
offeneorders++;
if (OrderStopLoss() == 0) ordersohnestop++;
}
}
Comment (
"Offene Trades: ",offeneorders,"\n"
"Offen ohne SL: ",ordersohnestop,"\n"
);
}
//+------------------------------------------------------------------+
Danke an alle.
gruss
Hippo