294 lines
5.2 KiB
Plaintext
294 lines
5.2 KiB
Plaintext
///////////////////////////////////////////////////////
|
|
//
|
|
// SaherElm IT Center MQL5 Helper Class Library
|
|
// ----------------------------------------------
|
|
// Name: XSCXCCHelper
|
|
// 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 XCCInputs
|
|
{
|
|
//
|
|
// Chart Style ...
|
|
color upColor; // Up Color
|
|
color downColor; // Down Color
|
|
color lineColor; // Line mode and Doji candlestick Color
|
|
color bearishColor; // Bullish Color
|
|
color bullishColor; // Bearish Color
|
|
color volumesColor; // Volumes Color
|
|
|
|
//
|
|
// Presentation ...
|
|
bool showCandles; // Show Candles
|
|
};
|
|
|
|
//
|
|
// 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 XSCXCCHelper : public XSCBaseHelper
|
|
{
|
|
//
|
|
// Public ...
|
|
public:
|
|
//
|
|
// Constructor ...
|
|
void XSCXCCHelper(
|
|
string symbol, // Trading Symbol
|
|
ENUM_TIMEFRAMES period // Trading Time Frame
|
|
) : XSCBaseHelper(symbol, period)
|
|
{
|
|
PrepareTag();
|
|
}
|
|
|
|
//
|
|
// Deconstructor ...
|
|
void ~XSCXCCHelper()
|
|
{
|
|
}
|
|
|
|
//
|
|
// START Properties ...
|
|
//
|
|
|
|
//
|
|
// Show Candles ...
|
|
bool ShowCandles(
|
|
bool show // Show or Hide
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
if (mShowCandles == show)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
//
|
|
mShowCandles = show;
|
|
result = Init();
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// END Properties ...
|
|
//
|
|
|
|
//
|
|
// START Provided Functions ...
|
|
//
|
|
|
|
//
|
|
// Prepare Tag ...
|
|
virtual void PrepareTag()
|
|
{
|
|
mTag = "XCC" + GetTagPrefix();
|
|
}
|
|
|
|
//
|
|
// Reading Buffers based on Given Bar Index ...
|
|
virtual void Calculate(
|
|
int barIndex // Given Bar Index
|
|
) {}
|
|
|
|
//
|
|
virtual int GetMaxLength()
|
|
{
|
|
//
|
|
int result = -1;
|
|
|
|
//
|
|
result = 2;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Initial Indicator Handler ...
|
|
bool Init()
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
// Initialize Handler ...
|
|
mHandler = iCustom(
|
|
//
|
|
mSymbol,
|
|
mPeriod,
|
|
"x-saherelm.x121.xcc",
|
|
//
|
|
// Inputs ...
|
|
//
|
|
// Chart Style ...
|
|
"",
|
|
//
|
|
// Up Color ...
|
|
mUpColor,
|
|
//
|
|
// Down Color ...
|
|
mDownColor,
|
|
//
|
|
// Line mode and Doji candlestick Color ...
|
|
mLineColor,
|
|
//
|
|
// Bullish Color ...
|
|
mBearishColor,
|
|
//
|
|
// Bearish Color ...
|
|
mBullishColor,
|
|
//
|
|
// Volumes Color ...
|
|
mVolumesColor,
|
|
//
|
|
// Presentation ...
|
|
"",
|
|
//
|
|
// Show Candles ...
|
|
mShowCandles
|
|
//
|
|
);
|
|
result = mHandler != INVALID_HANDLE;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Retrieve Current Config ...
|
|
XCCInputs GetConfig()
|
|
{
|
|
//
|
|
XCCInputs result;
|
|
|
|
//
|
|
result.upColor = mUpColor;
|
|
result.downColor = mDownColor;
|
|
result.lineColor = mLineColor;
|
|
result.bearishColor = mBearishColor;
|
|
result.bullishColor = mBullishColor;
|
|
result.volumesColor = mVolumesColor;
|
|
result.showCandles = mShowCandles;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Set Config ...
|
|
bool SetConfig(XCCInputs &config)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
mUpColor = config.upColor;
|
|
mDownColor = config.downColor;
|
|
mLineColor = config.lineColor;
|
|
mBearishColor = config.bearishColor;
|
|
mBullishColor = config.bullishColor;
|
|
mVolumesColor = config.volumesColor;
|
|
mShowCandles = config.showCandles;
|
|
|
|
//
|
|
result = Init();
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// END Provided Functions ...
|
|
//
|
|
|
|
//
|
|
// Protected ...
|
|
protected:
|
|
//
|
|
// Private ...
|
|
private:
|
|
//
|
|
// Indicator Properties ...
|
|
//
|
|
// Chart Style ...
|
|
//
|
|
// Up Color ...
|
|
color mUpColor;
|
|
//
|
|
// Down Color ...
|
|
color mDownColor;
|
|
//
|
|
// Line mode and Doji candlestick Color ...
|
|
color mLineColor;
|
|
//
|
|
// Bullish Color ...
|
|
color mBearishColor;
|
|
//
|
|
// Bearish Color ...
|
|
color mBullishColor;
|
|
//
|
|
// Volumes Color ...
|
|
color mVolumesColor;
|
|
|
|
//
|
|
// Presentation ...
|
|
//
|
|
// Show Candles ...
|
|
bool mShowCandles;
|
|
};
|
|
|
|
//
|
|
// START Usefull Functions ...
|
|
//
|
|
|
|
//
|
|
// END Usefull Functions ...
|
|
//
|