Metatrader Forum | Forex Expert-Advisor | Broker & Forex Tools

Metatrader Forum | Forex Expert-Advisor | Broker & Forex Tools (http://www.expert-advisor.com/forum/index.php)
-   Programmierung MQL4 (http://www.expert-advisor.com/forum/forumdisplay.php?f=220)
-   -   Unterschiedliche Trade zählen (http://www.expert-advisor.com/forum/showthread.php?t=6033)

armada0307 08.03.18 19:59

Unterschiedliche Trade zählen
 
Hallo, könnt ihr mir bitte helfen ich komme nicht weiter.
Ich habe mehrere Trade mit unterschiedlichen Währungspaaren und möchte zählen wieviel von welchen Währungspaar vorhanden sind. Also die Währungspaare die in der Markübersicht aufgeführt sind.

Code:

string sSymbol;
int s,i;
AnzSymbole = 0;
    int sCount = SymbolsTotal ( true );
        for (s = 0 ; s < sCount; s ++)                                    {
            sSymbol = SymbolName (s, true );
                for (i = 0;i<OrdersTotal();i++)                            {
                if(OrderSelect(i,SELECT_BY_POS)==true)            {
                  if(OrderSymbol() == sSymbol)                        {
                    AnzSymbole++;
                      Print(sSymbol,AnzSymbole);  }}}}


traderdoc 08.03.18 20:49

Code:

string sSymbol;
int s, i;
int AnzSymbole;

int sCount = SymbolsTotal(true);
for (s = 0 ; s < sCount; s ++) {
  AnzSymbole = 0;
  sSymbol = SymbolName(s, true);
  for (i = 0; i < OrdersTotal(); i++) {
      if (OrderSelect(i, SELECT_BY_POS)) {
        if (OrderSymbol() == sSymbol) AnzSymbole++;
      }
  }
  Print(sSymbol, "  ", AnzSymbole);
}

Den Code in Zukunft schon strukturiert schreiben. Das hilft beim kontrollieren.

traderdoc

armada0307 08.03.18 23:06

Vielen Dank traderdoc. Das hat mich ein gutes stück weiter gebracht.


Alle Zeitangaben in WEZ +2. Es ist jetzt 14:21 Uhr.

Powered by vBulletin® Version 3.8.5 (Deutsch)
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.6.1
Powered by vBCMS® 2.7.0 ©2002 - 2024 vbdesigns.de
Copyright ©2009 - 2023 by Expert-Advisor.com - Das Metatrader Forum