backup ...
This commit is contained in:
@@ -0,0 +1,157 @@
|
||||
///////////////////////////////////////////////////////
|
||||
//
|
||||
// SaherElm IT Center MQL5 Common Library
|
||||
// --------------------------------------
|
||||
// Name: XCommonLib
|
||||
// Description: provide all commonly used functions ...
|
||||
//
|
||||
//
|
||||
// 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 "../Libraries/x-saherelm.common.extensions.lib.mq5"
|
||||
#include "../Libraries/x-saherelm.common.models.lib.mq5"
|
||||
#include "../Libraries/x-saherelm.x-ohcl.lib.mq5"
|
||||
|
||||
//
|
||||
// Models ...
|
||||
|
||||
//
|
||||
// Consolidation Zone ...
|
||||
struct XConsolidationZone
|
||||
{
|
||||
//
|
||||
// Props ...
|
||||
|
||||
//
|
||||
string symbol; // Symbol ...
|
||||
ENUM_TIMEFRAMES period; // Period ...
|
||||
|
||||
//
|
||||
double upper; // Upper ...
|
||||
double lower; // Lower ...
|
||||
|
||||
//
|
||||
datetime from; // Start Date
|
||||
datetime to; // Breake Date
|
||||
|
||||
//
|
||||
ENUM_X_DIRECTION dir; // Break Direction ...
|
||||
|
||||
//
|
||||
// Constructor ...
|
||||
XConsolidationZone()
|
||||
{
|
||||
Clean();
|
||||
}
|
||||
|
||||
//
|
||||
// Tools ...
|
||||
|
||||
/**
|
||||
* Cleanup ...
|
||||
*/
|
||||
void Clean()
|
||||
{
|
||||
//
|
||||
upper = 0;
|
||||
lower = 0;
|
||||
|
||||
//
|
||||
to = NULL;
|
||||
from = NULL;
|
||||
symbol = NULL;
|
||||
period = NULL;
|
||||
dir = X_DIRECTION_NONE;
|
||||
|
||||
//
|
||||
ZeroMemory(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate ...
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool IsValid()
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result =
|
||||
//
|
||||
upper > 0 &&
|
||||
lower > 0 &&
|
||||
IsValid(to) &&
|
||||
IsValid(from) &&
|
||||
IsValid(symbol) &&
|
||||
IsValid(period) &&
|
||||
HasDirection(dir)
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
bool IsSameAs(
|
||||
XConsolidationZone &item //
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result = IsValid() &&
|
||||
item.IsValid() &&
|
||||
dir == item.dir &&
|
||||
from == item.from &&
|
||||
upper == item.upper &&
|
||||
lower == item.lower &&
|
||||
symbol == item.symbol &&
|
||||
period == item.period;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve Unique Identifier ...
|
||||
*
|
||||
* @return ( string )
|
||||
*/
|
||||
string GetTag()
|
||||
{
|
||||
//
|
||||
string result =
|
||||
//
|
||||
"XCZONE" + "_" +
|
||||
ToString(dir) + "_" +
|
||||
symbol + "_" +
|
||||
ToString(period) + "_" +
|
||||
ToString(upper) + "_" +
|
||||
ToString(lower)
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
};
|
||||
|
||||
//
|
||||
Reference in New Issue
Block a user