249 lines
3.9 KiB
Plaintext
249 lines
3.9 KiB
Plaintext
///////////////////////////////////////////////////////
|
|
//
|
|
// SaherElm IT Center MQL5 Helper Class Library
|
|
// ----------------------------------------------
|
|
// Name: XSCXCTHelper
|
|
// Description: provides all 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 ...
|
|
//
|
|
|
|
//
|
|
struct XCTInputs
|
|
{
|
|
//
|
|
color clr;
|
|
ENUM_BASE_CORNER corner;
|
|
|
|
//
|
|
// Presentation ...
|
|
bool showCandleTime; // Show Candle Time
|
|
};
|
|
|
|
//
|
|
// END Definitions ...
|
|
//
|
|
|
|
//
|
|
// START Import and Inclused requirements ...
|
|
//
|
|
|
|
//
|
|
// Includes ...
|
|
#include "../Libraries/x-saherelm.common.lib.mq5"
|
|
#include "../Classes/x-saherelm.xhelper.class.mq5"
|
|
|
|
//
|
|
// END Import and Inclused requirements ...
|
|
//
|
|
|
|
//
|
|
// START Overrides ...
|
|
//
|
|
|
|
//
|
|
// END Overrides ...
|
|
//
|
|
|
|
//
|
|
// a Class for Helping Indicators Requirements ...
|
|
class XSCXCTHelper : public XSCBaseHelper
|
|
{
|
|
//
|
|
// Public ...
|
|
public:
|
|
//
|
|
// Constructor ...
|
|
void XSCXCTHelper(
|
|
string symbol, // Trading Symbol
|
|
ENUM_TIMEFRAMES period // Trading Time Frame
|
|
) : XSCBaseHelper(symbol, period)
|
|
{
|
|
PrepareTag();
|
|
}
|
|
|
|
//
|
|
// Deconstructor ...
|
|
void ~XSCXCTHelper()
|
|
{
|
|
}
|
|
|
|
//
|
|
// START Properties ...
|
|
//
|
|
|
|
//
|
|
// Show Candles ...
|
|
bool ShowCandleTime(
|
|
bool show // Show or Hide
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
if (mShowCandleTime == show)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
//
|
|
mShowCandleTime = show;
|
|
result = Init();
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// END Properties ...
|
|
//
|
|
|
|
//
|
|
// START Provided Functions ...
|
|
//
|
|
|
|
//
|
|
// Prepare Tag ...
|
|
virtual void PrepareTag()
|
|
{
|
|
mTag = "XCT" + GetTagPrefix();
|
|
}
|
|
|
|
//
|
|
// Reading Buffers based on Given Bar Index ...
|
|
virtual void Calculate(
|
|
int barIndex // Given Bar Index
|
|
)
|
|
{
|
|
}
|
|
|
|
//
|
|
virtual int GetMaxLength()
|
|
{
|
|
//
|
|
int result = -1;
|
|
|
|
//
|
|
result = 1;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Initial Indicator Handler ...
|
|
bool Init()
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
// Initialize Handler ...
|
|
mHandler = iCustom(
|
|
//
|
|
mSymbol,
|
|
mPeriod,
|
|
"x-saherelm.x121.xct",
|
|
//
|
|
// Inputs ...
|
|
mClr,
|
|
mCorner,
|
|
//
|
|
// Presentation ...
|
|
"",
|
|
mShowCandleTime
|
|
//
|
|
);
|
|
result = mHandler != INVALID_HANDLE;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Retrieve Current Config ...
|
|
XCTInputs GetConfig()
|
|
{
|
|
//
|
|
XCTInputs result;
|
|
|
|
//
|
|
result.clr = mClr;
|
|
result.corner = mCorner;
|
|
result.showCandleTime = mShowCandleTime;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Set Config ...
|
|
bool SetConfig(XCTInputs &config)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
mClr = config.clr;
|
|
mCorner = config.corner;
|
|
mShowCandleTime = config.showCandleTime;
|
|
|
|
//
|
|
result = Init();
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// END Provided Functions ...
|
|
//
|
|
|
|
//
|
|
// Protected ...
|
|
protected:
|
|
//
|
|
// Private ...
|
|
private:
|
|
//
|
|
// Indicator Properties ...
|
|
|
|
//
|
|
// Text Color ...
|
|
color mClr;
|
|
//
|
|
// Text Position ...
|
|
ENUM_BASE_CORNER mCorner;
|
|
|
|
//
|
|
// Presentation ...
|
|
//
|
|
// Show Candles ...
|
|
bool mShowCandleTime;
|
|
};
|
|
|
|
//
|
|
// START Usefull Functions ...
|
|
//
|
|
|
|
//
|
|
// END Usefull Functions ...
|
|
//
|