Files
xMQL5/MQLTestWorkspace/BKPS/BKP/x121 old style indicators/Helpers/Test/x121.xmrb.test.helper.mq5
T

315 lines
4.5 KiB
Plaintext

/////////////////////////////////////////////////////////////////////////////
//
// SaherElm IT Center MQL5 XMRBHLP Indicator Helper for Signal Providers
// --------------------------------------------------------------------------
//
// 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 Includes ...
//
//
// Includes ...
#include "../../Libraries/x-saherelm.alert.lib.mq5"
#include "../../Libraries/x-saherelm.models.lib.mq5"
#include "../../Libraries/x-saherelm.common.lib.mq5"
//
// END Includes ...
//
//
// START Constants/Enums ...
//
//
// 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 Constants/Enums ...
//
//
// START Definitions ...
//
//
double mrbFastBuffer[];
double mrbSlowBuffer[];
//
int mrbHandler = INVALID_HANDLE;
//
// END Definitions ...
//
//
// START Handler Functions ...
//
//
bool XMRBHLPOnInit()
{
//
bool result = false;
//
ArraySetAsSeries(mrbFastBuffer, true);
ArraySetAsSeries(mrbSlowBuffer, true);
//
// Initial Handler ...
mrbHandler = iCustom(
_Symbol,
_Period,
"x-saherelm.x121.xmrb",
//
// Inputs ...
//
"",
3,
5,
//
"",
8,
13,
//
"",
21,
34,
//
"",
55,
89,
//
"",
144,
233,
//
"",
MODE_EMA,
PRICE_CLOSE,
//
"",
false,
false,
false
//
);
result = mrbHandler != INVALID_HANDLE;
//
return result;
}
//
void XMRBHLPOnDeInit()
{
//
// Release Indicators ...
IndicatorRelease(mrbHandler);
}
//
void XMRBHLPReadBuffers()
{
//
// FAST ...
CopyBuffer(
mrbHandler,
X_MRB_FAST_LINE,
0,
52,
mrbFastBuffer);
//
// SLOW ...
CopyBuffer(
mrbHandler,
X_MRB_SLOW_LINE,
0,
52,
mrbSlowBuffer);
}
//
// END Handler Functions ...
//
//
// START Helper Functions ...
//
//
// Check Fast Over Slow ...
bool XMRBHLPIsFastOverSlow(
int bar_index // Bar Index ...
)
{
//
bool result = false;
//
if (!XMRBHLPIsValidArraySize(bar_index))
{
return result;
}
//
result =
//
IsOver(
mrbFastBuffer,
mrbSlowBuffer,
bar_index)
//
;
//
return result;
}
//
// Check Fast Crossed Over Slow ...
bool XMRBHLPIsFastCrossedOverSlow(
int bar_index // Bar Index ...
)
{
//
bool result = false;
//
if (!XMRBHLPIsValidArraySize(bar_index))
{
return result;
}
//
result =
//
IsCrossOver(
mrbFastBuffer,
mrbSlowBuffer,
bar_index)
//
;
//
return result;
}
//
// Check Fast Under Slow ...
bool XMRBHLPIsFastUnderSlow(
int bar_index // Bar Index ...
)
{
//
bool result = false;
//
if (!XMRBHLPIsValidArraySize(bar_index))
{
return result;
}
//
result =
//
IsUnder(
mrbFastBuffer,
mrbSlowBuffer,
bar_index)
//
;
//
return result;
}
//
// Check Fast Crossed Under Slow ...
bool XMRBHLPIsFastCrossedUnderSlow(
int bar_index // Bar Index ...
)
{
//
bool result = false;
//
if (!XMRBHLPIsValidArraySize(bar_index))
{
return result;
}
//
result =
//
IsCrossUnder(
mrbFastBuffer,
mrbSlowBuffer,
bar_index)
//
;
//
return result;
}
//
bool XMRBHLPIsValidArraySize(int bar_index)
{
//
bool result = false;
//
if (bar_index < 0)
{
return result;
}
//
int rCount = ArraySize(mrbFastBuffer);
result = rCount > bar_index + 1;
//
return result;
}
//
// END Helper Functions ...
//