거래 로봇을 무료로 다운로드 하는 법을 시청해보세요
당사를 Twitter에서 찾아주십시오!
당사 팬 페이지에 가입하십시오
스크립트가 흥미로우신가요?
그렇다면 링크 to it -
하셔서 다른 이들이 평가할 수 있도록 해보세요
스크립트가 마음에 드시나요? MetaTrader 5 터미널에서 시도해보십시오
라이브러리

gnome sort - array sorting algorithm - MetaTrader 5용 라이브러리

조회수:
3388
평가:
(13)
게시됨:
2021.02.03 06:41
\MQL5\Include\Mqh\Algorithms\SortGnome\
GnomeSort.mqh (3.61 KB) 조회
Functions.mqh (5.24 KB) 조회
\MQL5\Include\Mqh\Algorithms\
ASorter.mqh (3.48 KB) 조회
\MQL5\Include\Mqh\Universal\
이 코드를 기반으로 한 로봇이나 지표가 필요하신가요? 프리랜스로 주문하세요 프리랜스로 이동
//+------------------------------------------------------------------+
//|                                                    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.