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

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

조회수:
2684
평가:
(11)
게시됨:
2021.01.27 08:12
\MQL5\Include\Mqh\Algorithms\SortInsertion\
Functions.mqh (5.96 KB) 조회
\MQL5\Include\Mqh\Algorithms\
ASorter.mqh (3.12 KB) 조회
\MQL5\Include\Mqh\Universal\
이 코드를 기반으로 한 로봇이나 지표가 필요하신가요? 프리랜스로 주문하세요 프리랜스로 이동
//+------------------------------------------------------------------+
//|                                                InsertionSort.mq5 |
//|                                    2019-2021, dimitri pecheritsa |
//|                                         mql5.com/en/users/dmipec |
//|------------------------------------------------------------------|
//| cls | insertion sort                                             |
//|------------------------------------------------------------------|
//| use | array sorting algorithm                                    |
//|  best: n; average: n^2; worst: n^2                               |
//|  memory: 1; stable: yes; method: insertion                       |
//|  note: o(n + d), in the worst case over sequences that have d    |
//|inversions.                                                       |
//|------------------------------------------------------------------|
//|  insertion sort is a simple sorting algorithm that builds the    |
//|final sorted array (or list) one item at a time. it is much less  |
//|efficient on large lists than more advanced algorithms such as    |
//|quicksort, heapsort, or merge sort.                               |
//|  when people manually sort cards in a bridge hand, most use a    |
//|method that is similar to insertion sort.                         |
//|  insertion sort provides several advantages:                     |
//|  | simple implementation: jon bentley shows a three-line c       |
//|version, and a five-line optimized version                        |
//|  | efficient for (quite) small data sets, much like other        |
//|quadratic sorting algorithms                                      |
//|  | more efficient in practice than most other simple quadratic   |
//|(i.e., o(n^2)) algorithms such as selection sort or bubble sort   |
//|  | adaptive, i.e., efficient for data sets that are already      |
//|substantially sorted: the time complexity is o(kn) when each      |
//|element in the input is no more than k places away from its sorted|
//|position                                                          |
//|  | stable; i.e., does not change the relative order of elements  |
//|with equal keys                                                   |
//|  | in-place; i.e., only requires a constant amount o(1) of       |
//|additional memory space                                           |
//|  | online; i.e., can sort a list as it receives it               |
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
//| script   | insertion sort example. sort deals by type            |
//|------------------------------------------------------------------|
//| on start | script program start function                         |
//+------------------------------------------------------------------+
#include <Mqh\Algorithms\SortInsertion\InsertionSort.mqh>
#include <Mqh\Algorithms\SortInsertion\Functions.mqh>
void OnStart(void)
  {
//--- load deals from the terminal for some arbitrary date range in
//the past. these are the items array for the sorter
   ulong deals[];
   DealsLoad(deals,D'2020.12.21',D'2020.12.31');
//--- now create keys array with the deal type values. enumerations
//are integers
   int type[];
   DealsKeyType(deals,type);
//--- sort with insertion sort algorithm
   ArraySort(type,deals,new CInsertionSort<int,ulong>,true);
//--- check the result of sorting by printing a table of symbols
   DealsPrint(deals);
  }
//--------------------------------------------------------------------
//                 deal |        symbol |          type
//--------------------------------------------------------------------
//            169296305 |        BTCUSD | DEAL_TYPE_BUY
//            169300850 |        BTCUSD | DEAL_TYPE_BUY
//            169301072 |        BTCUSD | DEAL_TYPE_BUY
//            169381662 |        BTCUSD | DEAL_TYPE_BUY
//            169400687 |        BTCUSD | DEAL_TYPE_BUY
//            169406060 |        BTCUSD | DEAL_TYPE_BUY
//            169500503 |     .US30Cash | DEAL_TYPE_BUY
//            169500799 |        EURUSD | DEAL_TYPE_BUY
//            169567749 |          TSLA | DEAL_TYPE_BUY
//            169567752 |         BRENT | DEAL_TYPE_BUY
//            169567757 |          TSLA | DEAL_TYPE_BUY
//            169567759 |         BRENT | DEAL_TYPE_BUY
//            169567764 |          TSLA | DEAL_TYPE_BUY
//            169567768 |         BRENT | DEAL_TYPE_BUY
//            169567777 |          TSLA | DEAL_TYPE_BUY
//            169567781 |         BRENT | DEAL_TYPE_BUY
//            169567811 |        EURUSD | DEAL_TYPE_BUY
//            169567820 |        BTCUSD | DEAL_TYPE_BUY
//            169567821 |     .US30Cash | DEAL_TYPE_BUY
//            169567825 |        BTCUSD | DEAL_TYPE_BUY
//            169567826 |     .US30Cash | DEAL_TYPE_BUY
//            169567828 |        BTCUSD | DEAL_TYPE_BUY
//            169567833 |        BTCUSD | DEAL_TYPE_BUY
//            169567837 |        BTCUSD | DEAL_TYPE_BUY
//            169567838 |     .US30Cash | DEAL_TYPE_BUY
//            169567839 |        BTCUSD | DEAL_TYPE_BUY
//            169569207 |     .US30Cash | DEAL_TYPE_BUY
//            169301176 |        BTCUSD | DEAL_TYPE_SELL
//            169519767 |        USDRUB | DEAL_TYPE_SELL
//            169525883 |        USDRUB | DEAL_TYPE_SELL
//            169567751 |        EURUSD | DEAL_TYPE_SELL
//            169567753 |        BTCUSD | DEAL_TYPE_SELL
//            169567755 |     .US30Cash | DEAL_TYPE_SELL
//            169567756 |        USDRUB | DEAL_TYPE_SELL
//            169567758 |        EURUSD | DEAL_TYPE_SELL
//            169567761 |        BTCUSD | DEAL_TYPE_SELL
//            169567762 |     .US30Cash | DEAL_TYPE_SELL
//            169567763 |        USDRUB | DEAL_TYPE_SELL
//            169567765 |        EURUSD | DEAL_TYPE_SELL
//            169567769 |        BTCUSD | DEAL_TYPE_SELL
//            169567771 |     .US30Cash | DEAL_TYPE_SELL
//            169567773 |        USDRUB | DEAL_TYPE_SELL
//            169567778 |        EURUSD | DEAL_TYPE_SELL
//            169567782 |        BTCUSD | DEAL_TYPE_SELL
//            169567788 |     .US30Cash | DEAL_TYPE_SELL
//            169567792 |        USDRUB | DEAL_TYPE_SELL
//            169567808 |          TSLA | DEAL_TYPE_SELL
//            169567817 |         BRENT | DEAL_TYPE_SELL
//            169567824 |          TSLA | DEAL_TYPE_SELL
//            169567841 |        BTCUSD | DEAL_TYPE_SELL
//            169567896 |         BRENT | DEAL_TYPE_SELL
//            169568039 |        USDRUB | DEAL_TYPE_SELL
//--------------------------------------------------------------------
    Breakout Strength Meter - MT5 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

    Log4mql(mini) MT5 Log4mql(mini) MT5

    A light header-only version of Log4mql that provides standardized logging.

    Buy using amount instead of lots Buy using amount instead of lots

    I find the lot calculation tedious so I just use this script and tell it the dollar amount to use. It then does the rest. This works for any currency.

    Sell using amount instead of lots Sell using amount instead of lots

    I find the lot calculation tedious so I just use this script and tell it the dollar amount to use. It then does the rest. This works for any currency.