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)
-   -   Profit aller offenen BuyOrders (http://www.expert-advisor.com/forum/showthread.php?t=4717)

Maverick4444 27.01.16 21:28

Profit aller offenen BuyOrders
 
Hallo Trader,

ich suche eine Funktion, welche es mir ermöglicht, den gesamten derzeitigen Profit aller offenen BuyOrders eines Paares zusammenrechnet.

pischinger 27.01.16 22:22

Code:

  double PairProfitCalc(){
  double pairprofit=0,buyprofit=0;
  for(cnt=0;cnt<OrdersTotal();cnt++){
    if(OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES))
    if(OrderSymbol()==Symbol() && OrderMagicNumber()==Magic && OrderCloseTime()==0){
      if(OrderType()==OP_BUY)buyprofit=buyprofit+OrderProfit()+OrderSwap()+OrderCommission();
        pairprofit=buyprofit;
      }
  }
  return(pairprofit);
 }


Maverick4444 29.01.16 16:32

Danke erstmal, probiere ich am WE aus.


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