Files
MQL5Data/X121SMCEA/Libraries/x-121.smc.lib.mq5
T

196 lines
3.6 KiB
Plaintext

///////////////////////////////////////////////////////
//
// SaherElm IT Center MQL5 Seriallize Library
// ---------------------------------------
// Name: X121SMCLib
// Description: All models related to X121SMC ...
//
//
// Maintainer:
// ------------
// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com)
//
//////////////////////////////////////////////////////
//
// Global Properties ...
#property library
#property copyright "Copyright 2023, SaherElm IT Center"
#property link "https://www.saherelm.ir"
#property version "1.00"
#property strict
//
// Imports ...
#include "../../Classes/x-saherelm.base.class.mq5"
#include "../../Libraries/x-saherelm.common.lib.mq5"
#include "../../Libraries/x-saherelm.x-poi.lib.mq5"
#include "../../Libraries/x-saherelm.xtrade.lib.mq5"
//
// Definitions ...
//
// Specific Identifier(s) of XStrategy ...
string X121SMCStrategyToken = "X121SMC";
//
// Condition Structure ...
struct X121SMCStrategyConditions
{
//
// Props ...
//
// Common ...
string symbol;
ENUM_TIMEFRAMES period;
datetime time;
//
// Helper Conditions ...
//
// Constructor ...
void XStrategyConditions()
{
Clean();
}
//
// Tools ...
//
// Cleanup ...
void Clean()
{
//
symbol = NULL;
period = NULL;
time = NULL;
//
// Clean Helpers Conditions ...
}
//
// Validate ...
bool IsValid()
{
//
bool result = false;
//
result =
//
IsValid(time) &&
IsValid(symbol) &&
IsValid(period)
//
;
//
return result;
}
//
// Generate Provided Scores ...
void GenerateScore(
double &bullishScore,
double &bearishScore //
)
{
//
bullishScore = 0;
bearishScore = 0;
//
if (!IsValid())
{
return;
}
//
double bullScore = 0;
double bearScore = 0;
//
// Generate Helpers Conitions Scores ...
}
//
// Generate Summary ...
string GenerateSummary(
bool onlyCommons = false,
bool onlyConditions = false,
bool includeScores = true,
bool ignoreFalseConditions = true,
string separator = "\n" //
)
{
//
string result = NULL;
//
double bullishScore = 0;
double bearishScore = 0;
GenerateScore(
bullishScore,
bearishScore //
);
//
string commonStr = GenerateSpecifiedCommonSummary(
this,
separator,
includeScores,
true //
);
//
// Generate Helpers Conditions Strings ...
//
// Combine Helpers Conditions Strings ...
string conditionsStr =
//
"" + separator +
""
//
;
//
result =
//
"[" + GetTag() + "]" + separator +
"----------" + separator +
(onlyConditions
? ""
: commonStr) +
" " + separator +
(onlyCommons
? ""
: conditionsStr) +
""
//
;
//
return result;
}
//
string GetTag()
{
return X121SMCStrategyToken;
}
//
};
//
// On Signal Event Handler ...
typedef void (*TOnX121SMCSignal)(
XSignal &signal,
X121SMCStrategyConditions &conditions //
);