159 lines
2.6 KiB
Plaintext
159 lines
2.6 KiB
Plaintext
///////////////////////////////////////////////////////
|
|
//
|
|
// SaherElm IT Center MQL5 Helper Parser Class Library
|
|
// ----------------------------------------------------
|
|
// Name: XCX121XSDEHelperParser
|
|
// Description: provides all Indicator
|
|
// Helper Parse requirements ...
|
|
//
|
|
//
|
|
// 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.x121.xsde.lib.mq5"
|
|
|
|
//
|
|
// Definitions ...
|
|
|
|
//
|
|
// Implementation ...
|
|
|
|
class XCX121XSDEHelperParser : XCBase
|
|
{
|
|
//
|
|
// Public ...
|
|
public:
|
|
//
|
|
string symbol;
|
|
ENUM_TIMEFRAMES period;
|
|
|
|
//
|
|
// Constructor ...
|
|
XCX121XSDEHelperParser(
|
|
string _symbol = NULL,
|
|
ENUM_TIMEFRAMES _period = NULL //
|
|
)
|
|
{
|
|
//
|
|
// Normalize ...
|
|
if (!IsXValid(_symbol))
|
|
{
|
|
_symbol = _Symbol;
|
|
}
|
|
if (!IsXValid(_period))
|
|
{
|
|
_period = _Period;
|
|
}
|
|
|
|
//
|
|
symbol = _symbol;
|
|
period = _period;
|
|
}
|
|
|
|
//
|
|
// Deconstructor ...
|
|
~XCX121XSDEHelperParser()
|
|
{
|
|
}
|
|
|
|
//
|
|
// Tools ...
|
|
|
|
/**
|
|
* Validate ...
|
|
*
|
|
* @return ( bool )
|
|
*/
|
|
bool IsValid()
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
result =
|
|
IsXValid(symbol) &&
|
|
IsXValid(period);
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Retrieve Bars ...
|
|
int CountBars()
|
|
{
|
|
//
|
|
int result =
|
|
Bars(
|
|
symbol,
|
|
period
|
|
//
|
|
);
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Normalize Bar Index ...
|
|
*
|
|
* @param barIndex: int, Provided Bar Index ...
|
|
*
|
|
* @return ( int )
|
|
*/
|
|
int NormalizeBarIndex(int barIndex = 0)
|
|
{
|
|
//
|
|
int result = -1;
|
|
|
|
//
|
|
if (!IsValid())
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
int count = CountBars() - 1;
|
|
result = NormalizeInt(result, 0, count - 1);
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
double GetPoints()
|
|
{
|
|
return GetXPoints(symbol);
|
|
}
|
|
|
|
//
|
|
// Parsers ...
|
|
// Indicators Base Conditions ...
|
|
|
|
//
|
|
// Protected ...
|
|
protected:
|
|
//
|
|
|
|
//
|
|
// Private ...
|
|
private:
|
|
//
|
|
|
|
//
|
|
};
|
|
|
|
//
|