← К каталогу
Исходный код · ID 1361

tradereport@amazing_owner.mq4

Вы автор или правообладатель?

Сообщите нам, если считаете, что материал размещён без разрешения.

Краткий обзор

О программе

Индикатор tradereport@amazing_owner.mq4 для платформы MetaTrader 4 отображает на графике таблицу с аналитическим отчётом по сделкам. Он считывает открытые и/или закрытые ордера из истории терминала, группирует их по символу, магическому номеру или комментарию и рассчитывает суммарные объёмы, прибыль, убыток, чистый результат в деньгах и пипсах. Таблица обновляется автоматически через заданный интервал и поддерживает сортировку по столбцам кликом по заголовку.

Настройки программы

НастройкаОписание
MagicNumber Магический номер — Фильтр ордеров по значению MagicNumber; значение -1 включает все ордера.
CommentFilter Фильтр комментария — Текстовая подстрока для включения только ордеров, содержащих указанный комментарий.
CSV list of symbols to include (SymbolFilter) Фильтр символов — Список символов через запятую для включения только ордеров по указанным инструментам.
CSV list of currencies to include (CurrencyFilter) Фильтр валют — Список валют через запятую для включения ордеров, где базовая или котируемая валюта совпадает с указанными.
DateChoice Выбор периода дат — Предустановка диапазона дат: только сегодня, только эта неделя, только этот месяц или пользовательский диапазон.
StartDate Дата начала — Начальная дата пользовательского диапазона отчёта.
EndDate Дата окончания — Конечная дата пользовательского диапазона отчёта.
RefreshMinutes Интервал обновления — Периодичность автоматического обновления данных отчёта в минутах.
reportType Тип отчёта — Какие ордера включать в отчёт: только открытые, только закрытые или оба типа.
groupBy Группировка — Измерение группировки строк таблицы: по символу, по магическому номеру или по комментарию.
colorScheme Цветовая схема — Визуальная тема оформления таблицы отчёта.
xOffset Смещение по X — Горизонтальное смещение таблицы отчёта от левого края графика в пикселях.
yOffset Смещение по Y — Вертикальное смещение таблицы отчёта от верхнего края графика в пикселях.
Получить полный код

Поиск по коду файла

#property version   "1.00"
#property strict
#property indicator_chart_window

#define screenFont   "tahoma"
#define objectPrefix "TR_"
#define UP 1
#define FLAT 0
#define DOWN -1
#define INF     0x6FFFFFFF

enum REPORT_TYPE {
   OPEN ,             // List only OPEN orders
   CLOSED,            // List only CLOSED orders
   BOTH               // List both OPEN and CLOSED orders
};

enum GROUP_BY {
   SYMBOL,            // Collate results by Symbol
   MAGIC,             // Collate results by Magic Number
   COMMENT            // Collate results by Comment
};

struct COLOR_SCHEME {
   color  tableBorderColor     ;
   color  tableHeadBackColor   ;
   color  tableHeadTextColor   ;
   color  tableRowBackColor    ;
   color  tableAltRowBackColor ;
   color  tableRowTextColor    ;
};

static COLOR_SCHEME myColorScheme[]   = { { clrWhite, C'62,62,62', clrWhite, clrIvory, clrLemonChiffon, clrBlack },
                                           { C'0xEE,0xE8,0xD5', C'0x00,0x2B,0x36', clrWhite, C'0xFD,0xF6,0xE3', C'0xEE,0xE8,0xD5', C'0x00,0x2B,0x36' },
                                           { C'0x19,0x8A,0x8A', C'0x00,0x4A,0x4A', clrWhite, C'0x47,0xB8,0xB8', C'0x19,0x8A,0x8A',clrWhite },
                                           { C'0xCC,0x33,0x99', C'0x95,0x23,0x71', clrWhite, C'0x33,0x33,0x33', C'0x66,0x66,0x66',clrWhite },
                                           { C'0x3A,0x3A,0x3A', clrBlack, clrWhite, C'0xDD,0xDD,0xDD', C'0xCC,0xCC,0xCC',clrBlack } };

enum SCHEME_CHOICE {
   BEIGE           ,
   SOLARIZED       ,
   TURQUOISE       ,
   MAGENTA         ,
   BLACKNWHITE
};

enum DATE_CHOICE {
   TODAY,           // Just Today's Trades
   THIS_WEEK,       // Just This Week's Trades
   THIS_MONTH,      // Just This Month's Trades
   CUSTOM           // Custom Dates
};

datetime startDate;
datetime endDate;

input int           MagicNumber          = -1;
input string        CommentFilter        = "";
input string        SymbolFilter         = "";     // CSV list of symbols to include
input string        CurrencyFilter       = "";     // CSV list of currencies to include
input DATE_CHOICE   DateChoice           = CUSTOM;
input datetime      StartDate            = D'2018.01.01 00:00';
input datetime      EndDate              = D'2020.12.31 23:59';
input int           RefreshMinutes       = 5;
input REPORT_TYPE   reportType           = CLOSED;
input GROUP_BY      groupBy              = SYMBOL;
input SCHEME_CHOICE colorScheme          = BEIGE;
input int           xOffset              = 10;
input int           yOffset              = 5;

struct COLUMN {
   string name;
   int    width;
   int    sortDir;
};

struct ORDERINFO {
   string symbol;
   int    magic;
   string comment;
   int    nrOfTrades;
   int    nrOfBuyTrades;
   int    nrOfSellTrades;
   double totalLots;
   double buyLots;
   double sellLots;
   double profit;
   double loss;
   double nettPL;
   double nettPIPs;
};

COLUMN    columns[];
ORDERINFO orderInfo[];
ORDERINFO orderTotal;

int sorted[];           // Contains indices of orderInfo in sorted order

int sortedCol   = -1;
int sortedDir   = -1;

string IncludeCurrencies[];
string IncludeSymbols[];

int OnInit() {
      // код доступен только после оплаты
   }

void OnDeinit(const int reason) {

   deleteAllObjects();

   ArrayFree(sorted);
   ArrayResize(sorted,0);

   ArrayFree(columns);
   ArrayResize(columns,0);

   ArrayFree(orderInfo);
   ArrayResize(orderInfo,0);
}

int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[]) {
      // код доступен только после оплаты
   }

void InitColumns( COLUMN &cols[] ) {

   ArrayFree(cols);
   ArrayResize(cols, 11);

   cols[0].name    = ( groupBy == SYMBOL ) ? "Symbol" : ( groupBy == MAGIC ) ? "Magic" : ( groupBy == COMMENT ) ? "Comment" : "";
   cols[0].width   =  80;
   cols[0].sortDir =  FLAT;

   cols[1].name    = "Trades";
   cols[1].width   =  60;
   cols[1].sortDir =  FLAT;

   cols[2].name    = "Buy Trades";
   cols[2].width   =  90;
   cols[2].sortDir =  FLAT;

   cols[3].name    = "Sell Trades";
   cols[3].width   =  90;
   cols[3].sortDir =  FLAT;

   cols[4].name    = "Lots";
   cols[4].width   =  60;
   cols[4].sortDir =  FLAT;

   cols[5].name    = "Buy Lots";
   cols[5].width   =  80;
   cols[5].sortDir =  FLAT;

   cols[6].name    = "Sell Lots";
   cols[6].width   =  80;
   cols[6].sortDir =  FLAT;

   cols[7].name    = "Profit";
   cols[7].width   =  80;
   cols[7].sortDir =  FLAT;

   cols[8].name    = "Loss";
   cols[8].width   =  80;
   cols[8].sortDir =  FLAT;

   cols[9].name    = "Nett P/L";
   cols[9].width   =  80;
   cols[9].sortDir =  FLAT;

   cols[10].name    = "Nett PIPs";
   cols[10].width   =  80;
   cols[10].sortDir =  FLAT;

}

void AutoSizeFirstColumn( COLUMN &cols[], ORDERINFO &info[] ) {

   int colSize = cols[0].width;       // Default width

   int maxSize = -1;
   string elem = "";
   for ( int iRow=0; iRow < ArraySize(info); iRow++ ) {
      switch(groupBy) {
         case SYMBOL  : elem = info[iRow].symbol;break;
         case MAGIC   : elem = StringFormat("%d", info[iRow].magic );break;
         case COMMENT : elem = info[iRow].comment;break;
      }
      maxSize = ( StringLen(elem) > maxSize ) ? StringLen(elem) : maxSize;
   }
   cols[0].width = ( maxSize * 8 > colSize ) ? maxSize * 8 : colSize;
}

void GetOrderInfo( ORDERINFO &info[] ) {

   double pipFactor;
   double lastPrice, profit;
   string mysymbol;
   int myMagic;
   string myComment;
   int index;

   int totalOrders;
   int selectMode;

   ArrayFree(info);
   ArrayResize(info,0);

   orderTotal.nrOfTrades      = 0;
   orderTotal.nrOfBuyTrades   = 0;
   orderTotal.nrOfSellTrades  = 0;
   orderTotal.totalLots       = 0.0;
   orderTotal.buyLots         = 0.0;
   orderTotal.sellLots        = 0.0;
   orderTotal.profit          = 0.0;
   orderTotal.loss            = 0.0;
   orderTotal.nettPL          = 0.0;
   orderTotal.nettPIPs        = 0.0;

   for ( REPORT_TYPE myReportType=OPEN; myReportType <= CLOSED; myReportType++ ) {

      if ( ( (reportType == OPEN) || (reportType == BOTH) ) && ( myReportType == OPEN ) ) {
         totalOrders = OrdersTotal();
         selectMode  = MODE_TRADES;
      }
      else if ( ( (reportType == CLOSED) || (reportType == BOTH) ) && ( myReportType == CLOSED ) ) {
         totalOrders = OrdersHistoryTotal();
         selectMode  = MODE_HISTORY;
      }
      else {
         continue;
      }

      for (int iOrder=totalOrders-1; iOrder >= 0; iOrder-- ) {

         if ( !OrderSelect(iOrder, SELECT_BY_POS, selectMode) ) {
            Print("Access to order cursor failed with error (",GetLastError(),")");
            break;
         }

         if ( (MagicNumber != -1) && ( OrderMagicNumber() != MagicNumber ) ) continue;

         if ( (CommentFilter != "") && ( StringFind( OrderComment(), CommentFilter ) == -1 ) ) continue;

         if ( (ArraySize(IncludeSymbols) > 0) && ( findInStringArray(IncludeSymbols, StringSubstr(OrderSymbol(),0,6)) < 0 ) ) continue;

         if ( (ArraySize(IncludeCurrencies) > 0) && ( findInStringArray(IncludeCurrencies, StringSubstr(OrderSymbol(),0,3)) < 0 ) && ( findInStringArray(IncludeCurrencies, StringSubstr(OrderSymbol(),3,3)) < 0 ) ) continue;

         if ( (OrderType() != OP_BUY) && (OrderType() != OP_SELL) ) continue;

         if ( (myReportType == CLOSED) && ( (OrderCloseTime() < startDate) || (OrderCloseTime() > endDate) ) ) continue;

         mysymbol = OrderSymbol();
         pipFactor = GetPipFactor(mysymbol);

         myMagic = OrderMagicNumber();
         myComment = OrderComment();

         if ( StringFind(myComment,"[sl]",0) > 0 ) myComment = StringSubstr( myComment,0,StringFind(myComment,"[sl]",0) );
         if ( StringFind(myComment,"[tp]",0) > 0 ) myComment = StringSubstr( myComment,0,StringFind(myComment,"[tp]",0) );

         index = -1;
         if ( groupBy == SYMBOL ) {
            index = findSymbolInOrderInfo( info, mysymbol );
            if ( index == -1 ) {
               index = addSymbolToOrderInfo( info, mysymbol );
            }
         }
         else if ( groupBy == MAGIC ) {
            index = findMagicInOrderInfo( info, myMagic );
            if ( index == -1 ) {
               index = addMagicToOrderInfo( info, myMagic );
            }
         }
         else if ( groupBy == COMMENT ) {
            index = findCommentInOrderInfo( info, myComment );
            if ( index == -1 ) {
               index = addCommentToOrderInfo( info, myComment );
            }
         }

         info[index].nrOfTrades += 1;
         info[index].totalLots  += OrderLots();

         profit = OrderProfit() + OrderSwap() + OrderCommission();
         info[index].nettPL += profit;
         if ( profit > 0.0 ) {
            info[index].profit += profit;
         }
         else {
            info[index].loss += profit;
         }

         lastPrice = 0.0;
         if ( OrderType() == OP_BUY ) {
            info[index].buyLots        += OrderLots();
            info[index].nrOfBuyTrades  += 1;
            lastPrice = ( myReportType == CLOSED ) ? OrderClosePrice() : MarketInfo( mysymbol, MODE_BID );
            info[index].nettPIPs       += ( lastPrice - OrderOpenPrice() ) * pipFactor;
         }
         else if ( OrderType() == OP_SELL ) {
            info[index].sellLots       += OrderLots();
            info[index].nrOfSellTrades += 1;
            lastPrice = ( myReportType == CLOSED ) ? OrderClosePrice() : MarketInfo( mysymbol, MODE_ASK );
            info[index].nettPIPs       += ( OrderOpenPrice() - lastPrice ) * pipFactor;
         }

      } // for

   } // for

   for(int iOrder=0; iOrder < ArraySize(info); iOrder++) {
      orderTotal.nrOfTrades      += info[iOrder].nrOfTrades;
      orderTotal.nrOfBuyTrades   += info[iOrder].nrOfBuyTrades;
      orderTotal.nrOfSellTrades  += info[iOrder].nrOfSellTrades;
      orderTotal.totalLots       += info[iOrder].totalLots;
      orderTotal.buyLots         += info[iOrder].buyLots;
      orderTotal.sellLots        += info[iOrder].sellLots;
      orderTotal.profit          += info[iOrder].profit;
      orderTotal.loss            += info[iOrder].loss;
      orderTotal.nettPL          += info[iOrder].nettPL;
      orderTotal.nettPIPs        += info[iOrder].nettPIPs;
   }

}   

/*
int GetPipFactor(string symbol) {

  static string factor100[]         = {"JPY","XAG","SILVER","BRENT","WTI"};
  static string factor10[]          = {"XAU","GOLD","SP500"};
  static string factor1[]           = {"UK100","WS30","DAX30","NAS100","CAC400"};

  int factor = 10000;       // correct factor for most pairs
  for ( int j = 0; j < ArraySize( factor100 ); j++ ) {
     if ( StringFind( symbol, factor100[j] ) != -1 ) factor = 100;
  }   
  for ( int j = 0; j < ArraySize( factor10 ); j++ ) {
     if ( StringFind( symbol, factor10[j] ) != -1 ) factor = 10;
  }   
  for ( int j = 0; j < ArraySize( factor1 ); j++ ) {
     if ( StringFind( symbol, factor1[j] ) != -1 ) factor = 1;
  }

  return (factor);
}*/

double GetPipFactor( string symbol ) {

   static int pointCorrection = ( is5DigitBroker() ) ? 10 : 1;

   double factor = ( 1.0 / SymbolInfoDouble( symbol, SYMBOL_POINT ) ) / pointCorrection;

   return(factor);
}

bool is5DigitBroker() {

   bool result = false;

   for (int iSymbol=0; iSymbol < SymbolsTotal(false); iSymbol++) {
      if ( StringFind( SymbolName( iSymbol, false ), "EURUSD" ) >= 0 ) {
         result = ( SymbolInfoInteger( SymbolName( iSymbol, false ), SYMBOL_DIGITS ) == 5 );
         break;
      }
   }
   return(result);
}

void OnTimer() {

   GetOrderInfo( orderInfo );

   AutoSizeFirstColumn( columns, orderInfo );

   ArrayResize(sorted, ArraySize(orderInfo));
   for(int index=0; index < ArraySize(sorted); index++) sorted[index] = index;

   SortColumn( sortedCol );   

   DisplayOrderInfo( orderInfo );
}

int addSymbolToOrderInfo( ORDERINFO &info[], string elem ) {

   int currentSize = ArraySize(info);
   ArrayResize(info, currentSize+1 );

   info[currentSize].symbol            = elem;
   info[currentSize].magic             = -1;
   info[currentSize].comment           = "";
   info[currentSize].nrOfTrades        = 0;
   info[currentSize].nrOfBuyTrades     = 0;
   info[currentSize].nrOfSellTrades    = 0;
   info[currentSize].totalLots         = 0.0;
   info[currentSize].buyLots           = 0.0;
   info[currentSize].sellLots          = 0.0;
   info[currentSize].profit            = 0.0;
   info[currentSize].loss              = 0.0;
   info[currentSize].nettPL            = 0.0;
   info[currentSize].nettPIPs          = 0.0;

   return(currentSize);
}

int addMagicToOrderInfo( ORDERINFO &info[], int magic) {

   int currentSize = ArraySize(info);
   ArrayResize(info, currentSize+1 );

   info[currentSize].symbol            = "";
   info[currentSize].magic             = magic;
   info[currentSize].comment           = "";
   info[currentSize].nrOfTrades        = 0;
   info[currentSize].nrOfBuyTrades     = 0;
   info[currentSize].nrOfSellTrades    = 0;
   info[currentSize].totalLots         = 0.0;
   info[currentSize].buyLots           = 0.0;
   info[currentSize].sellLots          = 0.0;
   info[currentSize].profit            = 0.0;
   info[currentSize].loss              = 0.0;
   info[currentSize].nettPL            = 0.0;
   info[currentSize].nettPIPs          = 0.0;

   return(currentSize);
}

int addCommentToOrderInfo( ORDERINFO &info[], string comment) {

   int currentSize = ArraySize(info);
   ArrayResize(info, currentSize+1 );

   info[currentSize].symbol            = "";
   info[currentSize].magic             = -1;
   info[currentSize].comment           = comment;
   info[currentSize].nrOfTrades        = 0;
   info[currentSize].nrOfBuyTrades     = 0;
   info[currentSize].nrOfSellTrades    = 0;
   info[currentSize].totalLots         = 0.0;
   info[currentSize].buyLots           = 0.0;
   info[currentSize].sellLots          = 0.0;
   info[currentSize].profit            = 0.0;
   info[currentSize].loss              = 0.0;
   info[currentSize].nettPL            = 0.0;
   info[currentSize].nettPIPs          = 0.0;

   return(currentSize);
}

int findSymbolInOrderInfo( ORDERINFO &info[], string elem ) {

   int pos = -1;
   for (int i = 0; i < ArraySize(info); i++ ) {
      if (info[i].symbol == elem) {
         pos = i;
         break;
      }
   }
   return(pos);
}

int findMagicInOrderInfo( ORDERINFO &info[], int magic ) {

   int pos = -1;
   for (int i = 0; i < ArraySize(info); i++ ) {
      if (info[i].magic == magic) {
         pos = i;
         break;
      }
   }
   return(pos);
}

int findCommentInOrderInfo( ORDERINFO &info[], string comment ) {

   int pos = -1;
   for (int i = 0; i < ArraySize(info); i++ ) {
      if (info[i].comment == comment) {
         pos = i;
         break;
      }
   }
   return(pos);
}

int findInColumns( COLUMN &cols[], string colName ) {

   int pos = -1;
   for (int i = 0; i < ArraySize(cols); i++ ) {
      if (cols[i].name == colName) {
         pos = i;
         break;
      }
   }
   return(pos);
}

void OnChartEvent(const int id, const long &lparam, const double &dparam, const string &sparam ) {

   if ( (id==CHARTEVENT_OBJECT_CLICK) && (StringFind( sparam, objectPrefix ) == 0) ) {
      ObjectSetInteger(0,sparam,OBJPROP_SELECTED, false );
      ObjectSetInteger(0,sparam,OBJPROP_STATE, false );

      string objectName = StringSubstr( sparam, StringLen(objectPrefix) );

      int colID = findInColumns( columns, objectName );
      if ( colID >= 0 ) {
         if ( sortedCol == colID ) {
            if ( columns[colID].sortDir == FLAT ) columns[colID].sortDir = UP;
            else if ( columns[colID].sortDir == DOWN ) columns[colID].sortDir = UP;
            else if ( columns[colID].sortDir == UP ) columns[colID].sortDir = DOWN;
         }
         else {
            sortedCol = colID;
            if ( columns[colID].sortDir == FLAT ) columns[colID].sortDir = UP;
         }
         SortColumn( colID );
         DisplayOrderInfo( orderInfo );
      }
   }
}

void SortColumn( int colID ) {

   switch( colID ) {
      case 0: if ( groupBy == SYMBOL ) SortBySymbol( columns[colID].sortDir ); else if ( groupBy == MAGIC ) SortByMagic ( columns[colID].sortDir ); else if ( groupBy == COMMENT ) SortByComment ( columns[colID].sortDir );break;
      case 1: SortByNrOfTrades( columns[colID].sortDir );break;
      case 2: SortByNrOfBuyTrades( columns[colID].sortDir );break;
      case 3: SortByNrOfSellTrades( columns[colID].sortDir );break;
      case 4: SortByTotalLots( columns[colID].sortDir );break;
      case 5: SortByBuyLots( columns[colID].sortDir );break;
      case 6: SortBySellLots( columns[colID].sortDir );break;
      case 7: SortByProfit( columns[colID].sortDir );break;
      case 8: SortByLoss( columns[colID].sortDir );break;
      case 9: SortByNettPL( columns[colID].sortDir );break;
      case 10: SortByNettPIPs( columns[colID].sortDir );break;
   }
}

void SortBySymbol(int direction = UP) {

   int count = ArraySize(orderInfo);
   int tempID;

   for (int id=0; id < count; id++) sorted[id] = id;

   for (int id1=0; id1 < count-1; id1++ ) {
      for ( int id2=id1+1; id2 < count; id2++ ) {
         if ( ( (direction == UP) && (StringCompare(orderInfo[sorted[id1]].symbol, orderInfo[sorted[id2]].symbol, false) > 0) ) ||
              ( (direction == DOWN) && (StringCompare(orderInfo[sorted[id1]].symbol, orderInfo[sorted[id2]].symbol, false) < 0) ) ) {
            tempID = sorted[id1];
            sorted[id1] = sorted[id2];
            sorted[id2] = tempID;
         } // if
      } // for
   } // for
}

void SortByMagic(int direction = UP) {

   int count = ArraySize(orderInfo);
   int tempID;

   for (int id=0; id < count; id++) sorted[id] = id;

   for (int id1=0; id1 < count-1; id1++ ) {
      for ( int id2=id1+1; id2 < count; id2++ ) {
         if ( ( (direction == UP) && ( orderInfo[sorted[id1]].magic > orderInfo[sorted[id2]].magic ) ) ||
              ( (direction == DOWN) && ( orderInfo[sorted[id1]].magic < orderInfo[sorted[id2]].magic ) ) ) {
            tempID = sorted[id1];
            sorted[id1] = sorted[id2];
            sorted[id2] = tempID;
         } // if
      } // for
   } // for
}

void SortByComment(int direction = UP) {

   int count = ArraySize(orderInfo);
   int tempID;

   for (int id=0; id < count; id++) sorted[id] = id;

   for (int id1=0; id1 < count-1; id1++ ) {
      for ( int id2=id1+1; id2 < count; id2++ ) {
         if ( ( (direction == UP) && (StringCompare(orderInfo[sorted[id1]].comment, orderInfo[sorted[id2]].comment, false) > 0) ) ||
              ( (direction == DOWN) && (StringCompare(orderInfo[sorted[id1]].comment, orderInfo[sorted[id2]].comment, false) < 0) ) ) {
            tempID = sorted[id1];
            sorted[id1] = sorted[id2];
            sorted[id2] = tempID;
         } // if
      } // for
   } // for
}

void SortByNrOfTrades(int direction = UP) {

   int count = ArraySize(orderInfo);
   int tempID;

   for (int id=0; id < count; id++) sorted[id] = id;

   for (int id1=0; id1 < count-1; id1++ ) {
      for ( int id2=id1+1; id2 < count; id2++ ) {
         if ( ( (direction == UP) && ( orderInfo[sorted[id1]].nrOfTrades > orderInfo[sorted[id2]].nrOfTrades ) ) ||
              ( (direction == DOWN) && ( orderInfo[sorted[id1]].nrOfTrades < orderInfo[sorted[id2]].nrOfTrades ) ) ) {
            tempID = sorted[id1];
            sorted[id1] = sorted[id2];
            sorted[id2] = tempID;
         } // if
      } // for
   } // for
}

void SortByNrOfBuyTrades(int direction = UP) {

   int count = ArraySize(orderInfo);
   int tempID;

   for (int id=0; id < count; id++) sorted[id] = id;

   for (int id1=0; id1 < count-1; id1++ ) {
      for ( int id2=id1+1; id2 < count; id2++ ) {
         if ( ( (direction == UP) && ( orderInfo[sorted[id1]].nrOfBuyTrades > orderInfo[sorted[id2]].nrOfBuyTrades ) ) ||
              ( (direction == DOWN) && ( orderInfo[sorted[id1]].nrOfBuyTrades < orderInfo[sorted[id2]].nrOfBuyTrades ) ) ) {
            tempID = sorted[id1];
            sorted[id1] = sorted[id2];
            sorted[id2] = tempID;
         } // if
      } // for
   } // for
}

void SortByNrOfSellTrades(int direction = UP) {

   int count = ArraySize(orderInfo);
   int tempID;

   for (int id=0; id < count; id++) sorted[id] = id;

   for (int id1=0; id1 < count-1; id1++ ) {
      for ( int id2=id1+1; id2 < count; id2++ ) {
         if ( ( (direction == UP) && ( orderInfo[sorted[id1]].nrOfSellTrades > orderInfo[sorted[id2]].nrOfSellTrades ) ) ||
              ( (direction == DOWN) && ( orderInfo[sorted[id1]].nrO

Показано первые 50% кода (символов: 31998)

Открыть по тарифу

Купите тариф с пакетом открытий или войдите, если тариф уже есть. Открытый файл останется в вашем кабинете навсегда.

Разовая покупка файла

На этой странице откроется полный исходный код файла вместо ознакомительного фрагмента.

Чтобы оформить заказ, введите email и перейдите к оплате.

Стоимость полного кода
3 199,80₽ ≈ $39.11