1102 lines
20 KiB
Plaintext
1102 lines
20 KiB
Plaintext
///////////////////////////////////////////////////////
|
|
//
|
|
// SaherElm IT Center MQL5 Class Library
|
|
// --------------------------------------
|
|
// Name: XMRB Indicator Provider
|
|
// Description: MA Ribbons ...
|
|
//
|
|
//
|
|
// 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 Import and Inclused requirements ...
|
|
//
|
|
|
|
//
|
|
// Includes ...
|
|
#include "../Libraries/x-saherelm.alert.lib.mq5"
|
|
#include "../Libraries/x-saherelm.models.lib.mq5"
|
|
#include "../Libraries/x-saherelm.common.lib.mq5"
|
|
|
|
//
|
|
// END Import and Inclused requirements ...
|
|
//
|
|
|
|
//
|
|
// START Definitions ...
|
|
//
|
|
|
|
//
|
|
// XMRB Exported Buffers ...
|
|
enum ENUM_X_XMRB_BUFFERS
|
|
{
|
|
//
|
|
X_MRB_FAST_LINE = 0,
|
|
X_MRB_SLOW_LINE = 1,
|
|
|
|
//
|
|
X_MRB_FAST_1_LINE = 2,
|
|
X_MRB_FAST_2_LINE = 3,
|
|
X_MRB_FAST_3_LINE = 4,
|
|
X_MRB_FAST_4_LINE = 5,
|
|
X_MRB_FAST_5_LINE = 6,
|
|
|
|
//
|
|
X_MRB_SLOW_1_LINE = 7,
|
|
X_MRB_SLOW_2_LINE = 8,
|
|
X_MRB_SLOW_3_LINE = 9,
|
|
X_MRB_SLOW_4_LINE = 10,
|
|
X_MRB_SLOW_5_LINE = 11,
|
|
};
|
|
|
|
//
|
|
// END Definitions ...
|
|
//
|
|
|
|
//
|
|
// START Overrides ...
|
|
//
|
|
|
|
//
|
|
// END Overrides ...
|
|
//
|
|
|
|
class XSCXMRBHelper
|
|
{
|
|
//
|
|
public:
|
|
//
|
|
// Properties ...
|
|
double fastBuffer[];
|
|
double slowBuffer[];
|
|
|
|
//
|
|
double fast1Buffer[];
|
|
double fast2Buffer[];
|
|
double fast3Buffer[];
|
|
double fast4Buffer[];
|
|
double fast5Buffer[];
|
|
|
|
//
|
|
double slow1Buffer[];
|
|
double slow2Buffer[];
|
|
double slow3Buffer[];
|
|
double slow4Buffer[];
|
|
double slow5Buffer[];
|
|
|
|
//
|
|
// Constructor ...
|
|
void XSCXMRBHelper() {
|
|
mSymbol = _Symbol;
|
|
mPeriod = _Period;
|
|
}
|
|
void XSCXMRBHelper(
|
|
//
|
|
// Symbol ...
|
|
string symbol,
|
|
//
|
|
// Period ...
|
|
ENUM_TIMEFRAMES period,
|
|
//
|
|
// Buffer Reading ...
|
|
int numberOfItemsReadPerTick = 52,
|
|
//
|
|
// RIBBONS ...
|
|
//
|
|
int fast1Length = 3,
|
|
int slow1Length = 5,
|
|
//
|
|
int fast2Length = 8,
|
|
int slow2Length = 13,
|
|
//
|
|
int fast3Length = 21,
|
|
int slow3Length = 34,
|
|
//
|
|
int fast4Length = 55,
|
|
int slow4Length = 89,
|
|
//
|
|
int fast5Length = 144,
|
|
int slow5Length = 233,
|
|
//
|
|
// CALCULATION ...
|
|
ENUM_MA_METHOD ribbonMode = MODE_EMA,
|
|
ENUM_APPLIED_PRICE ribbonAppliedTo = PRICE_CLOSE
|
|
//
|
|
)
|
|
{
|
|
//
|
|
// Setting Requirements ...
|
|
|
|
//
|
|
// Symbol ...
|
|
mSymbol = symbol;
|
|
|
|
//
|
|
// Period ...
|
|
mPeriod = period;
|
|
|
|
//
|
|
// Number of Reading Buffer Items per Tick ...
|
|
mNumberOfItemsReadPerTick = numberOfItemsReadPerTick;
|
|
|
|
//
|
|
// RIBBONS ...
|
|
//
|
|
mFast1Length = fast1Length;
|
|
mSlow1Length = slow1Length;
|
|
//
|
|
mFast2Length = fast2Length;
|
|
mSlow2Length = slow2Length;
|
|
//
|
|
mFast3Length = fast3Length;
|
|
mSlow3Length = slow3Length;
|
|
//
|
|
mFast4Length = fast4Length;
|
|
mSlow4Length = slow4Length;
|
|
//
|
|
mFast5Length = fast5Length;
|
|
mSlow5Length = slow5Length;
|
|
//
|
|
// CALCULATION ...
|
|
mRibbonMode = ribbonMode;
|
|
mRibbonAppliedTo = ribbonAppliedTo;
|
|
|
|
//
|
|
mTag = "XMRB " + mSymbol + ", " + ToString(mPeriod);
|
|
|
|
//
|
|
// Initial Handler ...
|
|
mHandler = iCustom(
|
|
mSymbol,
|
|
mPeriod,
|
|
"x-saherelm.x121.xmrb",
|
|
//
|
|
// Inputs ...
|
|
//
|
|
"",
|
|
mFast1Length,
|
|
mSlow1Length,
|
|
//
|
|
"",
|
|
mFast2Length,
|
|
mSlow2Length,
|
|
//
|
|
"",
|
|
mFast3Length,
|
|
mSlow3Length,
|
|
//
|
|
"",
|
|
mFast4Length,
|
|
mSlow4Length,
|
|
//
|
|
"",
|
|
mFast5Length,
|
|
mSlow5Length,
|
|
//
|
|
"",
|
|
mRibbonMode,
|
|
mRibbonAppliedTo,
|
|
//
|
|
"",
|
|
false,
|
|
false,
|
|
false
|
|
//
|
|
);
|
|
if (mHandler == INVALID_HANDLE)
|
|
{
|
|
LogMessage("failed to Initialize Indicator: " + (string)GetLastError());
|
|
}
|
|
|
|
//
|
|
ArraySetAsSeries(fastBuffer, true);
|
|
ArraySetAsSeries(slowBuffer, true);
|
|
|
|
//
|
|
ArraySetAsSeries(fast1Buffer, true);
|
|
ArraySetAsSeries(fast2Buffer, true);
|
|
ArraySetAsSeries(fast3Buffer, true);
|
|
ArraySetAsSeries(fast4Buffer, true);
|
|
ArraySetAsSeries(fast5Buffer, true);
|
|
|
|
//
|
|
ArraySetAsSeries(slow1Buffer, true);
|
|
ArraySetAsSeries(slow2Buffer, true);
|
|
ArraySetAsSeries(slow3Buffer, true);
|
|
ArraySetAsSeries(slow4Buffer, true);
|
|
ArraySetAsSeries(slow5Buffer, true);
|
|
}
|
|
|
|
//
|
|
// DeConstructor ...
|
|
void ~XSCXMRBHelper()
|
|
{
|
|
//
|
|
// Release Indicators ...
|
|
IndicatorRelease(mHandler);
|
|
}
|
|
|
|
//
|
|
// Reading Buffers ...
|
|
void ReadBuffers()
|
|
{
|
|
//
|
|
// FAST ...
|
|
CopyBuffer(
|
|
mHandler,
|
|
X_MRB_FAST_LINE,
|
|
0,
|
|
mNumberOfItemsReadPerTick,
|
|
fastBuffer);
|
|
|
|
CopyBuffer(
|
|
mHandler,
|
|
X_MRB_FAST_1_LINE,
|
|
0,
|
|
mNumberOfItemsReadPerTick,
|
|
fast1Buffer);
|
|
|
|
CopyBuffer(
|
|
mHandler,
|
|
X_MRB_FAST_2_LINE,
|
|
0,
|
|
mNumberOfItemsReadPerTick,
|
|
fast2Buffer);
|
|
|
|
CopyBuffer(
|
|
mHandler,
|
|
X_MRB_FAST_3_LINE,
|
|
0,
|
|
mNumberOfItemsReadPerTick,
|
|
fast3Buffer);
|
|
|
|
CopyBuffer(
|
|
mHandler,
|
|
X_MRB_FAST_4_LINE,
|
|
0,
|
|
mNumberOfItemsReadPerTick,
|
|
fast4Buffer);
|
|
|
|
CopyBuffer(
|
|
mHandler,
|
|
X_MRB_FAST_5_LINE,
|
|
0,
|
|
mNumberOfItemsReadPerTick,
|
|
fast5Buffer);
|
|
|
|
//
|
|
// SLOW ...
|
|
CopyBuffer(
|
|
mHandler,
|
|
X_MRB_SLOW_LINE,
|
|
0,
|
|
mNumberOfItemsReadPerTick,
|
|
slowBuffer);
|
|
|
|
CopyBuffer(
|
|
mHandler,
|
|
X_MRB_SLOW_1_LINE,
|
|
0,
|
|
mNumberOfItemsReadPerTick,
|
|
slow1Buffer);
|
|
|
|
CopyBuffer(
|
|
mHandler,
|
|
X_MRB_SLOW_2_LINE,
|
|
0,
|
|
mNumberOfItemsReadPerTick,
|
|
slow2Buffer);
|
|
|
|
CopyBuffer(
|
|
mHandler,
|
|
X_MRB_SLOW_3_LINE,
|
|
0,
|
|
mNumberOfItemsReadPerTick,
|
|
slow3Buffer);
|
|
|
|
CopyBuffer(
|
|
mHandler,
|
|
X_MRB_SLOW_4_LINE,
|
|
0,
|
|
mNumberOfItemsReadPerTick,
|
|
slow4Buffer);
|
|
|
|
CopyBuffer(
|
|
mHandler,
|
|
X_MRB_SLOW_5_LINE,
|
|
0,
|
|
mNumberOfItemsReadPerTick,
|
|
slow5Buffer);
|
|
}
|
|
|
|
//
|
|
// START Tools Functions ...
|
|
//
|
|
|
|
//
|
|
// Check Fast Over Slow ...
|
|
bool IsFastOverSlow(
|
|
int bar_index // Bar Index ...
|
|
) {
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
if (!IsValidArraySize(bar_index)) {
|
|
return result;
|
|
}
|
|
|
|
//
|
|
result =
|
|
//
|
|
IsOver(
|
|
fastBuffer,
|
|
slowBuffer,
|
|
bar_index
|
|
)
|
|
//
|
|
;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Check Fast Crossed Over Slow ...
|
|
bool IsFastCrossedOverSlow(
|
|
int bar_index // Bar Index ...
|
|
) {
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
if (!IsValidArraySize(bar_index)) {
|
|
return result;
|
|
}
|
|
|
|
//
|
|
result =
|
|
//
|
|
IsCrossOver(
|
|
fastBuffer,
|
|
slowBuffer,
|
|
bar_index
|
|
)
|
|
//
|
|
;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Check Fast Under Slow ...
|
|
bool IsFastUnderSlow(
|
|
int bar_index // Bar Index ...
|
|
) {
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
if (!IsValidArraySize(bar_index)) {
|
|
return result;
|
|
}
|
|
|
|
//
|
|
result =
|
|
//
|
|
IsUnder(
|
|
fastBuffer,
|
|
slowBuffer,
|
|
bar_index
|
|
)
|
|
//
|
|
;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Check Fast Crossed Under Slow ...
|
|
bool IsFastCrossedUnderSlow(
|
|
int bar_index // Bar Index ...
|
|
) {
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
if (!IsValidArraySize(bar_index)) {
|
|
return result;
|
|
}
|
|
|
|
//
|
|
result =
|
|
//
|
|
IsCrossUnder(
|
|
fastBuffer,
|
|
slowBuffer,
|
|
bar_index
|
|
)
|
|
//
|
|
;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// RIBBON 1 ...
|
|
|
|
//
|
|
// Check Fast Over Slow ...
|
|
bool IsR1FastOverSlow(
|
|
int bar_index // Bar Index ...
|
|
) {
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
if (!IsValidArraySize(bar_index)) {
|
|
return result;
|
|
}
|
|
|
|
//
|
|
result =
|
|
//
|
|
IsOver(
|
|
fast1Buffer,
|
|
slow1Buffer,
|
|
bar_index
|
|
)
|
|
//
|
|
;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Check Fast Crossed Over Slow ...
|
|
bool IsR1FastCrossedOverSlow(
|
|
int bar_index // Bar Index ...
|
|
) {
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
if (!IsValidArraySize(bar_index)) {
|
|
return result;
|
|
}
|
|
|
|
//
|
|
result =
|
|
//
|
|
IsCrossOver(
|
|
fast1Buffer,
|
|
slow1Buffer,
|
|
bar_index
|
|
)
|
|
//
|
|
;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Check Fast Under Slow ...
|
|
bool IsR1FastUnderSlow(
|
|
int bar_index // Bar Index ...
|
|
) {
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
if (!IsValidArraySize(bar_index)) {
|
|
return result;
|
|
}
|
|
|
|
//
|
|
result =
|
|
//
|
|
IsUnder(
|
|
fast1Buffer,
|
|
slow1Buffer,
|
|
bar_index
|
|
)
|
|
//
|
|
;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Check Fast Crossed Under Slow ...
|
|
bool IsR1FastCrossedUnderSlow(
|
|
int bar_index // Bar Index ...
|
|
) {
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
if (!IsValidArraySize(bar_index)) {
|
|
return result;
|
|
}
|
|
|
|
//
|
|
result =
|
|
//
|
|
IsCrossUnder(
|
|
fast1Buffer,
|
|
slow1Buffer,
|
|
bar_index
|
|
)
|
|
//
|
|
;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// RIBBON 2 ...
|
|
|
|
//
|
|
// Check Fast Over Slow ...
|
|
bool IsR2FastOverSlow(
|
|
int bar_index // Bar Index ...
|
|
) {
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
if (!IsValidArraySize(bar_index)) {
|
|
return result;
|
|
}
|
|
|
|
//
|
|
result =
|
|
//
|
|
IsOver(
|
|
fast2Buffer,
|
|
slow2Buffer,
|
|
bar_index
|
|
)
|
|
//
|
|
;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Check Fast Crossed Over Slow ...
|
|
bool IsR2FastCrossedOverSlow(
|
|
int bar_index // Bar Index ...
|
|
) {
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
if (!IsValidArraySize(bar_index)) {
|
|
return result;
|
|
}
|
|
|
|
//
|
|
result =
|
|
//
|
|
IsCrossOver(
|
|
fast2Buffer,
|
|
slow2Buffer,
|
|
bar_index
|
|
)
|
|
//
|
|
;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Check Fast Under Slow ...
|
|
bool IsR2FastUnderSlow(
|
|
int bar_index // Bar Index ...
|
|
) {
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
if (!IsValidArraySize(bar_index)) {
|
|
return result;
|
|
}
|
|
|
|
//
|
|
result =
|
|
//
|
|
IsUnder(
|
|
fast2Buffer,
|
|
slow2Buffer,
|
|
bar_index
|
|
)
|
|
//
|
|
;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Check Fast Crossed Under Slow ...
|
|
bool IsR2FastCrossedUnderSlow(
|
|
int bar_index // Bar Index ...
|
|
) {
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
if (!IsValidArraySize(bar_index)) {
|
|
return result;
|
|
}
|
|
|
|
//
|
|
result =
|
|
//
|
|
IsCrossUnder(
|
|
fast2Buffer,
|
|
slow2Buffer,
|
|
bar_index
|
|
)
|
|
//
|
|
;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// RIBBON 3 ...
|
|
|
|
//
|
|
// Check Fast Over Slow ...
|
|
bool IsR3FastOverSlow(
|
|
int bar_index // Bar Index ...
|
|
) {
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
if (!IsValidArraySize(bar_index)) {
|
|
return result;
|
|
}
|
|
|
|
//
|
|
result =
|
|
//
|
|
IsOver(
|
|
fast3Buffer,
|
|
slow3Buffer,
|
|
bar_index
|
|
)
|
|
//
|
|
;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Check Fast Crossed Over Slow ...
|
|
bool IsR3FastCrossedOverSlow(
|
|
int bar_index // Bar Index ...
|
|
) {
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
if (!IsValidArraySize(bar_index)) {
|
|
return result;
|
|
}
|
|
|
|
//
|
|
result =
|
|
//
|
|
IsCrossOver(
|
|
fast3Buffer,
|
|
slow3Buffer,
|
|
bar_index
|
|
)
|
|
//
|
|
;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Check Fast Under Slow ...
|
|
bool IsR3FastUnderSlow(
|
|
int bar_index // Bar Index ...
|
|
) {
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
if (!IsValidArraySize(bar_index)) {
|
|
return result;
|
|
}
|
|
|
|
//
|
|
result =
|
|
//
|
|
IsUnder(
|
|
fast3Buffer,
|
|
slow3Buffer,
|
|
bar_index
|
|
)
|
|
//
|
|
;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Check Fast Crossed Under Slow ...
|
|
bool IsR3FastCrossedUnderSlow(
|
|
int bar_index // Bar Index ...
|
|
) {
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
if (!IsValidArraySize(bar_index)) {
|
|
return result;
|
|
}
|
|
|
|
//
|
|
result =
|
|
//
|
|
IsCrossUnder(
|
|
fast3Buffer,
|
|
slow3Buffer,
|
|
bar_index
|
|
)
|
|
//
|
|
;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// RIBBON 4 ...
|
|
|
|
//
|
|
// Check Fast Over Slow ...
|
|
bool IsR4FastOverSlow(
|
|
int bar_index // Bar Index ...
|
|
) {
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
if (!IsValidArraySize(bar_index)) {
|
|
return result;
|
|
}
|
|
|
|
//
|
|
result =
|
|
//
|
|
IsOver(
|
|
fast4Buffer,
|
|
slow4Buffer,
|
|
bar_index
|
|
)
|
|
//
|
|
;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Check Fast Crossed Over Slow ...
|
|
bool IsR4FastCrossedOverSlow(
|
|
int bar_index // Bar Index ...
|
|
) {
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
if (!IsValidArraySize(bar_index)) {
|
|
return result;
|
|
}
|
|
|
|
//
|
|
result =
|
|
//
|
|
IsCrossOver(
|
|
fast4Buffer,
|
|
slow4Buffer,
|
|
bar_index
|
|
)
|
|
//
|
|
;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Check Fast Under Slow ...
|
|
bool IsR4FastUnderSlow(
|
|
int bar_index // Bar Index ...
|
|
) {
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
if (!IsValidArraySize(bar_index)) {
|
|
return result;
|
|
}
|
|
|
|
//
|
|
result =
|
|
//
|
|
IsUnder(
|
|
fast4Buffer,
|
|
slow4Buffer,
|
|
bar_index
|
|
)
|
|
//
|
|
;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Check Fast Crossed Under Slow ...
|
|
bool IsR4FastCrossedUnderSlow(
|
|
int bar_index // Bar Index ...
|
|
) {
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
if (!IsValidArraySize(bar_index)) {
|
|
return result;
|
|
}
|
|
|
|
//
|
|
result =
|
|
//
|
|
IsCrossUnder(
|
|
fast4Buffer,
|
|
slow4Buffer,
|
|
bar_index
|
|
)
|
|
//
|
|
;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// RIBBON 5 ...
|
|
|
|
//
|
|
// Check Fast Over Slow ...
|
|
bool IsR5FastOverSlow(
|
|
int bar_index // Bar Index ...
|
|
) {
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
if (!IsValidArraySize(bar_index)) {
|
|
return result;
|
|
}
|
|
|
|
//
|
|
result =
|
|
//
|
|
IsOver(
|
|
fast5Buffer,
|
|
slow5Buffer,
|
|
bar_index
|
|
)
|
|
//
|
|
;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Check Fast Crossed Over Slow ...
|
|
bool IsR5FastCrossedOverSlow(
|
|
int bar_index // Bar Index ...
|
|
) {
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
if (!IsValidArraySize(bar_index)) {
|
|
return result;
|
|
}
|
|
|
|
//
|
|
result =
|
|
//
|
|
IsCrossOver(
|
|
fast5Buffer,
|
|
slow5Buffer,
|
|
bar_index
|
|
)
|
|
//
|
|
;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Check Fast Under Slow ...
|
|
bool IsR5FastUnderSlow(
|
|
int bar_index // Bar Index ...
|
|
) {
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
if (!IsValidArraySize(bar_index)) {
|
|
return result;
|
|
}
|
|
|
|
//
|
|
result =
|
|
//
|
|
IsUnder(
|
|
fast5Buffer,
|
|
slow5Buffer,
|
|
bar_index
|
|
)
|
|
//
|
|
;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Check Fast Crossed Under Slow ...
|
|
bool IsR5FastCrossedUnderSlow(
|
|
int bar_index // Bar Index ...
|
|
) {
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
if (!IsValidArraySize(bar_index)) {
|
|
return result;
|
|
}
|
|
|
|
//
|
|
result =
|
|
//
|
|
IsCrossUnder(
|
|
fast5Buffer,
|
|
slow5Buffer,
|
|
bar_index
|
|
)
|
|
//
|
|
;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// END Tools Functions ...
|
|
//
|
|
|
|
//
|
|
protected:
|
|
//
|
|
private:
|
|
//
|
|
// Symbol ...
|
|
string mSymbol;
|
|
|
|
//
|
|
// Period ...
|
|
ENUM_TIMEFRAMES mPeriod;
|
|
|
|
//
|
|
// Buffer Reading ...
|
|
int mNumberOfItemsReadPerTick;
|
|
|
|
//
|
|
// RIBBONS ...
|
|
//
|
|
int mFast1Length;
|
|
int mSlow1Length;
|
|
//
|
|
int mFast2Length;
|
|
int mSlow2Length;
|
|
//
|
|
int mFast3Length;
|
|
int mSlow3Length;
|
|
//
|
|
int mFast4Length;
|
|
int mSlow4Length;
|
|
//
|
|
int mFast5Length;
|
|
int mSlow5Length;
|
|
|
|
//
|
|
// CALCULATION ...
|
|
ENUM_MA_METHOD mRibbonMode;
|
|
ENUM_APPLIED_PRICE mRibbonAppliedTo;
|
|
|
|
//
|
|
string mTag;
|
|
|
|
//
|
|
int mHandler;
|
|
|
|
//
|
|
bool IsValidArraySize(int bar_index)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
if (bar_index < 0)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
int rCount = ArraySize(fastBuffer);
|
|
result = rCount > bar_index + 1;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
}; |