당사 팬 페이지에 가입하십시오
- 조회수:
- 2773
- 평가:
- 게시됨:
- 2022.12.21 03:16
- 업데이트됨:
- 2023.02.10 13:17
-
이 코드를 기반으로 한 로봇이나 지표가 필요하신가요? 프리랜스로 주문하세요 프리랜스로 이동
Introspective Sort
Intro or Introspective sort is a hybrid sorting algorithm that provide fast performance. It is a comparison based sorting algorithm based on three phases. It uses the quicksort sort along with heapsort and insertion-sort algorithms.Quick Sort
Quick sort is a divide and conquer algorithm which works by selecting a pivot element in the array, then partitions the other elements into two subarrays checking the condition whether the elements are greater or smaller. On average the quick sort alogirthm takes O(nlog(n)) time, with worst case complexity of O(n2).
Heap Sort
Heap sort algoirthm is a binary-heap based comparison based sorting method. It is an unstable sorting algorithm with worst case and average case time complexity of O(nlog(n)), and best case time complexity of O(n).
Insertion Sort
Insertion sort algorithm is a simple sorting method that builds the final sorted array one item at a time. It's time complexity for worst case and average case is O(n2) and best case is O(n).
Introsort algorithm combines the good parts of these three algorithms. It begins with quick sort, switching to heapsort when the recursion depth exceeds a level based on the number of elements begin sorted and switchs to insertion sort when the number of elements are less than some threshold value.
- If the partition size is such that there is a possibility to exceed the maximum depth limit then the Introsort switches to Heapsort.
- If the partition size is too small then Quicksort switches to Insertion Sort.
- If the partition size is under the limit and not too small, then it performs a simple quicksort.
Introsort has particularly good runtime behavior. It is one of the fastest comparison sorting, algorithms in use today, and is the usual implementation of the std::sort algorithm provided with the C++ STL, Microsoft .NET Framework Class Library, GNU Standard C++ library, and LLVM libc++ library.
References:
http://en.wikipedia.org/wiki/Introsort
https://iq.opengenus.org/intro-sort/
Code:
//+------------------------------------------------------------------+ //| Introsort | //+------------------------------------------------------------------+ /** * Sort the input array in-place using comparison function less. * You can specify your own comparison function. If no function is * specified, ascending sort is used. */ template<typename T> void Introsort(T &arr[]);
Comparison function Less:
You can specify your own comparison function. If no function is specified, ascending sort is used. A custom Less() function takes two arguments and contains logic to decide their relative order in the sorted array. The idea is to provide flexibility so that Introsort() can be used for any type (including user defined types) and can be used to obtain any desired order (increasing, decreasing or any other). For example, to sort an array of objects or structures (user defined types) in a custom sort order:
bool Less(const CRecord& left, const CRecord& right) { // sort on key a in descending order if(left.a > right.a) return(true); if(left.a < right.a) return(false); // if two objects are equal on key a, // sort on key b in ascending order if(left.b < right.b) return(true); if(left.b > right.b) return(false); ... ... //--- all keys are equal return(false); }
![Volume Average percent spread mod](https://c.mql5.com/i/code/indicator.png)
Volume Average percent spread mod
![Lazy Bot MT5 (Daily Breakout EA)](https://c.mql5.com/i/code/expert.png)
- This Bot use stratery Breakout of Daily Bar, I tested for 3 Pair currency : GBPUSD, EURUSD, XAUUSD - Default setting is not sure the best, you can test for your parameter. - This is version for MT5 that convert from MT4 - this EA is best for broker low spread
![Smooth Algorithms - Corrected/Modified](https://c.mql5.com/i/code/library.png)
Smooth Algorithms - Corrected/Modified
![Volumes Spread mod](https://c.mql5.com/i/code/indicator.png)
Volumes Spread mod