forked from nique_372/SimPHash
61 lines
2.6 KiB
MQL5
61 lines
2.6 KiB
MQL5
//+------------------------------------------------------------------+
|
|
//| 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
|
|
#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."
|
|
|
|
//+------------------------------------------------------------------+
|
|
//| Defines |
|
|
//+------------------------------------------------------------------+
|
|
#define SIMPHASH_ENABLE_DLL
|
|
|
|
//+------------------------------------------------------------------+
|
|
//| 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;
|
|
}
|
|
//+------------------------------------------------------------------+
|