gryps2/EA-code/handy_systems/EXPERIMENTAL/HS-E-002-SOMETHING-LONG-EXPERT-ADVISOR/HS-E-002-SOMETHING-LONG-EXPERT-ADVISOR.m
super.admin ae3f0ebf03 convert
2025-05-30 14:58:21 +02:00

74 lines
5.2 KiB
Mathematica

//+------------------------------------------------------------------+
//| HS-E-002-SOMETHING-LONG-EXPERT-ADVISOR.mq4 |
//| Copyright (c) 2024, HANDY SYSTEMS with TNK, All rights reserved |
//| |
//+------------------------------------------------------------------+
#property copyright "Copyright (c) 2024, HANDY SYSTEMS with TNK, All rights reserved"
#property version "1.0"
#property strict
// To convert the comment to GogoJungle format, uncomment from here.
//#define _GOGOJUNGLE
// To convert the comment to GogoJungle format, uncomment to here.
#ifdef _GOGOJUNGLE
const string STR_EA_ID = "XXXXX";
const string STR_EA_NAME = STR_EA_ID + ":" + WindowExpertName();
#else
const string STR_EA_NAME = WindowExpertName();
#endif // _GOGOJUNGLE
const string STR_OP_BUY = "BUY";
const string STR_OP_SELL = "SELL";
// comment string
const string STR_COMMENT_BUY = STR_EA_NAME + " " + STR_OP_BUY;
const string STR_COMMENT_SELL = STR_EA_NAME + " " + STR_OP_SELL;
// maximum character limit of MQL4
const int COMMENT_LENGTH = MathMax(StringLen(STR_COMMENT_BUY), StringLen(STR_COMMENT_SELL));
const int MAX_COMMENT_LENGTH = 31;
//+------------------------------------------------------------------+
//| Generic validation function |
//+------------------------------------------------------------------+
bool Validate(bool condition, string message)
{
if (!(condition))
{
Print("Validation failed: ", message);
return false;
}
return true;
}
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
// Validate if the comment length exceeds the maximum character length
if (!Validate(COMMENT_LENGTH <= MAX_COMMENT_LENGTH, "The comment exceeds the maximum character length"))
{
return(INIT_PARAMETERS_INCORRECT);
}
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
// Do nothing
}