MQLArticles/Utils/TfI/README.md
Nique_372 656e26c5f8
2026-09-06 11:25:00 -05:00

1.1 KiB

← Utils

Utils/TfI

O(1) timeframe lookup tables — avoids scattered switch(ENUM_TIMEFRAMES) blocks across the codebase.

Main features

  • Timeframe → period in seconds, via a precomputed table (g_mqlarticles_tfi_period_s).
  • Timeframe → descriptive names (full enum name, short uppercase, short lowercase) (g_mqlarticles_tfi_desc / MqlArticlesTfiDesc).
  • A hash-based jump table (seeds + final table) for fast lookups instead of linear search (generated via SimPHash).

Basic usage

// Example: Given a timeframe (in this case, the period current as an example; it could be a variable, etc.), 
// you want to quickly convert that variable to a short description "M1" 
// without using EnumToString and StringReplace + To Upper/ToLower. Instead,
//  you use a quick access method with an alg hash (perfect hash), a single click, a mul, a
// nd a shift... and that's it! You now have an index with which you can query properties.  
const string decs = g_mqlarticles_tfi_desc[MqlArticlesTfiIdx(PERIOD_CURRENT)].full_name; 
Print(decs);