Skip to content
All library documents

Combinatorics Functions for Counting Signal Subsets and Orderings

Article MQL5 code base

Summary

This document introduces core combinatorics concepts through examples involving trading signals. It distinguishes combinations, where only the selected elements matter, from arrangements, where their order matters. It also describes versions that allow repeated elements, alongside factorials and permutations, which count possible orderings of a set. These functions can help estimate how many candidate signal groups or sequences a researcher may need to consider.

Examples use a pool of ten signals and selections of three to illustrate counts for combinations, combinations with repetition, arrangements, and arrangements with repetition. The text also explains that factorials grow rapidly, motivating a floating-point return type. It is an introductory description rather than a complete implementation guide: it provides function signatures and examples but no formulas for every function, input validation, overflow or precision handling, or discussion of how to evaluate strategies built from the counted possibilities. The examples teach counting concepts, not evidence that any particular signal selection is profitable.

Key ideas

  • Combinations count selections when the order of chosen elements does not matter.
  • Arrangements count selections where different orders are treated as distinct.
  • Combinations and arrangements can be defined to allow repeated elements.
  • Factorials count permutations and grow rapidly as the input increases.
  • Counting candidate signal sets describes a search space but does not establish trading performance.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.