259 lines
4.5 KiB
Plaintext
259 lines
4.5 KiB
Plaintext
///////////////////////////////////////////////////////
|
|
//
|
|
// SaherElm IT Center MQL5 Helper Class Library
|
|
// ----------------------------------------------
|
|
// Name: XSCX121XCCHelper
|
|
// 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
|
|
|
|
//
|
|
// Imports ...
|
|
#include "../Classes/x-saherelm.x-helper.class.mq5"
|
|
|
|
//
|
|
// Definitions ...
|
|
|
|
//
|
|
// Input Models ...
|
|
struct X121XCCInputs
|
|
{
|
|
//
|
|
// Props ...
|
|
|
|
//
|
|
// Chart Style ...
|
|
ENUM_CHART_MODE mode; // Mode
|
|
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
|
|
|
|
//
|
|
// Constructor(s) ...
|
|
X121XCCInputs()
|
|
{
|
|
//
|
|
Clean();
|
|
}
|
|
|
|
//
|
|
// Tools ...
|
|
|
|
//
|
|
// Clean ...
|
|
void Clean()
|
|
{
|
|
//
|
|
mode = CHART_CANDLES;
|
|
|
|
//
|
|
upColor = CLR_NONE;
|
|
downColor = CLR_NONE;
|
|
lineColor = CLR_NONE;
|
|
bearishColor = CLR_NONE;
|
|
bullishColor = CLR_NONE;
|
|
volumesColor = CLR_NONE;
|
|
|
|
//
|
|
showCandles = false;
|
|
|
|
//
|
|
ZeroMemory(this);
|
|
}
|
|
|
|
//
|
|
// Default ...
|
|
void Default()
|
|
{
|
|
//
|
|
mode = CHART_CANDLES;
|
|
|
|
//
|
|
upColor = clrLime;
|
|
downColor = clrRed;
|
|
lineColor = clrLime;
|
|
bearishColor = clrRed;
|
|
bullishColor = clrLime;
|
|
volumesColor = clrGreen;
|
|
//
|
|
showCandles = true;
|
|
}
|
|
|
|
//
|
|
// Hide all Visible Buffers ...
|
|
void Hide()
|
|
{
|
|
showCandles = false;
|
|
}
|
|
|
|
//
|
|
// Validate ...
|
|
bool IsValid()
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
result =
|
|
//
|
|
true
|
|
//
|
|
;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Retrieve MAx Length ...
|
|
int Max()
|
|
{
|
|
//
|
|
int result = 0;
|
|
|
|
//
|
|
result = MathMax(0, 0);
|
|
|
|
//
|
|
return result;
|
|
}
|
|
};
|
|
|
|
//
|
|
// Class ...
|
|
class XCX121XCCHelper : public XCBaseHelper
|
|
{
|
|
//
|
|
// Public ...
|
|
public:
|
|
//
|
|
// Props ...
|
|
|
|
//
|
|
// Constructors ...
|
|
XCX121XCCHelper()
|
|
: XCBaseHelper(_Symbol, _Period)
|
|
{
|
|
}
|
|
|
|
//
|
|
// Deconstructor ...
|
|
~XCX121XCCHelper()
|
|
{
|
|
mInputs.Clean();
|
|
}
|
|
|
|
//
|
|
// Tools ...
|
|
bool Init(
|
|
string symbol, // Trading Symbol
|
|
ENUM_TIMEFRAMES period, // Trading Period
|
|
X121XCCInputs &inputs // Inputs
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
mSymbol = symbol;
|
|
mPeriod = period;
|
|
|
|
//
|
|
result = inputs.IsValid();
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
mInputs = inputs;
|
|
|
|
//
|
|
mHandler = iCustom(
|
|
mSymbol,
|
|
mPeriod,
|
|
"x-saherelm.x121.xcc",
|
|
//
|
|
// Inputs ...
|
|
//
|
|
// Chart Style ...
|
|
"",
|
|
mInputs.mode, // Mode
|
|
mInputs.upColor, // Up Color
|
|
mInputs.downColor, // Down Color
|
|
mInputs.lineColor, // Line mode and Doji candlestick Color
|
|
mInputs.bullishColor, // Bearish Color
|
|
mInputs.bearishColor, // Bullish Color
|
|
mInputs.volumesColor, // Volumes Color
|
|
//
|
|
// Presentation ...
|
|
"",
|
|
mInputs.showCandles // Show Candles
|
|
//
|
|
);
|
|
result = mHandler != INVALID_HANDLE;
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Inputs ...
|
|
|
|
//
|
|
X121XCCInputs GetInputs()
|
|
{
|
|
return mInputs;
|
|
}
|
|
|
|
//
|
|
bool SetInputs(
|
|
X121XCCInputs &inputs // Configs
|
|
)
|
|
{
|
|
//
|
|
return Init(
|
|
mSymbol,
|
|
mPeriod,
|
|
inputs
|
|
//
|
|
);
|
|
}
|
|
|
|
//
|
|
// Protected ...
|
|
protected:
|
|
//
|
|
// Private ...
|
|
private:
|
|
//
|
|
// Props ...
|
|
X121XCCInputs mInputs; // Inputs ...
|
|
};
|
|
|
|
//
|
|
// Tools ... |