Guarda come scaricare robot di trading gratuitamente
Ci trovi su Telegram!
Unisciti alla nostra fan page
Script interessante?
Pubblica il link!
lasciare che altri lo valutino
Ti è piaciuto lo script? Provalo nel Terminale MetaTrader 5
Librerie

gnome sort - array sorting algorithm - libreria per MetaTrader 5

Visualizzazioni:
3646
Valutazioni:
(13)
Pubblicato:
2021.02.03 06:41
\MQL5\Include\Mqh\Algorithms\SortGnome\ \MQL5\Include\Mqh\Algorithms\ \MQL5\Include\Mqh\Universal\
Freelance MQL5 Hai bisogno di un robot o indicatore basato su questo codice? Ordinalo su Freelance Vai a Freelance
//+------------------------------------------------------------------+
//|                                                    GnomeSort.mq5 |
//|                                    2019-2021, dimitri pecheritsa |
//|                                         mql5.com/en/users/dmipec |
//|------------------------------------------------------------------|
//|  c  | gnome sort                                                 |
//|------------------------------------------------------------------|
//| use | array sorting algorithm                                    |
//|  best: n; average: n^2; worst: n^2                               |
//|  memory: 1; stable: yes; method: exchanging                      |
//|  note: tiny code size                                            |
//|  originally proposed by iranian computer scientist hamid         |
//|sarbazi-azad (professor of computer science and engineering at    |
//|sharif university of technology) in 2000. the sort was first      |
//|called stupid sort (not to be confused with bogosort), and then   |
//|later described by dick grune and named gnome sort.               |
//|  the gnome sort is a sorting algorithm which is similar to       |
//|insertion sort in that it works with one item at a time but gets  |
//|the item to the proper place by a series of swaps, similar to a   |
//|bubble sort. it is conceptually simple, requiring no nested loops.|
//|the average running time is o(n^2) but tends towards o(n) if the  |
//|list is initially almost sorted.                                  |
//|  the algorithm finds the first place where two adjacent elements |
//|are in the wrong order and swaps them. it takes advantage of the  |
//|fact that performing a swap can introduce a new out-of-order      |
//|adjacent pair next to the previously swapped elements. it does not|
//|assume that elements forward of the current position are sorted,  |
//|so it only needs to check the position directly previous to the   |
//|swapped elements.                                                 |
//|------------------------------------------------------------------|
//|  f  | script program start function                              |
//|------------------------------------------------------------------|
//| use | gnome sort example. sort market watch symbols by spread    |
//+------------------------------------------------------------------+
#include <Mqh\Algorithms\SortGnome\GnomeSort.mqh>
#include <Mqh\Algorithms\SortGnome\Functions.mqh>
void OnStart(void)
  {
//--- load symbols from the warket watch window
   string symbols[];
   SymbolsLoad(symbols);
//--- load spreads of the symbols 
   int keys[];
   SymbolKeysSpread(symbols,keys);
//--- sort symbols by spread in accending order 
   ArraySort(keys,symbols,new CGnomeSort<int,string>);
//--- print a table of symbols to check result
   SymbolsPrint(symbols);
  }
//--------------------------------------------------------------------
//               symbol |   spread |    point
//--------------------------------------------------------------------
//                BRENT |        6 |     0.01
//               EURUSD |       16 |    1E-05
//            .US30Cash |       16 |      0.1
//                 TSLA |       47 |     0.01
//               XAUUSD |      300 |    0.001
//               USDRUB |      672 |   0.0001
//               BTCUSD |    13833 |     0.01
//--------------------------------------------------------------------
    INDICATOR Breakout Strength Meter - MT5 INDICATOR Breakout Strength Meter - MT5

    The breakout strength meter is a trading tool that is used to identify which currencies are the strongest to breakout, and which currencies are the weakest to breakout

    Spread data collector Spread data collector

    This EA collects information about the spreads and Shows the number of spreads in the specified range based on the ticks that occur each year.

    introsort - array sorting algorithm introsort - array sorting algorithm

    hybrid sorting algorithm that provides both fast average performance and (asymptotically) optimal worst-case performance

    Currency Strenght Meter - MT5 Currency Strenght Meter - MT5

    The currency strength meter is a trading tool that is used to identify trending and consolidating markets based on the percentage rate of change in price from one period to the next.