refactor some typos on helper classes and implement base classes for providers and start x5 provider ...
This commit is contained in:
@@ -0,0 +1,396 @@
|
|||||||
|
///////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// SaherElm IT Center MQL5 Class Library
|
||||||
|
// ----------------------------------------------
|
||||||
|
// Name: XSCBaseX5Provider
|
||||||
|
// Description: provides all Base Provider
|
||||||
|
// requirements For X5 ...
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// 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 "../Helpers/x-saherelm.xct.helper.mq5"
|
||||||
|
#include "../Helpers/x-saherelm.xcc.helper.mq5"
|
||||||
|
#include "../Helpers/x-saherelm.xtm.helper.mq5"
|
||||||
|
#include "../Helpers/x-saherelm.xama.helper.mq5"
|
||||||
|
#include "../Helpers/x-saherelm.xlh.helper.mq5"
|
||||||
|
#include "../Helpers/x-saherelm.xtd.helper.mq5"
|
||||||
|
#include "../Helpers/x-saherelm.xfi.helper.mq5"
|
||||||
|
#include "../Helpers/x-saherelm.xts.helper.mq5"
|
||||||
|
#include "../Helpers/x-saherelm.xrsi.helper.mq5"
|
||||||
|
#include "../Helpers/x-saherelm.xobd.helper.mq5"
|
||||||
|
#include "../Helpers/x-saherelm.xchlh.helper.mq5"
|
||||||
|
#include "../Helpers/x-saherelm.xchma.helper.mq5"
|
||||||
|
|
||||||
|
//
|
||||||
|
#include "../Classes/x-saherelm.xprovider.class.mq5"
|
||||||
|
|
||||||
|
//
|
||||||
|
// Definitions ...
|
||||||
|
|
||||||
|
//
|
||||||
|
enum ENUM_X5_SIGNAL_PROVIDERS
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// XSP Expert Support Mechanism ...
|
||||||
|
XSP,
|
||||||
|
//
|
||||||
|
// XTD ...
|
||||||
|
XTD,
|
||||||
|
//
|
||||||
|
// XTAM ...
|
||||||
|
XTAM,
|
||||||
|
//
|
||||||
|
// XSI ...
|
||||||
|
XSI,
|
||||||
|
//
|
||||||
|
// XTSFI ...
|
||||||
|
XTSFI,
|
||||||
|
//
|
||||||
|
// XOBDLH ...
|
||||||
|
XOBDLH,
|
||||||
|
//
|
||||||
|
// XCHMACC ...
|
||||||
|
XCHMACC,
|
||||||
|
//
|
||||||
|
// XCHMACMN ...
|
||||||
|
XCHMAMN,
|
||||||
|
//
|
||||||
|
// XCHMACMX ...
|
||||||
|
XCHMAMX,
|
||||||
|
};
|
||||||
|
|
||||||
|
//
|
||||||
|
// X5 Provider Inputs ...
|
||||||
|
class X5ProviderInputs : public XSCBaseProviderInpts
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Public ...
|
||||||
|
public:
|
||||||
|
//
|
||||||
|
// Props ...
|
||||||
|
XTMInputs tmInputs;
|
||||||
|
XLHInputs lhInputs;
|
||||||
|
XTDInputs tdInputs;
|
||||||
|
XFIInputs fiInputs;
|
||||||
|
XCTInputs ctInputs;
|
||||||
|
XCCInputs ccInputs;
|
||||||
|
XOBDInputs obdInputs;
|
||||||
|
XAMAInputs amaInputs;
|
||||||
|
XRSIInputs rsiInputs;
|
||||||
|
XCHLHInputs chlhInputs;
|
||||||
|
XCHMAInputs chmaInputs;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Tools ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// Validate ...
|
||||||
|
virtual bool IsValid()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
result = ctInputs.IsValid();
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
result = ccInputs.IsValid();
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
result = tmInputs.IsValid();
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
result = lhInputs.IsValid();
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
result = tdInputs.IsValid();
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
result = fiInputs.IsValid();
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
result = obdInputs.IsValid();
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
result = amaInputs.IsValid();
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
result = rsiInputs.IsValid();
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
result = chlhInputs.IsValid();
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
result = chmaInputs.IsValid();
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Cleanup ...
|
||||||
|
virtual void Clean()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
ctInputs.Clean();
|
||||||
|
ccInputs.Clean();
|
||||||
|
tmInputs.Clean();
|
||||||
|
lhInputs.Clean();
|
||||||
|
tdInputs.Clean();
|
||||||
|
fiInputs.Clean();
|
||||||
|
obdInputs.Clean();
|
||||||
|
amaInputs.Clean();
|
||||||
|
rsiInputs.Clean();
|
||||||
|
chlhInputs.Clean();
|
||||||
|
chmaInputs.Clean();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Default ...
|
||||||
|
virtual void Default()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
ctInputs.Default();
|
||||||
|
ccInputs.Default();
|
||||||
|
tmInputs.Default();
|
||||||
|
lhInputs.Default();
|
||||||
|
tdInputs.Default();
|
||||||
|
fiInputs.Default();
|
||||||
|
obdInputs.Default();
|
||||||
|
amaInputs.Default();
|
||||||
|
rsiInputs.Default();
|
||||||
|
chlhInputs.Default();
|
||||||
|
chmaInputs.Default();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Max ...
|
||||||
|
virtual int Max()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
int result = 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
result = MathMax(lhInputs.Max(), tmInputs.Max());
|
||||||
|
|
||||||
|
//
|
||||||
|
result = MathMax(result, ctInputs.Max());
|
||||||
|
result = MathMax(result, ccInputs.Max());
|
||||||
|
result = MathMax(result, tdInputs.Max());
|
||||||
|
result = MathMax(result, fiInputs.Max());
|
||||||
|
result = MathMax(result, obdInputs.Max());
|
||||||
|
result = MathMax(result, amaInputs.Max());
|
||||||
|
result = MathMax(result, rsiInputs.Max());
|
||||||
|
result = MathMax(result, chlhInputs.Max());
|
||||||
|
result = MathMax(result, chmaInputs.Max());
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
//
|
||||||
|
// X5 Provider Market Conditions ...
|
||||||
|
class X5MarketConditions : public XSCBaseProviderMarketConditions
|
||||||
|
{
|
||||||
|
|
||||||
|
//
|
||||||
|
// Buffers ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// Conditions ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// Generate Score ...
|
||||||
|
virtual void GenerateScore(
|
||||||
|
double &bullishScore, // Bullish Score
|
||||||
|
double &bearishScore, // Bearish Score
|
||||||
|
const double multiplier = 1 // Score Multiplier
|
||||||
|
)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Generate Summary ...
|
||||||
|
virtual string GenerateSummary(
|
||||||
|
const double multiplier = 1, // Score Multiplier
|
||||||
|
const bool ignoreFalseConditions = true // Ignore False Conditions
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
string result = NULL;
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
//
|
||||||
|
// Class ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// X5 Provider Class ...
|
||||||
|
class XSC5Provider : public XSCBaseProvider
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Public ...
|
||||||
|
public:
|
||||||
|
//
|
||||||
|
// Props ...
|
||||||
|
XSCXTSHelper *tsHelper;
|
||||||
|
XSCXFIHelper *fiHelper;
|
||||||
|
XSCXTDHelper *tdHelper;
|
||||||
|
XSCXLHHelper *lhHelper;
|
||||||
|
XSCXTMHelper *tmHelper;
|
||||||
|
XSCXOBDHelper *obdHelper;
|
||||||
|
XSCXRSIHelper *rsiHelper;
|
||||||
|
XSCXAMAHelper *amaHelper;
|
||||||
|
XSCXCHMAHelper *chmaHelper;
|
||||||
|
XSCXCHLHHelper *chlhHelper;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Constructor ...
|
||||||
|
XSC5Provider(
|
||||||
|
string symbol, // Trading Symbol
|
||||||
|
ENUM_TIMEFRAMES period // Trading PEriod
|
||||||
|
) : XSCBaseProvider(symbol, period)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Properties Gettr(s) / Setter(s) ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// Inheritance ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// Init all Requirements ...
|
||||||
|
virtual bool Init(X5ProviderInputs &inputs)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Validate ...
|
||||||
|
result = inputs.IsValid();
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
mInputs = inputs;
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// DeInit all Requirements ...
|
||||||
|
virtual void DeInit()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Functions ...
|
||||||
|
|
||||||
|
//
|
||||||
|
virtual bool GetMarketConditions(
|
||||||
|
X5MarketConditions &conditions, // Market Conditions Result
|
||||||
|
int barIndex = 0 // Specified Bar Index
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check Market For Signal ...
|
||||||
|
virtual bool HasSignal(
|
||||||
|
int barIndex,
|
||||||
|
XSignal &signal, // Hold's Signal if Exists ...
|
||||||
|
X5MarketConditions &conditions // Hold's Market Conditions ...
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Protected ...
|
||||||
|
protected:
|
||||||
|
//
|
||||||
|
// X5MarketConditions mInputs;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Private ...
|
||||||
|
private:
|
||||||
|
//
|
||||||
|
// Props ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// Tools ...
|
||||||
|
};
|
||||||
@@ -0,0 +1,398 @@
|
|||||||
|
///////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// SaherElm IT Center MQL5 Class Library
|
||||||
|
// ----------------------------------------------
|
||||||
|
// Name: XSCAccount
|
||||||
|
// Description: provides all Account 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 <Trade/AccountInfo.mqh>
|
||||||
|
#include "../Classes/x-saherelm.base.class.mq5"
|
||||||
|
|
||||||
|
//
|
||||||
|
// END Import and Inclused requirements ...
|
||||||
|
//
|
||||||
|
|
||||||
|
//
|
||||||
|
// START Overrides ...
|
||||||
|
//
|
||||||
|
|
||||||
|
//
|
||||||
|
// END Overrides ...
|
||||||
|
//
|
||||||
|
|
||||||
|
//
|
||||||
|
// a Class for Manage Account ...
|
||||||
|
class XSCAccount : public XSCBase
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Public ...
|
||||||
|
public:
|
||||||
|
//
|
||||||
|
// Constructor ...
|
||||||
|
void XSCAccount()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
mAccountInfo = new CAccountInfo();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Deconstructor ...
|
||||||
|
void ~XSCAccount()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// START Provided Functions ...
|
||||||
|
//
|
||||||
|
|
||||||
|
//
|
||||||
|
// User Account ...
|
||||||
|
long GetUserAccount()
|
||||||
|
{
|
||||||
|
return mAccountInfo.Login();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Account Leverage ...
|
||||||
|
long GetLeverage()
|
||||||
|
{
|
||||||
|
return mAccountInfo.Leverage();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Get Trade Expert State ...
|
||||||
|
bool CanExpertTrade()
|
||||||
|
{
|
||||||
|
return mAccountInfo.TradeExpert();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// User Account Trade Mopde (ENUM_ACCOUNT_TRADE_MODE) ...
|
||||||
|
// --------------------------
|
||||||
|
// ACCOUNT_TRADE_MODE_DEMO
|
||||||
|
// ACCOUNT_TRADE_MODE_CONTEST
|
||||||
|
// ACCOUNT_TRADE_MODE_REAL
|
||||||
|
ENUM_ACCOUNT_TRADE_MODE GetTradeMode()
|
||||||
|
{
|
||||||
|
return mAccountInfo.TradeMode();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Get Account Balance ...
|
||||||
|
double GetBalance()
|
||||||
|
{
|
||||||
|
return mAccountInfo.Balance();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Get the amount of give Credit ...
|
||||||
|
double GetCredit()
|
||||||
|
{
|
||||||
|
return mAccountInfo.Credit();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Get the amount of current Profit on account ...
|
||||||
|
double GetProfit()
|
||||||
|
{
|
||||||
|
return mAccountInfo.Profit();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Get the amount of current Equity on account ...
|
||||||
|
double GetEquity()
|
||||||
|
{
|
||||||
|
return mAccountInfo.Equity();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Get the amount of reserved Margin ...
|
||||||
|
double GetMargin()
|
||||||
|
{
|
||||||
|
return mAccountInfo.Margin();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Get the amount of free Margin ...
|
||||||
|
double GetFreeMargin()
|
||||||
|
{
|
||||||
|
return mAccountInfo.FreeMargin();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Get the Level of Margin ...
|
||||||
|
double GetMarginLevel()
|
||||||
|
{
|
||||||
|
return mAccountInfo.MarginLevel();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Get the Level Of Margin for a Deposit ...
|
||||||
|
double GetMarginCall()
|
||||||
|
{
|
||||||
|
return mAccountInfo.MarginCall();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Get the Level of Margin for Stop out ...
|
||||||
|
double GetMarginStopOut()
|
||||||
|
{
|
||||||
|
return mAccountInfo.MarginStopOut();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Get the Client Name ...
|
||||||
|
string GetName()
|
||||||
|
{
|
||||||
|
return mAccountInfo.Name();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Get the Trade Server Name ...
|
||||||
|
string GetServerName()
|
||||||
|
{
|
||||||
|
return mAccountInfo.Server();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Get deposit Currency Name ...
|
||||||
|
string GetCurrency()
|
||||||
|
{
|
||||||
|
return mAccountInfo.Currency();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Get the Company Name that serves an Account ...
|
||||||
|
string GetCompany()
|
||||||
|
{
|
||||||
|
return mAccountInfo.Company();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Calculate Profits for the current account based on passed parameters ...
|
||||||
|
double CalculateTradeProfit(
|
||||||
|
const string symbol, // trading symbol
|
||||||
|
ENUM_ORDER_TYPE type, // order type
|
||||||
|
double volume, // volume
|
||||||
|
double entry, // open price
|
||||||
|
double exit // close price
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
double result = mAccountInfo.OrderProfitCheck(
|
||||||
|
symbol,
|
||||||
|
type,
|
||||||
|
volume,
|
||||||
|
entry,
|
||||||
|
exit);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Calculate amount of margin which required for trade operation ...
|
||||||
|
double CalculateMarging(
|
||||||
|
const string symbol, // trading symbol
|
||||||
|
ENUM_ORDER_TYPE type, // order type
|
||||||
|
double volume, // volume
|
||||||
|
double entry // open price
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
double result = mAccountInfo.MarginCheck(
|
||||||
|
symbol,
|
||||||
|
type,
|
||||||
|
volume,
|
||||||
|
entry);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Calculate amount of free margin left after trade operation ...
|
||||||
|
double CalculateFreeMarging(
|
||||||
|
const string symbol, // trading symbol
|
||||||
|
ENUM_ORDER_TYPE type, // order type
|
||||||
|
double volume, // volume
|
||||||
|
double entry // open price
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
double result = mAccountInfo.FreeMarginCheck(
|
||||||
|
symbol,
|
||||||
|
type,
|
||||||
|
volume,
|
||||||
|
entry);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Calculate the Maximum possible volume of trade operation ...
|
||||||
|
double CalculateMaxVolume(
|
||||||
|
const string symbol, // trading symbol
|
||||||
|
ENUM_ORDER_TYPE type, // order type
|
||||||
|
double entry, // open price
|
||||||
|
double percent = 100 // percent of available margin
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
double result = mAccountInfo.MaxLotCheck(
|
||||||
|
symbol,
|
||||||
|
type,
|
||||||
|
entry,
|
||||||
|
percent);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Calculate Point Value for Given Symbol based on Account ...
|
||||||
|
double GetPointValue(
|
||||||
|
string symbol // trading symbol
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
double result = 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
double tickSize = SymbolInfoDouble(symbol, SYMBOL_TRADE_TICK_SIZE);
|
||||||
|
double tickValue = SymbolInfoDouble(symbol, SYMBOL_TRADE_TICK_VALUE);
|
||||||
|
double point = SymbolInfoDouble(symbol, SYMBOL_POINT);
|
||||||
|
|
||||||
|
//
|
||||||
|
double ticksPerPoint = tickSize / point;
|
||||||
|
|
||||||
|
//
|
||||||
|
result = tickValue / ticksPerPoint;
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Calculate Risk Amount based on account Currency by Providing:
|
||||||
|
// Points and Volume ...
|
||||||
|
double CalculateRiskAmount(
|
||||||
|
string symbol, // trading symbol
|
||||||
|
double points, // amount of Risk Points
|
||||||
|
double volume // position Volume
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
double result = 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
double pointValue = GetPointValue(symbol);
|
||||||
|
|
||||||
|
//
|
||||||
|
result = pointValue * volume * points;
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Calculate Risk Points based on account Currency by Providing:
|
||||||
|
// Volume and Amount ...
|
||||||
|
double CalculateRiskPoints(
|
||||||
|
string symbol, // trading symbol
|
||||||
|
double volume, // position Volume
|
||||||
|
double amount // amount of Risk based on Account Currency
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
double result = 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
double pointValue = GetPointValue(symbol);
|
||||||
|
|
||||||
|
//
|
||||||
|
result = amount / (pointValue * volume);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Calculate Volume based on account Currency by Providing:
|
||||||
|
// Amount and Risk Points ...
|
||||||
|
double CalculateVolume(
|
||||||
|
string symbol, // trading symbol
|
||||||
|
double amount, // amount of Risk based on Account Currency
|
||||||
|
double points // amount of Risk Points
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
double result = 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
points =
|
||||||
|
points <= 0
|
||||||
|
? 10
|
||||||
|
: points;
|
||||||
|
|
||||||
|
//
|
||||||
|
double pointValue = GetPointValue(symbol);
|
||||||
|
|
||||||
|
//
|
||||||
|
result = amount / (pointValue * points);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// END Provided Functions ...
|
||||||
|
//
|
||||||
|
|
||||||
|
//
|
||||||
|
// Protected ...
|
||||||
|
protected:
|
||||||
|
//
|
||||||
|
// Private ...
|
||||||
|
private:
|
||||||
|
//
|
||||||
|
// Account Info ...
|
||||||
|
CAccountInfo mAccountInfo;
|
||||||
|
};
|
||||||
|
|
||||||
|
//
|
||||||
|
// START Usefull Functions ...
|
||||||
|
//
|
||||||
|
|
||||||
|
//
|
||||||
|
// END Usefull Functions ...
|
||||||
|
//
|
||||||
@@ -0,0 +1,264 @@
|
|||||||
|
///////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// 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.base.class.mq5"
|
||||||
|
#include "../Libraries/x-saherelm.xtrade.lib.mq5"
|
||||||
|
|
||||||
|
//
|
||||||
|
// Definitions ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// Base Provider Inputs ...
|
||||||
|
class XSCBaseProviderInpts : public XSCBase
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Public ...
|
||||||
|
public:
|
||||||
|
//
|
||||||
|
// Validate Input ...
|
||||||
|
virtual bool IsValid();
|
||||||
|
|
||||||
|
//
|
||||||
|
// Cleanup ...
|
||||||
|
virtual void Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
// Default ...
|
||||||
|
virtual void Default();
|
||||||
|
|
||||||
|
//
|
||||||
|
// Max ...
|
||||||
|
virtual int Max();
|
||||||
|
};
|
||||||
|
|
||||||
|
//
|
||||||
|
// Base Market Conditions Class ...
|
||||||
|
class XSCBaseProviderMarketConditions : public XSCBase
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Public ...
|
||||||
|
public:
|
||||||
|
//
|
||||||
|
// Props ...
|
||||||
|
XOHCL bars[]; // Number of Bars ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// Buffers ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// Conditions ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// Generate Score ...
|
||||||
|
virtual void GenerateScore(
|
||||||
|
double &bullishScore, // Bullish Score
|
||||||
|
double &bearishScore, // Bearish Score
|
||||||
|
const double multiplier = 1 // Score Multiplier
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Generate Summary ...
|
||||||
|
virtual string GenerateSummary(
|
||||||
|
const double multiplier = 1, // Score Multiplier
|
||||||
|
const bool ignoreFalseConditions = true // Ignore False Conditions
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
//
|
||||||
|
// Class ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// Base Provider Class ...
|
||||||
|
class XSCBaseProvider : public XSCBase
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Public ...
|
||||||
|
public:
|
||||||
|
//
|
||||||
|
// Props ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// Constructor ...
|
||||||
|
XSCBaseProvider(
|
||||||
|
string symbol, // Trading Symbol
|
||||||
|
ENUM_TIMEFRAMES period // Trading Period
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Initialize Cycle ...
|
||||||
|
mCycle.Init(
|
||||||
|
symbol,
|
||||||
|
period,
|
||||||
|
X_MARKET_CYCLE_UNKNOWN,
|
||||||
|
X_PERIOD_NOTHING,
|
||||||
|
period,
|
||||||
|
"HOST Period"
|
||||||
|
//
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Deconstructor ...
|
||||||
|
~XSCBaseProvider()
|
||||||
|
{
|
||||||
|
DeInit();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Properties Gettr(s) / Setter(s) ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// Inheritance ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// Init all Requirements ...
|
||||||
|
virtual bool Init(XSCBaseProviderInpts &inputs)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
mInputs = inputs;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Get Inputs ...
|
||||||
|
virtual void GetInputs(XSCBaseProviderInpts &inputs)
|
||||||
|
{
|
||||||
|
inputs = mInputs;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Set Inputs and Reinitial ...
|
||||||
|
virtual bool setInputs(XSCBaseProviderInpts &inputs)
|
||||||
|
{
|
||||||
|
return Init(inputs);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// DeInit all Requirements ...
|
||||||
|
virtual void DeInit();
|
||||||
|
|
||||||
|
//
|
||||||
|
virtual bool GetMarketConditions(
|
||||||
|
XSCBaseProviderMarketConditions &conditions, // Market Conditions Result
|
||||||
|
int barIndex = 0 // Specified Bar Index
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check Market For Signal ...
|
||||||
|
virtual bool HasSignal(
|
||||||
|
int barIndex,
|
||||||
|
XSignal &signal, // Hold's Signal if Exists ...
|
||||||
|
XSCBaseProviderMarketConditions &conditions // Hold's Market Conditions ...
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// 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();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Protected ...
|
||||||
|
protected:
|
||||||
|
//
|
||||||
|
// Props ...
|
||||||
|
|
||||||
|
//
|
||||||
|
XMarketCycle mCycle;
|
||||||
|
XSCBaseProviderInpts mInputs;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool mWaitsUntilNewBar;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Can Ignore Process ...
|
||||||
|
bool CanIgnoreProcess()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
result =
|
||||||
|
//
|
||||||
|
IsRunningOnTestMode()
|
||||||
|
? !IsNewBar()
|
||||||
|
: !IsNewBar() && mWaitsUntilNewBar
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Toggle Waititng Until New Candle ...
|
||||||
|
void ToggleWaitingUntilNewBar()
|
||||||
|
{
|
||||||
|
mWaitsUntilNewBar = !mWaitsUntilNewBar;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Private ...
|
||||||
|
private:
|
||||||
|
//
|
||||||
|
// Props ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// Tools ...
|
||||||
|
};
|
||||||
|
|
||||||
|
//
|
||||||
|
// Tools ...
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -35,7 +35,7 @@ enum ENUM_XAMA_BUFFERS
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Input Models ...
|
// Input Models ...
|
||||||
struct XXAMAInputs
|
struct XAMAInputs
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Props ...
|
// Props ...
|
||||||
@@ -52,7 +52,7 @@ struct XXAMAInputs
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Constructor(s) ...
|
// Constructor(s) ...
|
||||||
XXAMAInputs()
|
XAMAInputs()
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
Clean();
|
Clean();
|
||||||
@@ -148,7 +148,7 @@ public:
|
|||||||
bool Init(
|
bool Init(
|
||||||
string symbol, // Trading Symbol
|
string symbol, // Trading Symbol
|
||||||
ENUM_TIMEFRAMES period, // Trading Period
|
ENUM_TIMEFRAMES period, // Trading Period
|
||||||
XXAMAInputs &inputs // Inputs
|
XAMAInputs &inputs // Inputs
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -204,14 +204,14 @@ public:
|
|||||||
// Inputs ...
|
// Inputs ...
|
||||||
|
|
||||||
//
|
//
|
||||||
XXAMAInputs GetInputs()
|
XAMAInputs GetInputs()
|
||||||
{
|
{
|
||||||
return mInputs;
|
return mInputs;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
bool SetInputs(
|
bool SetInputs(
|
||||||
XXAMAInputs &inputs // Configs
|
XAMAInputs &inputs // Configs
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -284,7 +284,7 @@ protected:
|
|||||||
private:
|
private:
|
||||||
//
|
//
|
||||||
// Props ...
|
// Props ...
|
||||||
XXAMAInputs mInputs; // Inputs ...
|
XAMAInputs mInputs; // Inputs ...
|
||||||
|
|
||||||
//
|
//
|
||||||
// Buffers ...
|
// Buffers ...
|
||||||
@@ -311,7 +311,7 @@ private:
|
|||||||
//
|
//
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
// Tools ...
|
// Tools ...
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Input Models ...
|
// Input Models ...
|
||||||
struct XXCCInputs
|
struct XCCInputs
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Props ...
|
// Props ...
|
||||||
@@ -49,7 +49,7 @@ struct XXCCInputs
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Constructor(s) ...
|
// Constructor(s) ...
|
||||||
XXCCInputs()
|
XCCInputs()
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
Clean();
|
Clean();
|
||||||
@@ -147,7 +147,7 @@ public:
|
|||||||
bool Init(
|
bool Init(
|
||||||
string symbol, // Trading Symbol
|
string symbol, // Trading Symbol
|
||||||
ENUM_TIMEFRAMES period, // Trading Period
|
ENUM_TIMEFRAMES period, // Trading Period
|
||||||
XXCCInputs &inputs // Inputs
|
XCCInputs &inputs // Inputs
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -203,14 +203,14 @@ public:
|
|||||||
// Inputs ...
|
// Inputs ...
|
||||||
|
|
||||||
//
|
//
|
||||||
XXCCInputs GetInputs()
|
XCCInputs GetInputs()
|
||||||
{
|
{
|
||||||
return mInputs;
|
return mInputs;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
bool SetInputs(
|
bool SetInputs(
|
||||||
XXCCInputs &inputs // Configs
|
XCCInputs &inputs // Configs
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -230,8 +230,8 @@ protected:
|
|||||||
private:
|
private:
|
||||||
//
|
//
|
||||||
// Props ...
|
// Props ...
|
||||||
XXCCInputs mInputs; // Inputs ...
|
XCCInputs mInputs; // Inputs ...
|
||||||
}
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
// Tools ...
|
// Tools ...
|
||||||
@@ -49,7 +49,7 @@ enum ENUM_XCHLH_BUFFERS
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Input Models ...
|
// Input Models ...
|
||||||
struct XXCHLHInputs
|
struct XCHLHInputs
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Props ...
|
// Props ...
|
||||||
@@ -116,7 +116,7 @@ struct XXCHLHInputs
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Constructor(s) ...
|
// Constructor(s) ...
|
||||||
XXCHLHInputs()
|
XCHLHInputs()
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
Clean();
|
Clean();
|
||||||
@@ -331,7 +331,7 @@ public:
|
|||||||
bool Init(
|
bool Init(
|
||||||
string symbol, // Trading Symbol
|
string symbol, // Trading Symbol
|
||||||
ENUM_TIMEFRAMES period, // Trading Period
|
ENUM_TIMEFRAMES period, // Trading Period
|
||||||
XXCHLHInputs &inputs // Inputs
|
XCHLHInputs &inputs // Inputs
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -464,14 +464,14 @@ public:
|
|||||||
// Inputs ...
|
// Inputs ...
|
||||||
|
|
||||||
//
|
//
|
||||||
XXCHLHInputs GetInputs()
|
XCHLHInputs GetInputs()
|
||||||
{
|
{
|
||||||
return mInputs;
|
return mInputs;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
bool SetInputs(
|
bool SetInputs(
|
||||||
XXCHLHInputs &inputs // Configs
|
XCHLHInputs &inputs // Configs
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -853,7 +853,7 @@ protected:
|
|||||||
private:
|
private:
|
||||||
//
|
//
|
||||||
// Props ...
|
// Props ...
|
||||||
XXCHLHInputs mInputs; // Inputs ...
|
XCHLHInputs mInputs; // Inputs ...
|
||||||
|
|
||||||
//
|
//
|
||||||
// Buffers ...
|
// Buffers ...
|
||||||
@@ -961,7 +961,7 @@ private:
|
|||||||
//
|
//
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
// Tools ...
|
// Tools ...
|
||||||
@@ -48,7 +48,7 @@ enum ENUM_XCHMA_BUFFERS
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Input Models ...
|
// Input Models ...
|
||||||
struct XXCHMAInputs
|
struct XCHMAInputs
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Props ...
|
// Props ...
|
||||||
@@ -116,7 +116,7 @@ struct XXCHMAInputs
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Constructor(s) ...
|
// Constructor(s) ...
|
||||||
XXCHMAInputs()
|
XCHMAInputs()
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
Clean();
|
Clean();
|
||||||
@@ -325,7 +325,7 @@ public:
|
|||||||
bool Init(
|
bool Init(
|
||||||
string symbol, // Trading Symbol
|
string symbol, // Trading Symbol
|
||||||
ENUM_TIMEFRAMES period, // Trading Period
|
ENUM_TIMEFRAMES period, // Trading Period
|
||||||
XXCHMAInputs &inputs // Inputs
|
XCHMAInputs &inputs // Inputs
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -457,14 +457,14 @@ public:
|
|||||||
// Inputs ...
|
// Inputs ...
|
||||||
|
|
||||||
//
|
//
|
||||||
XXCHMAInputs GetInputs()
|
XCHMAInputs GetInputs()
|
||||||
{
|
{
|
||||||
return mInputs;
|
return mInputs;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
bool SetInputs(
|
bool SetInputs(
|
||||||
XXCHMAInputs &inputs // Configs
|
XCHMAInputs &inputs // Configs
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -846,7 +846,7 @@ protected:
|
|||||||
private:
|
private:
|
||||||
//
|
//
|
||||||
// Props ...
|
// Props ...
|
||||||
XXCHMAInputs mInputs; // Inputs ...
|
XCHMAInputs mInputs; // Inputs ...
|
||||||
|
|
||||||
//
|
//
|
||||||
// Buffers ...
|
// Buffers ...
|
||||||
@@ -954,7 +954,7 @@ private:
|
|||||||
//
|
//
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
// Tools ...
|
// Tools ...
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Input Models ...
|
// Input Models ...
|
||||||
struct XXCTInputs
|
struct XCTInputs
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Props ...
|
// Props ...
|
||||||
@@ -44,7 +44,7 @@ struct XXCTInputs
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Constructor(s) ...
|
// Constructor(s) ...
|
||||||
XXCTInputs()
|
XCTInputs()
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
Clean();
|
Clean();
|
||||||
@@ -137,7 +137,7 @@ public:
|
|||||||
bool Init(
|
bool Init(
|
||||||
string symbol, // Trading Symbol
|
string symbol, // Trading Symbol
|
||||||
ENUM_TIMEFRAMES period, // Trading Period
|
ENUM_TIMEFRAMES period, // Trading Period
|
||||||
XXCTInputs &inputs // Inputs
|
XCTInputs &inputs // Inputs
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -186,14 +186,14 @@ public:
|
|||||||
// Inputs ...
|
// Inputs ...
|
||||||
|
|
||||||
//
|
//
|
||||||
XXCTInputs GetInputs()
|
XCTInputs GetInputs()
|
||||||
{
|
{
|
||||||
return mInputs;
|
return mInputs;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
bool SetInputs(
|
bool SetInputs(
|
||||||
XXCTInputs &inputs // Configs
|
XCTInputs &inputs // Configs
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -213,8 +213,8 @@ protected:
|
|||||||
private:
|
private:
|
||||||
//
|
//
|
||||||
// Props ...
|
// Props ...
|
||||||
XXCTInputs mInputs; // Inputs ...
|
XCTInputs mInputs; // Inputs ...
|
||||||
}
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
// Tools ...
|
// Tools ...
|
||||||
@@ -825,7 +825,7 @@ private:
|
|||||||
//
|
//
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
// Tools ...
|
// Tools ...
|
||||||
@@ -35,7 +35,7 @@ enum ENUM_XFI_BUFFERS
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Input Models ...
|
// Input Models ...
|
||||||
struct XXFIInputs
|
struct XFIInputs
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Props ...
|
// Props ...
|
||||||
@@ -45,7 +45,7 @@ struct XXFIInputs
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Constructor(s) ...
|
// Constructor(s) ...
|
||||||
XXFIInputs()
|
XFIInputs()
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
Clean();
|
Clean();
|
||||||
@@ -132,7 +132,7 @@ public:
|
|||||||
bool Init(
|
bool Init(
|
||||||
string symbol, // Trading Symbol
|
string symbol, // Trading Symbol
|
||||||
ENUM_TIMEFRAMES period, // Trading Period
|
ENUM_TIMEFRAMES period, // Trading Period
|
||||||
XXFIInputs &inputs // Inputs
|
XFIInputs &inputs // Inputs
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -179,14 +179,14 @@ public:
|
|||||||
// Inputs ...
|
// Inputs ...
|
||||||
|
|
||||||
//
|
//
|
||||||
XXFIInputs GetInputs()
|
XFIInputs GetInputs()
|
||||||
{
|
{
|
||||||
return mInputs;
|
return mInputs;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
bool SetInputs(
|
bool SetInputs(
|
||||||
XXFIInputs &inputs // Configs
|
XFIInputs &inputs // Configs
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -259,7 +259,7 @@ protected:
|
|||||||
private:
|
private:
|
||||||
//
|
//
|
||||||
// Props ...
|
// Props ...
|
||||||
XXFIInputs mInputs; // Inputs ...
|
XFIInputs mInputs; // Inputs ...
|
||||||
|
|
||||||
//
|
//
|
||||||
// Buffers ...
|
// Buffers ...
|
||||||
@@ -286,7 +286,7 @@ private:
|
|||||||
// //
|
// //
|
||||||
// );
|
// );
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
// Tools ...
|
// Tools ...
|
||||||
@@ -1022,7 +1022,7 @@ private:
|
|||||||
//
|
//
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
// Tools ...
|
// Tools ...
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
//
|
//
|
||||||
// SaherElm IT Center MQL5 Helper Class Library
|
// SaherElm IT Center MQL5 Helper Class Library
|
||||||
// ----------------------------------------------
|
// ----------------------------------------------
|
||||||
// Name: XSCXHULLCHelper
|
// Name: XSCXHULLHelper
|
||||||
// Description: provides all Indicator
|
// Description: provides all Indicator
|
||||||
// Helper requirements ...
|
// Helper requirements ...
|
||||||
//
|
//
|
||||||
@@ -36,7 +36,7 @@ enum ENUM_XHULLC_BUFFERS
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Input Models ...
|
// Input Models ...
|
||||||
struct XHULLCInputs
|
struct XHULLInputs
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Props ...
|
// Props ...
|
||||||
@@ -57,7 +57,7 @@ struct XHULLCInputs
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Constructor(s) ...
|
// Constructor(s) ...
|
||||||
XHULLCInputs()
|
XHULLInputs()
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
Clean();
|
Clean();
|
||||||
@@ -142,7 +142,7 @@ struct XHULLCInputs
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Class ...
|
// Class ...
|
||||||
class XSCXHULLCHelper : public XSCBaseHelper
|
class XSCXHULLHelper : public XSCBaseHelper
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Public ...
|
// Public ...
|
||||||
@@ -152,20 +152,20 @@ public:
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Constructors ...
|
// Constructors ...
|
||||||
XSCXHULLCHelper() : XSCBaseHelper(_Symbol, _Period)
|
XSCXHULLHelper() : XSCBaseHelper(_Symbol, _Period)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Deconstructor ...
|
// Deconstructor ...
|
||||||
~XSCXHULLCHelper() {}
|
~XSCXHULLHelper() {}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Tools ...
|
// Tools ...
|
||||||
bool Init(
|
bool Init(
|
||||||
string symbol, // Trading Symbol
|
string symbol, // Trading Symbol
|
||||||
ENUM_TIMEFRAMES period, // Trading Period
|
ENUM_TIMEFRAMES period, // Trading Period
|
||||||
XHULLCInputs &inputs // Inputs
|
XHULLInputs &inputs // Inputs
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -224,14 +224,14 @@ public:
|
|||||||
// Inputs ...
|
// Inputs ...
|
||||||
|
|
||||||
//
|
//
|
||||||
XHULLCInputs GetInputs()
|
XHULLInputs GetInputs()
|
||||||
{
|
{
|
||||||
return mInputs;
|
return mInputs;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
bool SetInputs(
|
bool SetInputs(
|
||||||
XHULLCInputs &inputs // Configs
|
XHULLInputs &inputs // Configs
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -354,7 +354,7 @@ protected:
|
|||||||
private:
|
private:
|
||||||
//
|
//
|
||||||
// Props ...
|
// Props ...
|
||||||
XHULLCInputs mInputs; // Inputs ...
|
XHULLInputs mInputs; // Inputs ...
|
||||||
|
|
||||||
//
|
//
|
||||||
// Buffers ...
|
// Buffers ...
|
||||||
@@ -393,7 +393,7 @@ private:
|
|||||||
//
|
//
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
// Tools ...
|
// Tools ...
|
||||||
@@ -37,7 +37,7 @@ enum ENUM_XLH_BUFFERS
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Input Models ...
|
// Input Models ...
|
||||||
struct XXLHInputs
|
struct XLHInputs
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Props ...
|
// Props ...
|
||||||
@@ -47,7 +47,7 @@ struct XXLHInputs
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Constructor(s) ...
|
// Constructor(s) ...
|
||||||
XXLHInputs()
|
XLHInputs()
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
Clean();
|
Clean();
|
||||||
@@ -134,7 +134,7 @@ public:
|
|||||||
bool Init(
|
bool Init(
|
||||||
string symbol, // Trading Symbol
|
string symbol, // Trading Symbol
|
||||||
ENUM_TIMEFRAMES period, // Trading Period
|
ENUM_TIMEFRAMES period, // Trading Period
|
||||||
XXLHInputs &inputs // Inputs
|
XLHInputs &inputs // Inputs
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -185,14 +185,14 @@ public:
|
|||||||
// Inputs ...
|
// Inputs ...
|
||||||
|
|
||||||
//
|
//
|
||||||
XXLHInputs GetInputs()
|
XLHInputs GetInputs()
|
||||||
{
|
{
|
||||||
return mInputs;
|
return mInputs;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
bool SetInputs(
|
bool SetInputs(
|
||||||
XXLHInputs &inputs // Configs
|
XLHInputs &inputs // Configs
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -365,7 +365,7 @@ protected:
|
|||||||
private:
|
private:
|
||||||
//
|
//
|
||||||
// Props ...
|
// Props ...
|
||||||
XXLHInputs mInputs; // Inputs ...
|
XLHInputs mInputs; // Inputs ...
|
||||||
|
|
||||||
//
|
//
|
||||||
// Buffers ...
|
// Buffers ...
|
||||||
@@ -416,7 +416,7 @@ private:
|
|||||||
//
|
//
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
// Tools ...
|
// Tools ...
|
||||||
@@ -1223,7 +1223,7 @@ private:
|
|||||||
//
|
//
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
// Tools ...
|
// Tools ...
|
||||||
@@ -35,7 +35,7 @@ enum ENUM_XOBD_BUFFERS
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Input Models ...
|
// Input Models ...
|
||||||
struct XXOBDInputs
|
struct XOBDInputs
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Props ...
|
// Props ...
|
||||||
@@ -53,7 +53,7 @@ struct XXOBDInputs
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Constructor(s) ...
|
// Constructor(s) ...
|
||||||
XXOBDInputs()
|
XOBDInputs()
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
Clean();
|
Clean();
|
||||||
@@ -144,7 +144,7 @@ public:
|
|||||||
bool Init(
|
bool Init(
|
||||||
string symbol, // Trading Symbol
|
string symbol, // Trading Symbol
|
||||||
ENUM_TIMEFRAMES period, // Trading Period
|
ENUM_TIMEFRAMES period, // Trading Period
|
||||||
XXOBDInputs &inputs // Inputs
|
XOBDInputs &inputs // Inputs
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -193,14 +193,14 @@ public:
|
|||||||
// Inputs ...
|
// Inputs ...
|
||||||
|
|
||||||
//
|
//
|
||||||
XXOBDInputs GetInputs()
|
XOBDInputs GetInputs()
|
||||||
{
|
{
|
||||||
return mInputs;
|
return mInputs;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
bool SetInputs(
|
bool SetInputs(
|
||||||
XXOBDInputs &inputs // Configs
|
XOBDInputs &inputs // Configs
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -273,7 +273,7 @@ protected:
|
|||||||
private:
|
private:
|
||||||
//
|
//
|
||||||
// Props ...
|
// Props ...
|
||||||
XXOBDInputs mInputs; // Inputs ...
|
XOBDInputs mInputs; // Inputs ...
|
||||||
|
|
||||||
//
|
//
|
||||||
// Buffers ...
|
// Buffers ...
|
||||||
@@ -300,7 +300,7 @@ private:
|
|||||||
//
|
//
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
// Tools ...
|
// Tools ...
|
||||||
@@ -315,6 +315,8 @@ public:
|
|||||||
ArraySetAsSeries(stochMainBuffer, true);
|
ArraySetAsSeries(stochMainBuffer, true);
|
||||||
ArraySetAsSeries(stochSignalBuffer, true);
|
ArraySetAsSeries(stochSignalBuffer, true);
|
||||||
ArraySetAsSeries(stddevBuffer, true);
|
ArraySetAsSeries(stddevBuffer, true);
|
||||||
|
|
||||||
|
//
|
||||||
mHandler = iCustom(
|
mHandler = iCustom(
|
||||||
mSymbol,
|
mSymbol,
|
||||||
mPeriod,
|
mPeriod,
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ enum ENUM_XPV_BUFFERS
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Input Models ...
|
// Input Models ...
|
||||||
struct XXPVInputs
|
struct XPVInputs
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Props ...
|
// Props ...
|
||||||
@@ -119,7 +119,7 @@ struct XXPVInputs
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Constructor(s) ...
|
// Constructor(s) ...
|
||||||
XXPVInputs()
|
XPVInputs()
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
Clean();
|
Clean();
|
||||||
@@ -290,7 +290,7 @@ public:
|
|||||||
bool Init(
|
bool Init(
|
||||||
string symbol, // Trading Symbol
|
string symbol, // Trading Symbol
|
||||||
ENUM_TIMEFRAMES period, // Trading Period
|
ENUM_TIMEFRAMES period, // Trading Period
|
||||||
XXPVInputs &inputs // Inputs
|
XPVInputs &inputs // Inputs
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -399,14 +399,14 @@ public:
|
|||||||
// Inputs ...
|
// Inputs ...
|
||||||
|
|
||||||
//
|
//
|
||||||
XXPVInputs GetInputs()
|
XPVInputs GetInputs()
|
||||||
{
|
{
|
||||||
return mInputs;
|
return mInputs;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
bool SetInputs(
|
bool SetInputs(
|
||||||
XXPVInputs &inputs // Configs
|
XPVInputs &inputs // Configs
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -1348,7 +1348,7 @@ protected:
|
|||||||
private:
|
private:
|
||||||
//
|
//
|
||||||
// Props ...
|
// Props ...
|
||||||
XXPVInputs mInputs; // Inputs ...
|
XPVInputs mInputs; // Inputs ...
|
||||||
|
|
||||||
//
|
//
|
||||||
// Buffers ...
|
// Buffers ...
|
||||||
@@ -1591,7 +1591,7 @@ private:
|
|||||||
//
|
//
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
// Tools ...
|
// Tools ...
|
||||||
@@ -35,7 +35,7 @@ enum ENUM_XRSI_BUFFERS
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Input Models ...
|
// Input Models ...
|
||||||
struct XXRSIInputs
|
struct XRSIInputs
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Props ...
|
// Props ...
|
||||||
@@ -71,7 +71,7 @@ struct XXRSIInputs
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Constructor(s) ...
|
// Constructor(s) ...
|
||||||
XXRSIInputs()
|
XRSIInputs()
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
Clean();
|
Clean();
|
||||||
@@ -206,7 +206,7 @@ public:
|
|||||||
bool Init(
|
bool Init(
|
||||||
string symbol, // Trading Symbol
|
string symbol, // Trading Symbol
|
||||||
ENUM_TIMEFRAMES period, // Trading Period
|
ENUM_TIMEFRAMES period, // Trading Period
|
||||||
XXRSIInputs &inputs // Inputs
|
XRSIInputs &inputs // Inputs
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -279,14 +279,14 @@ public:
|
|||||||
// Inputs ...
|
// Inputs ...
|
||||||
|
|
||||||
//
|
//
|
||||||
XXRSIInputs GetInputs()
|
XRSIInputs GetInputs()
|
||||||
{
|
{
|
||||||
return mInputs;
|
return mInputs;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
bool SetInputs(
|
bool SetInputs(
|
||||||
XXRSIInputs &inputs // Configs
|
XRSIInputs &inputs // Configs
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -359,7 +359,7 @@ protected:
|
|||||||
private:
|
private:
|
||||||
//
|
//
|
||||||
// Props ...
|
// Props ...
|
||||||
XXRSIInputs mInputs; // Inputs ...
|
XRSIInputs mInputs; // Inputs ...
|
||||||
|
|
||||||
//
|
//
|
||||||
// Buffers ...
|
// Buffers ...
|
||||||
@@ -386,7 +386,7 @@ private:
|
|||||||
//
|
//
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
// Tools ...
|
// Tools ...
|
||||||
@@ -402,7 +402,7 @@ private:
|
|||||||
//
|
//
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
// Tools ...
|
// Tools ...
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
//
|
//
|
||||||
// SaherElm IT Center MQL5 Helper Class Library
|
// SaherElm IT Center MQL5 Helper Class Library
|
||||||
// ----------------------------------------------
|
// ----------------------------------------------
|
||||||
// Name: XSCXSTRRHelper
|
// Name: XSCXSTRHelper
|
||||||
// Description: provides all Indicator
|
// Description: provides all Indicator
|
||||||
// Helper requirements ...
|
// Helper requirements ...
|
||||||
//
|
//
|
||||||
@@ -42,7 +42,7 @@ enum ENUM_XSTR_TREND_STATES
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Input Models ...
|
// Input Models ...
|
||||||
struct XSTRRInputs
|
struct XSTRInputs
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Props ...
|
// Props ...
|
||||||
@@ -60,7 +60,7 @@ struct XSTRRInputs
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Constructor(s) ...
|
// Constructor(s) ...
|
||||||
XSTRRInputs()
|
XSTRInputs()
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
Clean();
|
Clean();
|
||||||
@@ -131,7 +131,7 @@ struct XSTRRInputs
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Class ...
|
// Class ...
|
||||||
class XSCXSTRRHelper : public XSCBaseHelper
|
class XSCXSTRHelper : public XSCBaseHelper
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Public ...
|
// Public ...
|
||||||
@@ -141,20 +141,20 @@ public:
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Constructors ...
|
// Constructors ...
|
||||||
XSCXSTRRHelper() : XSCBaseHelper(_Symbol, _Period)
|
XSCXSTRHelper() : XSCBaseHelper(_Symbol, _Period)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Deconstructor ...
|
// Deconstructor ...
|
||||||
~XSCXSTRRHelper() {}
|
~XSCXSTRHelper() {}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Tools ...
|
// Tools ...
|
||||||
bool Init(
|
bool Init(
|
||||||
string symbol, // Trading Symbol
|
string symbol, // Trading Symbol
|
||||||
ENUM_TIMEFRAMES period, // Trading Period
|
ENUM_TIMEFRAMES period, // Trading Period
|
||||||
XSTRRInputs &inputs // Inputs
|
XSTRInputs &inputs // Inputs
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -212,14 +212,14 @@ public:
|
|||||||
// Inputs ...
|
// Inputs ...
|
||||||
|
|
||||||
//
|
//
|
||||||
XSTRRInputs GetInputs()
|
XSTRInputs GetInputs()
|
||||||
{
|
{
|
||||||
return mInputs;
|
return mInputs;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
bool SetInputs(
|
bool SetInputs(
|
||||||
XSTRRInputs &inputs // Configs
|
XSTRInputs &inputs // Configs
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -375,7 +375,7 @@ protected:
|
|||||||
private:
|
private:
|
||||||
//
|
//
|
||||||
// Props ...
|
// Props ...
|
||||||
XSTRRInputs mInputs; // Inputs ...
|
XSTRInputs mInputs; // Inputs ...
|
||||||
|
|
||||||
//
|
//
|
||||||
// Buffers ...
|
// Buffers ...
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ enum ENUM_XTD_BUFFERS
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Input Models ...
|
// Input Models ...
|
||||||
struct XXTDInputs
|
struct XTDInputs
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Props ...
|
// Props ...
|
||||||
@@ -57,7 +57,7 @@ struct XXTDInputs
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Constructor(s) ...
|
// Constructor(s) ...
|
||||||
XXTDInputs()
|
XTDInputs()
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
Clean();
|
Clean();
|
||||||
@@ -162,7 +162,7 @@ public:
|
|||||||
bool Init(
|
bool Init(
|
||||||
string symbol, // Trading Symbol
|
string symbol, // Trading Symbol
|
||||||
ENUM_TIMEFRAMES period, // Trading Period
|
ENUM_TIMEFRAMES period, // Trading Period
|
||||||
XXTDInputs &inputs // Inputs
|
XTDInputs &inputs // Inputs
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -221,14 +221,14 @@ public:
|
|||||||
// Inputs ...
|
// Inputs ...
|
||||||
|
|
||||||
//
|
//
|
||||||
XXTDInputs GetInputs()
|
XTDInputs GetInputs()
|
||||||
{
|
{
|
||||||
return mInputs;
|
return mInputs;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
bool SetInputs(
|
bool SetInputs(
|
||||||
XXTDInputs &inputs // Configs
|
XTDInputs &inputs // Configs
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -401,7 +401,7 @@ protected:
|
|||||||
private:
|
private:
|
||||||
//
|
//
|
||||||
// Props ...
|
// Props ...
|
||||||
XXTDInputs mInputs; // Inputs ...
|
XTDInputs mInputs; // Inputs ...
|
||||||
|
|
||||||
//
|
//
|
||||||
// Buffers ...
|
// Buffers ...
|
||||||
@@ -452,7 +452,7 @@ private:
|
|||||||
//
|
//
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
// Tools ...
|
// Tools ...
|
||||||
@@ -35,7 +35,7 @@ enum ENUM_XTM_BUFFERS
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Input Models ...
|
// Input Models ...
|
||||||
struct XXTMInputs
|
struct XTMInputs
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Props ...
|
// Props ...
|
||||||
@@ -51,7 +51,7 @@ struct XXTMInputs
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Constructor(s) ...
|
// Constructor(s) ...
|
||||||
XXTMInputs()
|
XTMInputs()
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
Clean();
|
Clean();
|
||||||
@@ -142,7 +142,7 @@ public:
|
|||||||
bool Init(
|
bool Init(
|
||||||
string symbol, // Trading Symbol
|
string symbol, // Trading Symbol
|
||||||
ENUM_TIMEFRAMES period, // Trading Period
|
ENUM_TIMEFRAMES period, // Trading Period
|
||||||
XXTMInputs &inputs // Inputs
|
XTMInputs &inputs // Inputs
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -197,14 +197,14 @@ public:
|
|||||||
// Inputs ...
|
// Inputs ...
|
||||||
|
|
||||||
//
|
//
|
||||||
XXTMInputs GetInputs()
|
XTMInputs GetInputs()
|
||||||
{
|
{
|
||||||
return mInputs;
|
return mInputs;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
bool SetInputs(
|
bool SetInputs(
|
||||||
XXTMInputs &inputs // Configs
|
XTMInputs &inputs // Configs
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -277,7 +277,7 @@ protected:
|
|||||||
private:
|
private:
|
||||||
//
|
//
|
||||||
// Props ...
|
// Props ...
|
||||||
XXTMInputs mInputs; // Inputs ...
|
XTMInputs mInputs; // Inputs ...
|
||||||
|
|
||||||
//
|
//
|
||||||
// Buffers ...
|
// Buffers ...
|
||||||
@@ -304,7 +304,7 @@ private:
|
|||||||
//
|
//
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
// Tools ...
|
// Tools ...
|
||||||
@@ -544,7 +544,7 @@ private:
|
|||||||
//
|
//
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
// Tools ...
|
// Tools ...
|
||||||
@@ -521,7 +521,7 @@ private:
|
|||||||
//
|
//
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
// Tools ...
|
// Tools ...
|
||||||
@@ -114,9 +114,16 @@ void OnDeinit(const int reason)
|
|||||||
// REASON_INITFAILED 8 The OnInit() handler returned a non-zero value
|
// REASON_INITFAILED 8 The OnInit() handler returned a non-zero value
|
||||||
// REASON_CLOSE 9 Terminal closed
|
// REASON_CLOSE 9 Terminal closed
|
||||||
|
|
||||||
|
//
|
||||||
|
ulong chID = FindChartID(
|
||||||
|
_Symbol,
|
||||||
|
_Period
|
||||||
|
//
|
||||||
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Delete Object ...
|
// Delete Object ...
|
||||||
ObjectDelete(0, ShortName);
|
ObjectDelete(chID, ShortName);
|
||||||
|
|
||||||
//
|
//
|
||||||
Comment("");
|
Comment("");
|
||||||
@@ -125,36 +132,16 @@ void OnDeinit(const int reason)
|
|||||||
//
|
//
|
||||||
// Calculating what we want ...
|
// Calculating what we want ...
|
||||||
int OnCalculate(
|
int OnCalculate(
|
||||||
//
|
const int rates_total, // Total Bars on Chart ...
|
||||||
// total Candles on chart ...
|
const int prev_calculated, // Total Calculated Bars on Charts ...
|
||||||
const int rates_total,
|
const datetime &time[], // History of Open Time ...
|
||||||
//
|
const double &open[], // History of Open Price ...
|
||||||
// total calculated Candles on charts ...
|
const double &high[], // History of High Price ...
|
||||||
const int prev_calculated,
|
const double &low[], // History of Low Price ...
|
||||||
//
|
const double &close[], // History of Close Price ...
|
||||||
// history of Candles Open Time ...
|
const long &tick_volume[], // History of Tick Volumes on Bar ...
|
||||||
const datetime &time[],
|
const long &volume[], // History of Trade Volumes ...
|
||||||
//
|
const int &spread[] // History of Spread Price ...
|
||||||
// history of Candles Open Price ...
|
|
||||||
const double &open[],
|
|
||||||
//
|
|
||||||
// history of Candles High Price ...
|
|
||||||
const double &high[],
|
|
||||||
//
|
|
||||||
// history of Candles Low Price ...
|
|
||||||
const double &low[],
|
|
||||||
//
|
|
||||||
// history of Candles Close Price ...
|
|
||||||
const double &close[],
|
|
||||||
//
|
|
||||||
// history of Tick Volumes on Candle ...
|
|
||||||
const long &tick_volume[],
|
|
||||||
//
|
|
||||||
// history of Trade Volumes ...
|
|
||||||
const long &volume[],
|
|
||||||
//
|
|
||||||
// history of Candles Spread Price ...
|
|
||||||
const int &spread[] //
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -166,6 +153,13 @@ int OnCalculate(
|
|||||||
return rates_total;
|
return rates_total;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
ulong chID = FindChartID(
|
||||||
|
_Symbol,
|
||||||
|
_Period
|
||||||
|
//
|
||||||
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
XBarRemainsTime barRemains;
|
XBarRemainsTime barRemains;
|
||||||
barRemains.Init(
|
barRemains.Init(
|
||||||
@@ -201,10 +195,10 @@ int OnCalculate(
|
|||||||
string objText = "Spread: " + IntegerToString(mSpread) + _sp + " Next Bar in: " + msg;
|
string objText = "Spread: " + IntegerToString(mSpread) + _sp + " Next Bar in: " + msg;
|
||||||
|
|
||||||
//
|
//
|
||||||
ObjectSetInteger(0, ShortName, OBJPROP_COLOR, clr);
|
ObjectSetInteger(chID, ShortName, OBJPROP_COLOR, clr);
|
||||||
ObjectSetString(0, ShortName, OBJPROP_TEXT, objText);
|
ObjectSetString(chID, ShortName, OBJPROP_TEXT, objText);
|
||||||
ObjectSetInteger(0, ShortName, OBJPROP_FONTSIZE, 10);
|
ObjectSetInteger(chID, ShortName, OBJPROP_FONTSIZE, 10);
|
||||||
ObjectSetString(0, ShortName, OBJPROP_FONT, "Courier");
|
ObjectSetString(chID, ShortName, OBJPROP_FONT, "Courier");
|
||||||
|
|
||||||
//
|
//
|
||||||
return rates_total;
|
return rates_total;
|
||||||
|
|||||||
@@ -2233,6 +2233,48 @@ struct XMarketCycle
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Find Chart ID ...
|
||||||
|
ulong GetChartID()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
ulong result = 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
long firstChart = ChartFirst();
|
||||||
|
result = firstChart;
|
||||||
|
|
||||||
|
//
|
||||||
|
while (result >= 0)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
string chSymbol = ChartSymbol(result);
|
||||||
|
ENUM_TIMEFRAMES chPeriod = ChartPeriod(result);
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isOwnChart =
|
||||||
|
//
|
||||||
|
symbol == chSymbol &&
|
||||||
|
period == chPeriod
|
||||||
|
//
|
||||||
|
;
|
||||||
|
if (isOwnChart)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
result = ChartNext(result);
|
||||||
|
if (result < 0)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Create and String Representation for Unique Taging ...
|
// Create and String Representation for Unique Taging ...
|
||||||
string ToString()
|
string ToString()
|
||||||
@@ -2470,6 +2512,43 @@ bool IsRunningOnTestMode()
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Find Chart ID ...
|
||||||
|
ulong FindChartID(
|
||||||
|
string mSymbol = NULL, // Trading Symbol
|
||||||
|
ENUM_TIMEFRAMES mPeriod = NULL // Trading Period
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
ulong result = ChartFirst();
|
||||||
|
|
||||||
|
//
|
||||||
|
while (result >= 0)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
string chSymbol = ChartSymbol(result);
|
||||||
|
ENUM_TIMEFRAMES chPeriod = ChartPeriod(result);
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isOwn =
|
||||||
|
//
|
||||||
|
chSymbol == mSymbol &&
|
||||||
|
chPeriod == mPeriod
|
||||||
|
//
|
||||||
|
;
|
||||||
|
if (isOwn)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
result = ChartNext(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Normalizers ...
|
// Normalizers ...
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user