SimPHash/SimpHash.mq5

61 lines
2.6 KiB
MQL5

2026-09-06 09:01:53 -05:00
//+------------------------------------------------------------------+
//| SimpHash.mq5 |
//| Copyright 2026, Niquel Mendoza. |
//| https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2026, Niquel Mendoza."
#property link "https://www.mql5.com"
#property version "1.2"
#property icon "logo.ico"
#property script_show_inputs
#property strict
2026-09-06 14:45:02 -05:00
#property description "SimpHash is a script from the TSN ecosystem that allows you to generate perfect hash tables via YAML file in a quick and easy way."
2026-09-06 09:01:53 -05:00
//+------------------------------------------------------------------+
//| Defines |
//+------------------------------------------------------------------+
2026-09-06 20:08:32 -05:00
#define SIMPHASH_ENABLE_DLL
2026-09-06 09:01:53 -05:00
//+------------------------------------------------------------------+
//| Include |
//+------------------------------------------------------------------+
#include "Src\\PerfectHash.mqh"
//+------------------------------------------------------------------+
//| Inputs |
//+------------------------------------------------------------------+
sinput group "-- Config --"
#ifdef SIMPHASH_ENABLE_DLL
input string InpYamlFileName = "C:\\Users\\USER\\AppData\\Roaming\\MetaQuotes\\Terminal\\D0E8209F77C8CF37AD8BF550E51FF075\\MQL5\\Shared Projects\\SimPHash\\Src\\Test\\config.yaml"; // Yaml file ubication
#else // SIMPHASH_ENABLE_DLL
input bool InpYamlInCommon = true; // Yaml file in common files ?
input string InpYamlFileName = "pfh\\config.yaml"; // Yaml file ubication
#endif // SIMPHASH_ENABLE_DLL
input ENUM_VERBOSE_LOG_LEVEL InpLogLevel = VERBOSE_LOG_LEVEL_ALL; // Log level
//+------------------------------------------------------------------+
//| Script program start function |
//+------------------------------------------------------------------+
int OnStart()
{
//---
TSN::CPerfectHashGenerator ph;
ph.AddLogFlags(InpLogLevel);
//---
#ifdef SIMPHASH_ENABLE_DLL
if(!ph.Init(InpYamlFileName))
return INIT_PARAMETERS_INCORRECT;
#else
if(!ph.Init(InpYamlFileName, InpYamlInCommon))
return INIT_PARAMETERS_INCORRECT;
#endif // SIMPHASH_ENABLE_DLL
//---
if(!ph.RunAlg())
return INIT_FAILED;
//---
return INIT_SUCCEEDED;
}
//+------------------------------------------------------------------+