無料でロボットをダウンロードする方法を見る
Telegram上で私たちを見つけてください。
私たちのファンページに参加してください
興味深いスクリプト?
それではリンクにそれを投稿してください。-
他の人にそれを評価してもらいます
記事を気に入りましたか?MetaTrader 5ターミナルの中でそれを試してみてください。
ライブラリ

Permutations and Combinations (MT4) - MetaTrader 4のためのライブラリ

ビュー:
6745
評価:
(7)
パブリッシュ済み:
2018.04.11 10:56
アップデート済み:
2019.06.09 08:33
\MQL4\Include\ \MQL4\Scripts\Permutations\
このコードに基づいたロボットまたはインジケーターが必要なら、フリーランスでご注文ください フリーランスに移動

Introduction

It doesn't happen very often, but every once in awhile one needs to iterate over all of the combinations or permutations of a set of objects. Or more specifically, given a set of N objects, you want to consider k of them at a time (for each combination or permutation).

Practically, combinations and permutations algorithms can be used as a brute-force approach to solve certain problems, by trying every possible combination or permutation, until the optimal solution is found.

The circular k-permutations algorithm can be used in real world to solve parts of the Traveling Salesman Problem (TSP) or other similar problems like finding the currencies candidate for Triangular Arbitrage in Forex.

Below is a solution to each of these problems and more. The following generic algorithms permit to visit every combination or permutation of a sequence of length N, taken k items at time.


Performance Considerations

Every effort has been made to make this API library as fast as possible. Many algorithms and libraries for combinations/permutations were reviewed, and lot of benchmarks, code profiling and micro-optimizations were performed.

The Heap's algorithm in this library was re-implemented in a more efficient way that provides faster performance than its standard implementation.


The script 'CurrencyArbitrage_demo.mq4'

The included script scans all the possible 28 currency pairs from the 8 major currencies in Forex (usd, eur, gbp, aud, nzd, jpy, cad, chf). If an arbitrage opportunity that satisfies the profit threshold is found, it will be written to the the 'Experts' log along with the potential profit rate.

The script is a demonstration code that could be further implemented into an expert advisor / indicator to scan the market continuously for arbitrage opportunities. 


MACD Expert MACD Expert

Expert Advisor which trades signals from MACD indicator.

RSI Slowdown RSI Slowdown

The indicator is based on the idea that before the price and the indicator itself turn, the indicator rate slows down first and only then turns.

ADX Expert ADX Expert

MT4 Expert Advisor based on ADX indicator.

Multi Pair Closer Multi Pair Closer

Close all positions on a basket of currencies when the profit target has been reached.