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)
-   -   Werte aus der History (http://www.expert-advisor.com/forum/showthread.php?t=1929)

Traxpari 10.02.12 11:10

Werte aus der History
 
Wollte mal fragen ob mir einer bei meinem Problem helfen kann,

Ich will aus der History aus dem letzten Trade herausfinden ob dieser positive oder negative war. und ob es ein Buy Order oder eine Sell Order war.

naranjoe 10.02.12 20:48

Bitte schön

Code:

datetime ClosingTime = 0;
int OType = 0;
double Profit = 0;
string OText = "";
 
for (int i=0; i < OrdersHistoryTotal(); i++)
    {
      if(OrderSelect(i, SELECT_BY_POS, MODE_HISTORY))
        {
          if (ClosingTime == 0)
            {
              ClosingTime = OrderCloseTime();
              OType = OrderType();
              Profit =OrderProfit();
            }
          else
            {
              if (OrderCloseTime() > ClosingTime)
                {
                  ClosingTime = OrderCloseTime();
                  OType = OrderType(); 
                  Profit = OrderProfit();
                }
              }
        }
         
    }
if (OType == 0) Print ("Letze Position war eine BUY Order mit ", Profit, " Profit.");
if (OType == 1) Print ("Letze Position war eine SELL Order mit ", Profit, " Profit.");
if (OType != 0 && OType != 1) Print ("Letze Position war eine gelöschte Pending Order.");

Gruß
naranjoe

Traxpari 11.02.12 09:49

Danke für die schnelle Antwort!! ich sag nur 100%ig :)


Alle Zeitangaben in WEZ +2. Es ist jetzt 13:29 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