Files
xMQL5/MQLTestWorkspace/BKPS/14030222/Classes/x-saherelm.xhelper.class.mq5
T
2024-05-11 05:36:03 +03:30

210 lines
3.1 KiB
Plaintext

///////////////////////////////////////////////////////
//
// SaherElm IT Center MQL5 Class Library
// ----------------------------------------------
// Name: XSCBaseHelper
// Description: provides all Base Indicator
// Helper 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
//
// START Definitions ...
//
//
// END Definitions ...
//
//
// START Import and Inclused requirements ...
//
//
// Includes ...
#include "../Libraries/x-saherelm.common.lib.mq5"
//
// END Import and Inclused requirements ...
//
//
// START Overrides ...
//
//
// END Overrides ...
//
//
// a Class for Handle base requirements ...
// for indicators ...
class XSCBaseHelper
{
//
// Public ...
public:
//
// Constructor ...
void XSCBaseHelper(
string symbol, // Trading Symbol
ENUM_TIMEFRAMES period // Trading Time Frame
)
{
//
mSymbol = symbol;
mPeriod = period;
//
LoopBack(52);
}
//
// Deconstructor ...
void ~XSCBaseHelper()
{
IndicatorRelease(mHandler);
}
//
// START Properties ...
//
//
// Loopback Bars ...
void LoopBack(int value)
{
mLoopbackBars = value;
}
int Loopback()
{
return mLoopbackBars;
}
//
// Symbol ...
string GetSymbol()
{
return mSymbol;
}
//
// Period ...
ENUM_TIMEFRAMES GetPeriod()
{
return mPeriod;
}
//
// Tag ...
string GetTag()
{
return mTag;
}
//
// Retrieve Bars ...
int GetBars()
{
//
int result =
Bars(
mSymbol,
mPeriod);
//
return result;
}
//
int GetCalculatedBars()
{
return BarsCalculated(mHandler);
}
//
// END Properties ...
//
//
// START Provided Functions ...
//
//
// Prepare Tag ...
virtual void PrepareTag() {}
//
// Reading Buffers based on Given Bar Index ...
virtual void Calculate(
int barIndex // Given Bar Index
);
//
// Retrieve MAx Required Length for Calculations ...
virtual int GetMaxLength();
//
// END Provided Functions ...
//
//
// Protected ...
protected:
//
string GetTagPrefix()
{
//
string result = "(" + mSymbol + ")(" + ToString(mPeriod) + ")";
//
return result;
}
//
// Symbol ...
string mSymbol;
//
// Period ...
ENUM_TIMEFRAMES mPeriod;
//
// Indicator Handler ...
int mHandler;
//
// Number Of Items Read Per Tick ...
int mLoopbackBars;
//
// Tag Identifier ...
string mTag;
//
// Private ...
private:
//
};
//
// START Usefull Functions ...
//
//
// END Usefull Functions ...
//