Files
xMQL5/MQLTestWorkspace/BKPS/14030322/Classes/x-saherelm.xprovider.class.mq5
T

171 lines
2.7 KiB
Plaintext

///////////////////////////////////////////////////////
//
// SaherElm IT Center MQL5 Class Library
// ----------------------------------------------
// Name: XSCBaseProvider
// Description: provides all Base Provider
// 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
//
// Includes ...
#include "../Classes/x-saherelm.xalert.class.mq5"
#include "../Libraries/x-saherelm.xtrade.lib.mq5"
//
// Class ...
//
// Base Provider Class ...
class XSCBaseProvider : public XSCBaseAlert
{
//
// Public ...
public:
//
// Props ...
//
// Constructor ...
XSCBaseProvider(
string symbol, // Trading Symbol
ENUM_TIMEFRAMES period // Trading Period
)
{
//
// Initialize Cycle ...
mCycle.Init(
symbol,
period,
X_MARKET_CYCLE_SHORT,
X_PERIOD_MANUALLY,
period,
"HOST Period"
//
);
}
//
// Deconstructor ...
~XSCBaseProvider()
{
DeInit();
}
//
// Properties Gettr(s) / Setter(s) ...
//
// DeInit all Requirements ...
virtual void DeInit();
//
// Functions ...
//
string GetSymbol()
{
return mCycle.symbol;
}
//
ENUM_TIMEFRAMES GetPeriod()
{
return mCycle.hostPeriod;
}
//
// Count Bars ...
int CountBars()
{
//
return mCycle
.CountBars();
}
//
// Check New Bar ...
bool IsNewBar()
{
//
return mCycle
.IsNewBar();
}
//
// Can Ignore Process ...
bool CanIgnoreProcess()
{
//
bool result = false;
//
result =
//
IsRunningOnTestMode()
? !IsNewBar()
: !IsNewBar() && mWaitsUntilNewBar
//
;
//
if (!result)
{
mWaitsUntilNewBar = false;
}
//
return result;
}
//
// Toggle Waititng Until New Candle ...
void ToggleWaitingUntilNewBar()
{
mWaitsUntilNewBar = !mWaitsUntilNewBar;
}
//
void SetWaitsUntilNewBar(bool value)
{
mWaitsUntilNewBar = value;
}
//
// Protected ...
protected:
//
// Props ...
//
XMarketCycle mCycle;
//
bool mWaitsUntilNewBar;
//
// Private ...
private:
//
// Props ...
//
// Tools ...
};
//
// Tools ...