Mate, it would be much easier to understand what you ask for if you write in english.
On-line translators're sux.
hi, timbo. why you know i translate?^^|
how can I add buy, buystop, buylimit, sell, sellstop and selllimit each totals fuction above?
how can I add buy, buystop, buylimit, sell, sellstop and selllimit each totals fuction above?
case OP_SELLSTOP: .... break; case OP_SELLLIMIT: ... break; case OP_BUYSTOP: .... break; case OP_BUYLIMIT: ... break;
See script
//+------------------------------------------------------------------+ //| MyOrders.mq4 | //| Copyright © 2007, MetaQuotes Software Corp. | //| https://www.metaquotes.net/ru/ | //+------------------------------------------------------------------+ #property copyright "Copyright © 2007, MetaQuotes Software Corp." #property link "https://www.metaquotes.net/ru/" #property show_inputs extern int ExpertMagicNumber=123456; //+------------------------------------------------------------------+ //| Calculate all type orders by my MagicNumber | //+------------------------------------------------------------------+ int MyOrdersTotal(int & buyNumber, int & sellNumber,int & buyLimitNumber ,int & sellLimitNumber,int & buyStopNumber, int & sellStopNumber, int MagicNumber=0 ) { int res,orderType; //---- buyNumber=0; sellNumber=0; buyLimitNumber=0; sellLimitNumber=0; buyStopNumber=0; sellStopNumber=0; for (int i=OrdersTotal()-1;i>=0;i--) if (OrderSelect(i,SELECT_BY_POS)) { if (MagicNumber==0 || (OrderMagicNumber()==MagicNumber && MagicNumber!=0)) { switch(OrderType()) { case OP_BUY: buyNumber++;break; case OP_SELL: sellNumber++;break; case OP_BUYLIMIT: buyLimitNumber++;break; case OP_SELLLIMIT: sellLimitNumber++;break; case OP_BUYSTOP: buyStopNumber++;break; case OP_SELLSTOP: sellStopNumber++;break; } } } //---- res=buyNumber+sellNumber+buyLimitNumber+sellLimitNumber+buyStopNumber+sellStopNumber; return(res); } //+------------------------------------------------------------------+ //| script program start function | //+------------------------------------------------------------------+ int start() { //---- int buys,sells,buyLs,sellLs,buySts,sellSts; if (MyOrdersTotal(buys,sells,buyLs,sellLs,buySts,sellSts,ExpertMagicNumber)>0) Print("Long=",buys," Short=",sells," Buy limit=",buyLs," Sell Limit=",sellLs," Buy Stop=",buySts," Sell Stop=",sellSts); //---- return(0); } //+------------------------------------------------------------------+
![MQL5 - Язык торговых стратегий для клиентского терминала MetaTrader 5](https://c.mql5.com/i/registerlandings/logo-2.png)
Вы упускаете торговые возможности:
- Бесплатные приложения для трейдинга
- 8 000+ сигналов для копирования
- Экономические новости для анализа финансовых рынков
Регистрация
Вход
Вы принимаете политику сайта и условия использования
Если у вас нет учетной записи, зарегистрируйтесь
{
case OP_BUY:
_BuyType = OrderType();
_BuyTicket = OrderTicket();
_BuyLots = NormalizeDouble( OrderLots(), 1 );
_BuyOpenPrice = NormalizeDouble( OrderOpenPrice(), Digits );
_BuyStopLoss = NormalizeDouble( OrderStopLoss(), Digits );
_BuyTakeProfit = NormalizeDouble( OrderTakeProfit(), Digits );
_BuyOpenTime = OrderOpenTime();
_BuyProfit = NormalizeDouble( OrderProfit(), 2 );
_BuySwap = NormalizeDouble( OrderSwap(), 2 );
_BuyCommission = NormalizeDouble( OrderCommission(), 2 );
_BuyComment = OrderComment();
break;
case OP_SELL:
_SellType = OrderType();
_SellTicket = OrderTicket();
_SellLots = NormalizeDouble( OrderLots(), 1 );
_SellOpenPrice = NormalizeDouble( OrderOpenPrice(), Digits );
_SellStopLoss = NormalizeDouble( OrderStopLoss(), Digits );
_SellTakeProfit = NormalizeDouble( OrderTakeProfit(), Digits );
_SellOpenTime = OrderOpenTime();
_SellProfit = NormalizeDouble( OrderProfit(), 2 );
_SellSwap = NormalizeDouble( OrderSwap(), 2 );
_SellCommission = NormalizeDouble( OrderCommission(), 2 );
_SellComment = OrderComment();
break;