add MQL5Test Workspace Content as BKP Solution ...
This commit is contained in:
+235
@@ -0,0 +1,235 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SaherElm IT Center MQL5 XATRSLHLP 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 ...
|
||||
//
|
||||
|
||||
//
|
||||
// XPeaksAndVales Exported Buffers ...
|
||||
enum ENUM_X_XATRSL_BUFFERS
|
||||
{
|
||||
//
|
||||
X_ATRSL_UP_LINE = 0,
|
||||
X_ATRSL_DOWN_LINE = 1,
|
||||
X_ATRSL_SAR_LINE = 2,
|
||||
X_ATRSL_RMA_LINE = 3,
|
||||
X_ATRSL_WMA_LINE = 4,
|
||||
X_ATRSL_MA1_LINE = 5,
|
||||
X_ATRSL_SMA_LINE = 6,
|
||||
X_ATRSL_EMA_LINE = 7,
|
||||
X_ATRSL_ATR_LINE = 8,
|
||||
};
|
||||
|
||||
//
|
||||
// END Constants/Enums ...
|
||||
//
|
||||
|
||||
//
|
||||
// START Definitions ...
|
||||
//
|
||||
|
||||
//
|
||||
double atrslUpBuffer[];
|
||||
double atrslDownBuffer[];
|
||||
double atrslSarBuffer[];
|
||||
|
||||
//
|
||||
int atrslHandler = INVALID_HANDLE;
|
||||
|
||||
//
|
||||
// END Definitions ...
|
||||
//
|
||||
|
||||
//
|
||||
// START Handler Functions ...
|
||||
//
|
||||
|
||||
//
|
||||
bool XATRSLHLPOnInit()
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
ArraySetAsSeries(atrslUpBuffer, true);
|
||||
ArraySetAsSeries(atrslSarBuffer, true);
|
||||
ArraySetAsSeries(atrslDownBuffer, true);
|
||||
|
||||
//
|
||||
// Initial Handler ...
|
||||
atrslHandler = iCustom(
|
||||
_Symbol,
|
||||
_Period,
|
||||
"x-saherelm.x121.xatrsl",
|
||||
//
|
||||
// Inputs ...
|
||||
//
|
||||
// MARKET ...
|
||||
"",
|
||||
14,
|
||||
0.02,
|
||||
0.2,
|
||||
PRICE_HIGH,
|
||||
PRICE_LOW,
|
||||
//
|
||||
// PRESENTATION ...
|
||||
"",
|
||||
false,
|
||||
false,
|
||||
true
|
||||
//
|
||||
);
|
||||
result = atrslHandler != INVALID_HANDLE;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
void XATRSLHLPOnDeInit()
|
||||
{
|
||||
//
|
||||
// Release Indicators ...
|
||||
IndicatorRelease(atrslHandler);
|
||||
}
|
||||
|
||||
//
|
||||
void XATRSLHLPReadBuffers()
|
||||
{
|
||||
//
|
||||
// UP ...
|
||||
CopyBuffer(
|
||||
atrslHandler,
|
||||
X_ATRSL_UP_LINE,
|
||||
0,
|
||||
10,
|
||||
atrslUpBuffer);
|
||||
|
||||
//
|
||||
// DOWN ...
|
||||
CopyBuffer(
|
||||
atrslHandler,
|
||||
X_ATRSL_DOWN_LINE,
|
||||
0,
|
||||
10,
|
||||
atrslDownBuffer);
|
||||
|
||||
//
|
||||
// SAR ...
|
||||
CopyBuffer(
|
||||
atrslHandler,
|
||||
X_ATRSL_SAR_LINE,
|
||||
0,
|
||||
10,
|
||||
atrslSarBuffer);
|
||||
}
|
||||
|
||||
//
|
||||
// END Handler Functions ...
|
||||
//
|
||||
|
||||
//
|
||||
// START Helper Functions ...
|
||||
//
|
||||
|
||||
//
|
||||
// Calculate Change Rate For Specific Bar ...
|
||||
double XATRSLHLPGetChangeRate(
|
||||
int bar_index // Bar Index ...
|
||||
)
|
||||
{
|
||||
//
|
||||
double result = 0;
|
||||
|
||||
//
|
||||
if (!XATRSLHLPIsValidArraySize(bar_index))
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
result = MathAbs(atrslUpBuffer[bar_index] - atrslDownBuffer[bar_index]);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Calculate Change Rate For Specific Lenght ...
|
||||
double XATRSLHLPGetRangeChangeRate(
|
||||
int bar_index, // Bar Index ...
|
||||
int length = 5 // Loopback Length ...
|
||||
)
|
||||
{
|
||||
//
|
||||
double result = 0;
|
||||
|
||||
//
|
||||
int size = bar_index + length;
|
||||
if (!XATRSLHLPIsValidArraySize(size))
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
double summary = 0;
|
||||
for (int i = bar_index; i < size; i++)
|
||||
{
|
||||
summary += MathAbs(atrslUpBuffer[i] - atrslDownBuffer[i]);
|
||||
}
|
||||
|
||||
//
|
||||
result = summary / size;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Check Array Size ...
|
||||
bool XATRSLHLPIsValidArraySize(int bar_index)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
int rCount = ArraySize(atrslUpBuffer);
|
||||
result = rCount > bar_index + 1;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// END Helper Functions ...
|
||||
//
|
||||
+938
@@ -0,0 +1,938 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SaherElm IT Center MQL5 XICHIHLP 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 ...
|
||||
//
|
||||
|
||||
//
|
||||
// Ichimoku Lines Calculator Mode ...
|
||||
enum ENUM_X_ICHIMOKU_CALCULATION_MODE
|
||||
{
|
||||
//
|
||||
X_XICH_HH_LL_MODE = 1, // Highest High and Lowest Low
|
||||
X_XICH_HO_LC_MODE = 2, // Highest Open and Lowest Close
|
||||
};
|
||||
|
||||
//
|
||||
// Ichimoku Indicator Exported Buffers ...
|
||||
enum ENUM_X_ICHIMOKU_BUFFERS
|
||||
{
|
||||
//
|
||||
X_TENKANSEN_LINE = 0,
|
||||
X_KIJUNSEN_LINE = 1,
|
||||
X_CHIKOUSPAN_LINE = 4,
|
||||
X_SENKOUSPAN_A_LINE = 5,
|
||||
X_SENKOUSPAN_B_LINE = 6,
|
||||
};
|
||||
|
||||
//
|
||||
// Model Ichimoku Data ...
|
||||
struct XIchiInfo
|
||||
{
|
||||
//
|
||||
int bar;
|
||||
|
||||
//
|
||||
double tenkanSen;
|
||||
double kijunSen;
|
||||
|
||||
//
|
||||
double chikouSpan;
|
||||
|
||||
//
|
||||
double senkouSpanA;
|
||||
double senkouSpanB;
|
||||
|
||||
//
|
||||
double senkouSpanAFuture;
|
||||
double senkouSpanBFuture;
|
||||
};
|
||||
|
||||
//
|
||||
double ichiPivots[];
|
||||
|
||||
//
|
||||
// END Constants/Enums ...
|
||||
//
|
||||
|
||||
//
|
||||
// START Definitions ...
|
||||
//
|
||||
|
||||
//
|
||||
double ichiTenkanSenBuffer[];
|
||||
double ichiKijunSenBuffer[];
|
||||
double ichiChikouSpanBuffer[];
|
||||
double ichiSenkouSpanABuffer[];
|
||||
double ichiSenkouSpanBBuffer[];
|
||||
|
||||
//
|
||||
int ichiHandler = INVALID_HANDLE;
|
||||
|
||||
//
|
||||
// END Definitions ...
|
||||
//
|
||||
|
||||
//
|
||||
// START Handler Functions ...
|
||||
//
|
||||
|
||||
//
|
||||
bool XICHIHLPOnInit()
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
ArraySetAsSeries(ichiTenkanSenBuffer, true);
|
||||
ArraySetAsSeries(ichiKijunSenBuffer, true);
|
||||
ArraySetAsSeries(ichiChikouSpanBuffer, true);
|
||||
ArraySetAsSeries(ichiSenkouSpanABuffer, true);
|
||||
ArraySetAsSeries(ichiSenkouSpanBBuffer, true);
|
||||
|
||||
//
|
||||
ArraySetAsSeries(ichiPivots, true);
|
||||
|
||||
//
|
||||
// Initial Handler ...
|
||||
ichiHandler = iCustom(
|
||||
_Symbol,
|
||||
_Period,
|
||||
"x-saherelm.x121.xich",
|
||||
//
|
||||
// Inputs ...
|
||||
//
|
||||
// TENKANSEN ...
|
||||
"",
|
||||
9,
|
||||
X_XICH_HH_LL_MODE,
|
||||
//
|
||||
// KIJUNSEN ...
|
||||
"",
|
||||
26,
|
||||
X_XICH_HH_LL_MODE,
|
||||
//
|
||||
// SENKOUSPANB ...
|
||||
"",
|
||||
52,
|
||||
X_XICH_HH_LL_MODE,
|
||||
//
|
||||
// CHIKOUSPAN ...
|
||||
"",
|
||||
PRICE_CLOSE,
|
||||
//
|
||||
// PRESENTATION ...
|
||||
"",
|
||||
true,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
true // Shift Kumo ...
|
||||
//
|
||||
);
|
||||
result = ichiHandler != INVALID_HANDLE;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
void XICHIHLPOnDeInit()
|
||||
{
|
||||
//
|
||||
// Release Indicators ...
|
||||
IndicatorRelease(ichiHandler);
|
||||
}
|
||||
|
||||
//
|
||||
void XICHIHLPReadBuffers()
|
||||
{
|
||||
//
|
||||
// TENKANSEN ...
|
||||
CopyBuffer(
|
||||
ichiHandler,
|
||||
X_TENKANSEN_LINE,
|
||||
0,
|
||||
26,
|
||||
ichiTenkanSenBuffer);
|
||||
|
||||
//
|
||||
// KIJUNSEN ...
|
||||
CopyBuffer(
|
||||
ichiHandler,
|
||||
X_KIJUNSEN_LINE,
|
||||
0,
|
||||
26,
|
||||
ichiKijunSenBuffer);
|
||||
|
||||
//
|
||||
// CHIKOUSPAN ...
|
||||
CopyBuffer(
|
||||
ichiHandler,
|
||||
X_CHIKOUSPAN_LINE,
|
||||
27,
|
||||
52,
|
||||
ichiChikouSpanBuffer);
|
||||
|
||||
//
|
||||
// SENKOUSPANA ...
|
||||
CopyBuffer(
|
||||
ichiHandler,
|
||||
X_SENKOUSPAN_A_LINE,
|
||||
-26,
|
||||
52,
|
||||
ichiSenkouSpanABuffer);
|
||||
|
||||
//
|
||||
// SENKOUSPANB ...
|
||||
CopyBuffer(
|
||||
ichiHandler,
|
||||
X_SENKOUSPAN_B_LINE,
|
||||
-26,
|
||||
52,
|
||||
ichiSenkouSpanBBuffer);
|
||||
|
||||
//
|
||||
XICHIHLPFindPivotPoints();
|
||||
}
|
||||
|
||||
//
|
||||
// END Handler Functions ...
|
||||
//
|
||||
|
||||
//
|
||||
// START Helper Functions ...
|
||||
//
|
||||
|
||||
//
|
||||
// Retrieve Ichimoku Data at Specific Bar Index ...
|
||||
XIchiInfo XICHIHLPGetInfo(
|
||||
int bar_index // Bar Index ...
|
||||
)
|
||||
{
|
||||
//
|
||||
XIchiInfo result = {};
|
||||
|
||||
//
|
||||
result.bar = bar_index;
|
||||
result.tenkanSen = ichiTenkanSenBuffer[bar_index];
|
||||
result.kijunSen = ichiKijunSenBuffer[bar_index];
|
||||
result.chikouSpan = ichiChikouSpanBuffer[bar_index + 26];
|
||||
result.senkouSpanA = ichiSenkouSpanABuffer[bar_index + 26];
|
||||
result.senkouSpanB = ichiSenkouSpanBBuffer[bar_index + 26];
|
||||
result.senkouSpanAFuture = ichiSenkouSpanABuffer[bar_index];
|
||||
result.senkouSpanBFuture = ichiSenkouSpanBBuffer[bar_index];
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Check Tenkan Sen Over Kijun Sen ...
|
||||
bool XICHIHLPIsTenkanSenOverKijunSen(
|
||||
int bar_index // Bar Index ...
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
XIchiInfo point = XICHIHLPGetInfo(bar_index);
|
||||
|
||||
//
|
||||
result =
|
||||
//
|
||||
point.tenkanSen > point.kijunSen
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Is Tenkan Sen Under Kijun Sen ...
|
||||
bool XICHIHLPIsTenkanSenUnderKijunSen(
|
||||
int bar_index // Bar Index ...
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
XIchiInfo point = XICHIHLPGetInfo(bar_index);
|
||||
|
||||
//
|
||||
result =
|
||||
//
|
||||
point.tenkanSen < point.kijunSen
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Tenkan Sen Croosed Over Kijun Sen ...
|
||||
bool XICHIHLPIsTenkanSenCrossedOverKijunSen(
|
||||
int bar_index // Bar Index ...
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
XIchiInfo point = XICHIHLPGetInfo(bar_index);
|
||||
XIchiInfo pointPrev = XICHIHLPGetInfo(bar_index + 1);
|
||||
|
||||
//
|
||||
result =
|
||||
//
|
||||
point.tenkanSen > point.kijunSen &&
|
||||
pointPrev.tenkanSen <= pointPrev.kijunSen
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Tenkan Sen Croosed Under Kijun Sen ...
|
||||
bool XICHIHLPIsTenkanSenCrossedUnderKijunSen(
|
||||
int bar_index // Bar Index ...
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
XIchiInfo point = XICHIHLPGetInfo(bar_index);
|
||||
XIchiInfo pointPrev = XICHIHLPGetInfo(bar_index + 1);
|
||||
|
||||
//
|
||||
result =
|
||||
//
|
||||
point.tenkanSen < point.kijunSen &&
|
||||
pointPrev.tenkanSen >= pointPrev.kijunSen
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Check Kumo is Bullish ...
|
||||
bool XICHIHLPIsKumoBullish(
|
||||
int bar_index, // Bar Index ...
|
||||
bool onFuture = false // Future Check ...
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
XIchiInfo point = XICHIHLPGetInfo(bar_index);
|
||||
XIchiInfo pointPrev = XICHIHLPGetInfo(bar_index + 1);
|
||||
|
||||
//
|
||||
double ssa = onFuture
|
||||
? point.senkouSpanAFuture
|
||||
: point.senkouSpanA;
|
||||
|
||||
//
|
||||
double ssb = onFuture
|
||||
? point.senkouSpanBFuture
|
||||
: point.senkouSpanB;
|
||||
|
||||
//
|
||||
result =
|
||||
//
|
||||
ssa > ssb
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Check Kumo is Bearish ...
|
||||
bool XICHIHLPIsKumoBearish(
|
||||
int bar_index, // Bar Index ...
|
||||
bool onFuture = false // Future Check ...
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
XIchiInfo point = XICHIHLPGetInfo(bar_index);
|
||||
XIchiInfo pointPrev = XICHIHLPGetInfo(bar_index + 1);
|
||||
|
||||
//
|
||||
double ssa = onFuture
|
||||
? point.senkouSpanAFuture
|
||||
: point.senkouSpanA;
|
||||
|
||||
//
|
||||
double ssb = onFuture
|
||||
? point.senkouSpanBFuture
|
||||
: point.senkouSpanB;
|
||||
|
||||
//
|
||||
result =
|
||||
//
|
||||
ssa < ssb
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Check Kumo is Change to Bullish ...
|
||||
bool XICHIHLPIsKumoSwitchedToBullish(
|
||||
int bar_index, // Bar Index ...
|
||||
bool onFuture = false // Future Check ...
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
XIchiInfo point = XICHIHLPGetInfo(bar_index);
|
||||
XIchiInfo pointPrev = XICHIHLPGetInfo(bar_index + 1);
|
||||
|
||||
//
|
||||
double ssa = onFuture
|
||||
? point.senkouSpanAFuture
|
||||
: point.senkouSpanA;
|
||||
|
||||
//
|
||||
double ssb = onFuture
|
||||
? point.senkouSpanBFuture
|
||||
: point.senkouSpanB;
|
||||
|
||||
//
|
||||
double ssaPrev = onFuture
|
||||
? pointPrev.senkouSpanAFuture
|
||||
: pointPrev.senkouSpanA;
|
||||
|
||||
//
|
||||
double ssbPrev = onFuture
|
||||
? pointPrev.senkouSpanBFuture
|
||||
: pointPrev.senkouSpanB;
|
||||
|
||||
//
|
||||
result =
|
||||
//
|
||||
ssa > ssb &&
|
||||
ssaPrev <= ssbPrev
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Check Kumo is Change to Bearish ...
|
||||
bool XICHIHLPIsKumoSwitchedToBearish(
|
||||
int bar_index, // Bar Index ...
|
||||
bool onFuture = false // Future Check ...
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
XIchiInfo point = XICHIHLPGetInfo(bar_index);
|
||||
XIchiInfo pointPrev = XICHIHLPGetInfo(bar_index + 1);
|
||||
|
||||
//
|
||||
double ssa = onFuture
|
||||
? point.senkouSpanAFuture
|
||||
: point.senkouSpanA;
|
||||
|
||||
//
|
||||
double ssb = onFuture
|
||||
? point.senkouSpanBFuture
|
||||
: point.senkouSpanB;
|
||||
|
||||
//
|
||||
double ssaPrev = onFuture
|
||||
? pointPrev.senkouSpanAFuture
|
||||
: pointPrev.senkouSpanA;
|
||||
|
||||
//
|
||||
double ssbPrev = onFuture
|
||||
? pointPrev.senkouSpanBFuture
|
||||
: pointPrev.senkouSpanB;
|
||||
|
||||
//
|
||||
result =
|
||||
//
|
||||
ssa < ssb &&
|
||||
ssaPrev >= ssbPrev
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// TENKANSEN and SENKOUSPAN ...
|
||||
|
||||
//
|
||||
bool XICHIHLPIsTenkanSenCrossedOverSenkouSpanA(
|
||||
int bar_index, // Bar Index ...
|
||||
bool onFuture = false // Future Check ...
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
XIchiInfo point = XICHIHLPGetInfo(bar_index);
|
||||
XIchiInfo pointPrev = XICHIHLPGetInfo(bar_index + 1);
|
||||
|
||||
//
|
||||
double dest = onFuture
|
||||
? point.senkouSpanAFuture
|
||||
: point.senkouSpanA;
|
||||
|
||||
//
|
||||
double destPrev = onFuture
|
||||
? pointPrev.senkouSpanAFuture
|
||||
: pointPrev.senkouSpanA;
|
||||
|
||||
//
|
||||
result =
|
||||
//
|
||||
point.tenkanSen > dest &&
|
||||
pointPrev.tenkanSen <= destPrev
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
bool XICHIHLPIsTenkanSenCrossedUnderSenkouSpanA(
|
||||
int bar_index, // Bar Index ...
|
||||
bool onFuture = false // Future Check ...
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
XIchiInfo point = XICHIHLPGetInfo(bar_index);
|
||||
XIchiInfo pointPrev = XICHIHLPGetInfo(bar_index + 1);
|
||||
|
||||
//
|
||||
double dest = onFuture
|
||||
? point.senkouSpanAFuture
|
||||
: point.senkouSpanA;
|
||||
|
||||
//
|
||||
double destPrev = onFuture
|
||||
? pointPrev.senkouSpanAFuture
|
||||
: pointPrev.senkouSpanA;
|
||||
|
||||
//
|
||||
result =
|
||||
//
|
||||
point.tenkanSen < dest &&
|
||||
pointPrev.tenkanSen >= destPrev
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
bool XICHIHLPIsTenkanSenCrossedOverSenkouSpanB(
|
||||
int bar_index, // Bar Index ...
|
||||
bool onFuture = false // Future Check ...
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
XIchiInfo point = XICHIHLPGetInfo(bar_index);
|
||||
XIchiInfo pointPrev = XICHIHLPGetInfo(bar_index + 1);
|
||||
|
||||
//
|
||||
double dest = onFuture
|
||||
? point.senkouSpanBFuture
|
||||
: point.senkouSpanB;
|
||||
|
||||
//
|
||||
double destPrev = onFuture
|
||||
? pointPrev.senkouSpanBFuture
|
||||
: pointPrev.senkouSpanB;
|
||||
|
||||
//
|
||||
result =
|
||||
//
|
||||
point.tenkanSen > dest &&
|
||||
pointPrev.tenkanSen <= destPrev
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
bool XICHIHLPIsTenkanSenCrossedUnderSenkouSpanB(
|
||||
int bar_index, // Bar Index ...
|
||||
bool onFuture = false // Future Check ...
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
XIchiInfo point = XICHIHLPGetInfo(bar_index);
|
||||
XIchiInfo pointPrev = XICHIHLPGetInfo(bar_index + 1);
|
||||
|
||||
//
|
||||
double dest = onFuture
|
||||
? point.senkouSpanBFuture
|
||||
: point.senkouSpanB;
|
||||
|
||||
//
|
||||
double destPrev = onFuture
|
||||
? pointPrev.senkouSpanBFuture
|
||||
: pointPrev.senkouSpanB;
|
||||
|
||||
//
|
||||
result =
|
||||
//
|
||||
point.tenkanSen < dest &&
|
||||
pointPrev.tenkanSen >= destPrev
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// KIJUNSEN and SENKOUSPAN ...
|
||||
|
||||
//
|
||||
bool XICHIHLPIsKijunSenCrossedOverSenkouSpanA(
|
||||
int bar_index, // Bar Index ...
|
||||
bool onFuture = false // Future Check ...
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
XIchiInfo point = XICHIHLPGetInfo(bar_index);
|
||||
XIchiInfo pointPrev = XICHIHLPGetInfo(bar_index + 1);
|
||||
|
||||
//
|
||||
double dest = onFuture
|
||||
? point.senkouSpanAFuture
|
||||
: point.senkouSpanA;
|
||||
|
||||
//
|
||||
double destPrev = onFuture
|
||||
? pointPrev.senkouSpanAFuture
|
||||
: pointPrev.senkouSpanA;
|
||||
|
||||
//
|
||||
result =
|
||||
//
|
||||
point.kijunSen > dest &&
|
||||
pointPrev.kijunSen <= destPrev
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
bool XICHIHLPIsKijunSenCrossedUnderSenkouSpanA(
|
||||
int bar_index, // Bar Index ...
|
||||
bool onFuture = false // Future Check ...
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
XIchiInfo point = XICHIHLPGetInfo(bar_index);
|
||||
XIchiInfo pointPrev = XICHIHLPGetInfo(bar_index + 1);
|
||||
|
||||
//
|
||||
double dest = onFuture
|
||||
? point.senkouSpanAFuture
|
||||
: point.senkouSpanA;
|
||||
|
||||
//
|
||||
double destPrev = onFuture
|
||||
? pointPrev.senkouSpanAFuture
|
||||
: pointPrev.senkouSpanA;
|
||||
|
||||
//
|
||||
result =
|
||||
//
|
||||
point.kijunSen < dest &&
|
||||
pointPrev.kijunSen >= destPrev
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
bool XICHIHLPIsKijunSenCrossedOverSenkouSpanB(
|
||||
int bar_index, // Bar Index ...
|
||||
bool onFuture = false // Future Check ...
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
XIchiInfo point = XICHIHLPGetInfo(bar_index);
|
||||
XIchiInfo pointPrev = XICHIHLPGetInfo(bar_index + 1);
|
||||
|
||||
//
|
||||
double dest = onFuture
|
||||
? point.senkouSpanBFuture
|
||||
: point.senkouSpanB;
|
||||
|
||||
//
|
||||
double destPrev = onFuture
|
||||
? pointPrev.senkouSpanBFuture
|
||||
: pointPrev.senkouSpanB;
|
||||
|
||||
//
|
||||
result =
|
||||
//
|
||||
point.kijunSen > dest &&
|
||||
pointPrev.kijunSen <= destPrev
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
bool XICHIHLPIsKijunSenCrossedUnderSenkouSpanB(
|
||||
int bar_index, // Bar Index ...
|
||||
bool onFuture = false // Future Check ...
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
XIchiInfo point = XICHIHLPGetInfo(bar_index);
|
||||
XIchiInfo pointPrev = XICHIHLPGetInfo(bar_index + 1);
|
||||
|
||||
//
|
||||
double dest = onFuture
|
||||
? point.senkouSpanBFuture
|
||||
: point.senkouSpanB;
|
||||
|
||||
//
|
||||
double destPrev = onFuture
|
||||
? pointPrev.senkouSpanBFuture
|
||||
: pointPrev.senkouSpanB;
|
||||
|
||||
//
|
||||
result =
|
||||
//
|
||||
point.kijunSen < dest &&
|
||||
pointPrev.kijunSen >= destPrev
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
bool XICHIHLPIsValidArraySize(int bar_index)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
if (bar_index < 0)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
int rCount = ArraySize(ichiTenkanSenBuffer);
|
||||
result = rCount > bar_index + 1;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// SUPPORT and RESISTANCE ...
|
||||
|
||||
//
|
||||
// Find Pivot Areas in Ichimooku ...
|
||||
void XICHIHLPFindPivotPoints()
|
||||
{
|
||||
//
|
||||
double smoothingPoint = 3;
|
||||
int verifications = 3;
|
||||
|
||||
//
|
||||
// FLATS ...
|
||||
double tmpFlats[];
|
||||
int tmpFlatsCount = 0;
|
||||
|
||||
//
|
||||
// TenkanSen Flats ...
|
||||
FindSameValueInBuffer(
|
||||
tmpFlats,
|
||||
ichiTenkanSenBuffer);
|
||||
tmpFlatsCount = ArraySize(tmpFlats);
|
||||
if (tmpFlatsCount > 0)
|
||||
{
|
||||
//
|
||||
AddsIfNotExists(
|
||||
tmpFlats,
|
||||
ichiPivots,
|
||||
smoothingPoint);
|
||||
|
||||
//
|
||||
Clean(tmpFlats);
|
||||
}
|
||||
|
||||
//
|
||||
// KijunSen Flats ...
|
||||
FindSameValueInBuffer(
|
||||
tmpFlats,
|
||||
ichiKijunSenBuffer);
|
||||
tmpFlatsCount = ArraySize(tmpFlats);
|
||||
if (tmpFlatsCount > 0)
|
||||
{
|
||||
//
|
||||
AddsIfNotExists(
|
||||
tmpFlats,
|
||||
ichiPivots,
|
||||
smoothingPoint);
|
||||
|
||||
//
|
||||
Clean(tmpFlats);
|
||||
}
|
||||
|
||||
//
|
||||
// SenkouSpanA Flats ...
|
||||
FindSameValueInBuffer(
|
||||
tmpFlats,
|
||||
ichiSenkouSpanABuffer);
|
||||
tmpFlatsCount = ArraySize(tmpFlats);
|
||||
if (tmpFlatsCount > 0)
|
||||
{
|
||||
//
|
||||
AddsIfNotExists(
|
||||
tmpFlats,
|
||||
ichiPivots,
|
||||
smoothingPoint);
|
||||
|
||||
//
|
||||
Clean(tmpFlats);
|
||||
}
|
||||
|
||||
//
|
||||
// SenkouSpanB Flats ...
|
||||
FindSameValueInBuffer(
|
||||
tmpFlats,
|
||||
ichiSenkouSpanBBuffer);
|
||||
tmpFlatsCount = ArraySize(tmpFlats);
|
||||
if (tmpFlatsCount > 0)
|
||||
{
|
||||
//
|
||||
AddsIfNotExists(
|
||||
tmpFlats,
|
||||
ichiPivots,
|
||||
smoothingPoint);
|
||||
|
||||
//
|
||||
Clean(tmpFlats);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Extract Support and Resistances ...
|
||||
XOHCLSupRes XICHIHLPFindCandleSupprtAndResistance(
|
||||
int bar_index, // Bar Index ...
|
||||
int count = 3 // Number of Requireds ...
|
||||
)
|
||||
{
|
||||
//
|
||||
XOHCLSupRes result = ExtractSupportAndResistance(
|
||||
bar_index,
|
||||
ichiPivots,
|
||||
count,
|
||||
_Symbol,
|
||||
_Period);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// END Helper Functions ...
|
||||
//
|
||||
+309
@@ -0,0 +1,309 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SaherElm IT Center MQL5 XMCHLP 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 ...
|
||||
//
|
||||
|
||||
//
|
||||
// XMC Exported Buffers ...
|
||||
enum ENUM_X_XMC_BUFFERS
|
||||
{
|
||||
//
|
||||
X_MC_FAST_LINE = 0,
|
||||
X_MC_SLOW_LINE = 1,
|
||||
X_MC_VERIFIER_LINE = 2,
|
||||
};
|
||||
|
||||
//
|
||||
// END Constants/Enums ...
|
||||
//
|
||||
|
||||
//
|
||||
// START Definitions ...
|
||||
//
|
||||
|
||||
//
|
||||
double mcFastBuffer[];
|
||||
double mcSlowBuffer[];
|
||||
double mcVerifierBuffer[];
|
||||
|
||||
//
|
||||
int mcHandler = INVALID_HANDLE;
|
||||
|
||||
//
|
||||
// END Definitions ...
|
||||
//
|
||||
|
||||
//
|
||||
// START Handler Functions ...
|
||||
//
|
||||
|
||||
//
|
||||
bool XMCHLPOnInit()
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
ArraySetAsSeries(mcFastBuffer, true);
|
||||
ArraySetAsSeries(mcSlowBuffer, true);
|
||||
ArraySetAsSeries(mcVerifierBuffer, true);
|
||||
|
||||
//
|
||||
// Initial Handler ...
|
||||
mcHandler = iCustom(
|
||||
_Symbol,
|
||||
_Period,
|
||||
"x-saherelm.x121.xmc",
|
||||
//
|
||||
// Inputs ...
|
||||
//
|
||||
// FAST ...
|
||||
"",
|
||||
9,
|
||||
0,
|
||||
MODE_EMA,
|
||||
PRICE_CLOSE,
|
||||
//
|
||||
// SLOW ...
|
||||
"",
|
||||
18,
|
||||
0,
|
||||
MODE_EMA,
|
||||
PRICE_CLOSE,
|
||||
//
|
||||
// VERIFIER ...
|
||||
"",
|
||||
50,
|
||||
0,
|
||||
MODE_EMA,
|
||||
PRICE_CLOSE,
|
||||
//
|
||||
"",
|
||||
false,
|
||||
false,
|
||||
false
|
||||
//
|
||||
);
|
||||
result = mcHandler != INVALID_HANDLE;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
void XMCHLPOnDeInit()
|
||||
{
|
||||
//
|
||||
// Release Indicators ...
|
||||
IndicatorRelease(mcHandler);
|
||||
}
|
||||
|
||||
//
|
||||
void XMCHLPReadBuffers()
|
||||
{
|
||||
//
|
||||
// FAST ...
|
||||
CopyBuffer(
|
||||
mcHandler,
|
||||
X_MC_FAST_LINE,
|
||||
0,
|
||||
52,
|
||||
mcFastBuffer);
|
||||
|
||||
//
|
||||
// SLOW ...
|
||||
CopyBuffer(
|
||||
mcHandler,
|
||||
X_MC_SLOW_LINE,
|
||||
0,
|
||||
52,
|
||||
mcSlowBuffer);
|
||||
|
||||
//
|
||||
// VERIFIER ...
|
||||
CopyBuffer(
|
||||
mcHandler,
|
||||
X_MC_VERIFIER_LINE,
|
||||
0,
|
||||
52,
|
||||
mcVerifierBuffer);
|
||||
}
|
||||
|
||||
//
|
||||
// END Handler Functions ...
|
||||
//
|
||||
|
||||
//
|
||||
// START Helper Functions ...
|
||||
//
|
||||
|
||||
//
|
||||
// Check Fast Over Slow ...
|
||||
bool XMCHLPIsFastOverSlow(
|
||||
int bar_index // Bar Index ...
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
if (!XMCHLPIsValidArraySize(bar_index))
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
result =
|
||||
//
|
||||
IsOver(
|
||||
mcFastBuffer,
|
||||
mcSlowBuffer,
|
||||
bar_index)
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Check Fast Crossed Over Slow ...
|
||||
bool XMCHLPIsFastCrossedOverSlow(
|
||||
int bar_index // Bar Index ...
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
if (!XMCHLPIsValidArraySize(bar_index))
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
result =
|
||||
//
|
||||
IsCrossOver(
|
||||
mcFastBuffer,
|
||||
mcSlowBuffer,
|
||||
bar_index)
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Check Fast Under Slow ...
|
||||
bool XMCHLPIsFastUnderSlow(
|
||||
int bar_index // Bar Index ...
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
if (!XMCHLPIsValidArraySize(bar_index))
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
result =
|
||||
//
|
||||
IsUnder(
|
||||
mcFastBuffer,
|
||||
mcSlowBuffer,
|
||||
bar_index)
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Check Fast Crossed Under Slow ...
|
||||
bool XMCHLPIsFastCrossedUnderSlow(
|
||||
int bar_index // Bar Index ...
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
if (!XMCHLPIsValidArraySize(bar_index))
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
result =
|
||||
//
|
||||
IsCrossUnder(
|
||||
mcFastBuffer,
|
||||
mcSlowBuffer,
|
||||
bar_index)
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
bool XMCHLPIsValidArraySize(int bar_index)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
if (bar_index < 0)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
int rCount = ArraySize(mcFastBuffer);
|
||||
result = rCount > bar_index + 1;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// END Helper Functions ...
|
||||
//
|
||||
+314
@@ -0,0 +1,314 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 ...
|
||||
//
|
||||
+803
@@ -0,0 +1,803 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SaherElm IT Center MQL5 XPVHLP 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 ...
|
||||
//
|
||||
|
||||
//
|
||||
// XPeaksAndVales Exported Buffers ...
|
||||
enum ENUM_X_XPV_BUFFERS
|
||||
{
|
||||
//
|
||||
// PEAKSANDVALES ...
|
||||
X_PV_P_LINE = 0,
|
||||
X_PV_V_LINE = 1,
|
||||
//
|
||||
// SUPPORTRESISTANCE ...
|
||||
X_PV_R_LINE = 2,
|
||||
X_PV_S_LINE = 4,
|
||||
//
|
||||
// SHORT ...
|
||||
X_PV_SHH_LINE = 6,
|
||||
X_PV_SLL_LINE = 7,
|
||||
//
|
||||
// MEDIUM ...
|
||||
X_PV_MHH_LINE = 8,
|
||||
X_PV_MLL_LINE = 9,
|
||||
//
|
||||
// LONG ...
|
||||
X_PV_LHH_LINE = 10,
|
||||
X_PV_LLL_LINE = 11,
|
||||
//
|
||||
// HIND ...
|
||||
X_PV_HHH_LINE = 12,
|
||||
X_PV_HLL_LINE = 13,
|
||||
};
|
||||
|
||||
//
|
||||
// END Constants/Enums ...
|
||||
//
|
||||
|
||||
//
|
||||
// START Definitions ...
|
||||
//
|
||||
|
||||
//
|
||||
double pvPivots[];
|
||||
|
||||
//
|
||||
double pvPBuffer[];
|
||||
double pvVBuffer[];
|
||||
double pvRBuffer[];
|
||||
double pvSBuffer[];
|
||||
double pvSHHBuffer[];
|
||||
double pvSLLBuffer[];
|
||||
double pvMHHBuffer[];
|
||||
double pvMLLBuffer[];
|
||||
double pvLHHBuffer[];
|
||||
double pvLLLBuffer[];
|
||||
double pvHHHBuffer[];
|
||||
double pvHLLBuffer[];
|
||||
|
||||
//
|
||||
int mpvHandler = INVALID_HANDLE;
|
||||
|
||||
//
|
||||
// END Definitions ...
|
||||
//
|
||||
|
||||
//
|
||||
// START Handler Functions ...
|
||||
//
|
||||
|
||||
//
|
||||
bool XPVHLPOnInit()
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
ArraySetAsSeries(pvPivots, true);
|
||||
|
||||
//
|
||||
ArraySetAsSeries(pvPBuffer, true);
|
||||
ArraySetAsSeries(pvVBuffer, true);
|
||||
ArraySetAsSeries(pvRBuffer, true);
|
||||
ArraySetAsSeries(pvSBuffer, true);
|
||||
ArraySetAsSeries(pvSHHBuffer, true);
|
||||
ArraySetAsSeries(pvSLLBuffer, true);
|
||||
ArraySetAsSeries(pvMHHBuffer, true);
|
||||
ArraySetAsSeries(pvMLLBuffer, true);
|
||||
ArraySetAsSeries(pvLHHBuffer, true);
|
||||
ArraySetAsSeries(pvLLLBuffer, true);
|
||||
ArraySetAsSeries(pvHHHBuffer, true);
|
||||
ArraySetAsSeries(pvHLLBuffer, true);
|
||||
|
||||
//
|
||||
// Initial Handler ...
|
||||
mpvHandler = iCustom(
|
||||
_Symbol,
|
||||
_Period,
|
||||
"x-saherelm.x121.xpv",
|
||||
//
|
||||
// Inputs ...
|
||||
//
|
||||
// MARKET ...
|
||||
"",
|
||||
9,
|
||||
17,
|
||||
26,
|
||||
35,
|
||||
//
|
||||
// TREND ...
|
||||
"",
|
||||
10,
|
||||
//
|
||||
// DETECTION ...
|
||||
"",
|
||||
MODE_HIGH,
|
||||
MODE_LOW,
|
||||
//
|
||||
"",
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
false
|
||||
//
|
||||
);
|
||||
result = mpvHandler != INVALID_HANDLE;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
void XPVHLPOnDeInit()
|
||||
{
|
||||
//
|
||||
// Release Indicators ...
|
||||
IndicatorRelease(mpvHandler);
|
||||
}
|
||||
|
||||
//
|
||||
void XPVHLPReadBuffers(int bar_index = 0)
|
||||
{
|
||||
//
|
||||
// PEAKS ...
|
||||
CopyBuffer(
|
||||
mpvHandler,
|
||||
X_PV_P_LINE,
|
||||
bar_index,
|
||||
bar_index + 100,
|
||||
pvPBuffer);
|
||||
|
||||
//
|
||||
// VALES ...
|
||||
CopyBuffer(
|
||||
mpvHandler,
|
||||
X_PV_V_LINE,
|
||||
bar_index,
|
||||
bar_index + 100,
|
||||
pvVBuffer);
|
||||
|
||||
//
|
||||
// R ...
|
||||
CopyBuffer(
|
||||
mpvHandler,
|
||||
X_PV_R_LINE,
|
||||
bar_index,
|
||||
bar_index + 100,
|
||||
pvRBuffer);
|
||||
|
||||
//
|
||||
// S ...
|
||||
CopyBuffer(
|
||||
mpvHandler,
|
||||
X_PV_S_LINE,
|
||||
bar_index,
|
||||
bar_index + 100,
|
||||
pvSBuffer);
|
||||
|
||||
//
|
||||
// SHORT ...
|
||||
|
||||
//
|
||||
// HIGH ...
|
||||
CopyBuffer(
|
||||
mpvHandler,
|
||||
X_PV_SHH_LINE,
|
||||
bar_index,
|
||||
bar_index + 100,
|
||||
pvSHHBuffer);
|
||||
|
||||
//
|
||||
// LOW ...
|
||||
CopyBuffer(
|
||||
mpvHandler,
|
||||
X_PV_SLL_LINE,
|
||||
bar_index,
|
||||
bar_index + 100,
|
||||
pvSLLBuffer);
|
||||
|
||||
//
|
||||
// MEIUM ...
|
||||
|
||||
//
|
||||
// HIGH ...
|
||||
CopyBuffer(
|
||||
mpvHandler,
|
||||
X_PV_MHH_LINE,
|
||||
bar_index,
|
||||
bar_index + 100,
|
||||
pvMHHBuffer);
|
||||
|
||||
//
|
||||
// LOW ...
|
||||
CopyBuffer(
|
||||
mpvHandler,
|
||||
X_PV_MLL_LINE,
|
||||
bar_index,
|
||||
bar_index + 100,
|
||||
pvMLLBuffer);
|
||||
|
||||
//
|
||||
// LONG ...
|
||||
|
||||
//
|
||||
// HIGH ...
|
||||
CopyBuffer(
|
||||
mpvHandler,
|
||||
X_PV_LHH_LINE,
|
||||
bar_index,
|
||||
bar_index + 100,
|
||||
pvLHHBuffer);
|
||||
|
||||
//
|
||||
// LOW ...
|
||||
CopyBuffer(
|
||||
mpvHandler,
|
||||
X_PV_LLL_LINE,
|
||||
bar_index,
|
||||
bar_index + 100,
|
||||
pvLLLBuffer);
|
||||
|
||||
//
|
||||
// HIND ...
|
||||
|
||||
//
|
||||
// HIGH ...
|
||||
CopyBuffer(
|
||||
mpvHandler,
|
||||
X_PV_HHH_LINE,
|
||||
bar_index,
|
||||
bar_index + 100,
|
||||
pvHHHBuffer);
|
||||
|
||||
//
|
||||
// LOW ...
|
||||
CopyBuffer(
|
||||
mpvHandler,
|
||||
X_PV_HLL_LINE,
|
||||
bar_index,
|
||||
bar_index + 100,
|
||||
pvHLLBuffer);
|
||||
|
||||
//
|
||||
XPVHLPFindPivotPoints();
|
||||
}
|
||||
|
||||
//
|
||||
// END Handler Functions ...
|
||||
//
|
||||
|
||||
//
|
||||
// START Helper Functions ...
|
||||
//
|
||||
|
||||
//
|
||||
// Check isPeak ...
|
||||
bool XPVHLPIsPeak(int bar_index)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
if (!XPVHLPIsValidArraySize(bar_index))
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
result = pvRBuffer[bar_index] == pvHHHBuffer[bar_index] &&
|
||||
pvHHHBuffer[bar_index] == pvLHHBuffer[bar_index] &&
|
||||
pvLHHBuffer[bar_index] == pvMHHBuffer[bar_index] &&
|
||||
pvMHHBuffer[bar_index] == pvSHHBuffer[bar_index];
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Check isVale ...
|
||||
bool XPVHLPIsVale(int bar_index)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
if (!XPVHLPIsValidArraySize(bar_index))
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
result = pvSBuffer[bar_index] == pvHLLBuffer[bar_index] &&
|
||||
pvHLLBuffer[bar_index] == pvLLLBuffer[bar_index] &&
|
||||
pvLLLBuffer[bar_index] == pvMLLBuffer[bar_index] &&
|
||||
pvMLLBuffer[bar_index] == pvSLLBuffer[bar_index];
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Is Strong Support ...
|
||||
bool XPVHLPIsStrongSupport(int bar_index)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
if (!XPVHLPIsValidArraySize(bar_index + 3))
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
result =
|
||||
//
|
||||
pvHLLBuffer[bar_index + 1] == pvHLLBuffer[bar_index + 2] &&
|
||||
pvHLLBuffer[bar_index + 2] == pvHLLBuffer[bar_index + 3] &&
|
||||
//
|
||||
pvLLLBuffer[bar_index + 1] == pvLLLBuffer[bar_index + 2] &&
|
||||
pvLLLBuffer[bar_index + 2] == pvLLLBuffer[bar_index + 3] &&
|
||||
//
|
||||
pvMLLBuffer[bar_index + 1] == pvMLLBuffer[bar_index + 2] &&
|
||||
pvMLLBuffer[bar_index + 2] == pvMLLBuffer[bar_index + 3] &&
|
||||
//
|
||||
pvSLLBuffer[bar_index + 1] == pvSLLBuffer[bar_index + 2] &&
|
||||
pvSLLBuffer[bar_index + 2] == pvSLLBuffer[bar_index + 3]
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Is Strong Resistance ...
|
||||
bool XPVHLPIsStrongResistance(int bar_index)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
if (!XPVHLPIsValidArraySize(bar_index + 2))
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
result =
|
||||
//
|
||||
pvHHHBuffer[bar_index + 1] == pvHHHBuffer[bar_index + 2] &&
|
||||
pvHHHBuffer[bar_index + 2] == pvHHHBuffer[bar_index + 3] &&
|
||||
//
|
||||
pvLHHBuffer[bar_index + 1] == pvLHHBuffer[bar_index + 2] &&
|
||||
pvLHHBuffer[bar_index + 2] == pvLHHBuffer[bar_index + 3] &&
|
||||
//
|
||||
pvMHHBuffer[bar_index + 1] == pvMHHBuffer[bar_index + 2] &&
|
||||
pvMHHBuffer[bar_index + 2] == pvMHHBuffer[bar_index + 3] &&
|
||||
//
|
||||
pvSHHBuffer[bar_index + 1] == pvSHHBuffer[bar_index + 2] &&
|
||||
pvSHHBuffer[bar_index + 2] == pvSHHBuffer[bar_index + 3]
|
||||
//
|
||||
;
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Retrieve Highs ...
|
||||
double XPVHLPGetMaxHH(int bar_index)
|
||||
{
|
||||
//
|
||||
double result = 0;
|
||||
|
||||
//
|
||||
if (!XPVHLPIsValidArraySize(bar_index))
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
result = MathMax(pvSHHBuffer[bar_index], pvMHHBuffer[bar_index]);
|
||||
result = MathMax(result, pvLHHBuffer[bar_index]);
|
||||
result = MathMax(result, pvHHHBuffer[bar_index]);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
double XPVHLPGetMinHH(int bar_index)
|
||||
{
|
||||
//
|
||||
double result = 0;
|
||||
|
||||
//
|
||||
if (!XPVHLPIsValidArraySize(bar_index))
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
result = MathMin(pvSHHBuffer[bar_index], pvMHHBuffer[bar_index]);
|
||||
result = MathMin(result, pvLHHBuffer[bar_index]);
|
||||
result = MathMin(result, pvHHHBuffer[bar_index]);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Retrieve Lows ...
|
||||
double XPVHLPGetMaxLL(int bar_index)
|
||||
{
|
||||
//
|
||||
double result = 0;
|
||||
|
||||
//
|
||||
if (!XPVHLPIsValidArraySize(bar_index))
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
result = MathMax(pvSLLBuffer[bar_index], pvMLLBuffer[bar_index]);
|
||||
result = MathMax(result, pvLLLBuffer[bar_index]);
|
||||
result = MathMax(result, pvHLLBuffer[bar_index]);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
double XPVHLPGetMinLL(int bar_index)
|
||||
{
|
||||
//
|
||||
double result = 0;
|
||||
|
||||
//
|
||||
if (!XPVHLPIsValidArraySize(bar_index))
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
result = MathMin(pvSLLBuffer[bar_index], pvMLLBuffer[bar_index]);
|
||||
result = MathMin(result, pvLLLBuffer[bar_index]);
|
||||
result = MathMin(result, pvHLLBuffer[bar_index]);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
bool XPVHLPIsValidArraySize(int bar_index)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
if (bar_index < 0)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
int rCount = ArraySize(pvRBuffer);
|
||||
result = rCount > bar_index + 1;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// SUPPORT and RESISTANCE ...
|
||||
|
||||
//
|
||||
// Find Pivot Areas in PV ...
|
||||
void XPVHLPFindPivotPoints()
|
||||
{
|
||||
//
|
||||
double smoothingPoint = 3;
|
||||
int verifications = 26;
|
||||
|
||||
//
|
||||
// FLATS ...
|
||||
double tmpFlats[];
|
||||
int tmpFlatsCount = 0;
|
||||
|
||||
//
|
||||
// PEAKS and VALES ...
|
||||
|
||||
//
|
||||
// R ...
|
||||
FindSameValueInBuffer(
|
||||
tmpFlats,
|
||||
pvRBuffer);
|
||||
tmpFlatsCount = ArraySize(tmpFlats);
|
||||
if (tmpFlatsCount > 0)
|
||||
{
|
||||
//
|
||||
AddsIfNotExists(
|
||||
tmpFlats,
|
||||
pvPivots,
|
||||
smoothingPoint);
|
||||
|
||||
//
|
||||
Clean(tmpFlats);
|
||||
}
|
||||
|
||||
//
|
||||
// S ...
|
||||
FindSameValueInBuffer(
|
||||
tmpFlats,
|
||||
pvSBuffer);
|
||||
tmpFlatsCount = ArraySize(tmpFlats);
|
||||
if (tmpFlatsCount > 0)
|
||||
{
|
||||
//
|
||||
AddsIfNotExists(
|
||||
tmpFlats,
|
||||
pvPivots,
|
||||
smoothingPoint);
|
||||
|
||||
//
|
||||
Clean(tmpFlats);
|
||||
}
|
||||
|
||||
//
|
||||
// CYCLES ...
|
||||
|
||||
//
|
||||
// SHORT ...
|
||||
// LEVEL 1 ...
|
||||
|
||||
//
|
||||
// HH ...
|
||||
FindSameValueInBuffer(
|
||||
tmpFlats,
|
||||
pvSHHBuffer);
|
||||
tmpFlatsCount = ArraySize(tmpFlats);
|
||||
if (tmpFlatsCount > 0)
|
||||
{
|
||||
//
|
||||
AddsIfNotExists(
|
||||
tmpFlats,
|
||||
pvPivots,
|
||||
smoothingPoint);
|
||||
|
||||
//
|
||||
Clean(tmpFlats);
|
||||
}
|
||||
|
||||
//
|
||||
// LL ...
|
||||
FindSameValueInBuffer(
|
||||
tmpFlats,
|
||||
pvSLLBuffer);
|
||||
tmpFlatsCount = ArraySize(tmpFlats);
|
||||
if (tmpFlatsCount > 0)
|
||||
{
|
||||
//
|
||||
AddsIfNotExists(
|
||||
tmpFlats,
|
||||
pvPivots,
|
||||
smoothingPoint);
|
||||
|
||||
//
|
||||
Clean(tmpFlats);
|
||||
}
|
||||
|
||||
//
|
||||
// MEDIUM ...
|
||||
// LEVEL 2 ...
|
||||
|
||||
//
|
||||
// HH ...
|
||||
FindSameValueInBuffer(
|
||||
tmpFlats,
|
||||
pvMHHBuffer);
|
||||
tmpFlatsCount = ArraySize(tmpFlats);
|
||||
if (tmpFlatsCount > 0)
|
||||
{
|
||||
//
|
||||
AddsIfNotExists(
|
||||
tmpFlats,
|
||||
pvPivots,
|
||||
smoothingPoint);
|
||||
|
||||
//
|
||||
Clean(tmpFlats);
|
||||
}
|
||||
|
||||
//
|
||||
// LL ...
|
||||
FindSameValueInBuffer(
|
||||
tmpFlats,
|
||||
pvMLLBuffer);
|
||||
tmpFlatsCount = ArraySize(tmpFlats);
|
||||
if (tmpFlatsCount > 0)
|
||||
{
|
||||
//
|
||||
AddsIfNotExists(
|
||||
tmpFlats,
|
||||
pvPivots,
|
||||
smoothingPoint);
|
||||
|
||||
//
|
||||
Clean(tmpFlats);
|
||||
}
|
||||
|
||||
//
|
||||
// LONG ...
|
||||
// LEVEL 3 ...
|
||||
|
||||
//
|
||||
// HH ...
|
||||
FindSameValueInBuffer(
|
||||
tmpFlats,
|
||||
pvLHHBuffer);
|
||||
tmpFlatsCount = ArraySize(tmpFlats);
|
||||
if (tmpFlatsCount > 0)
|
||||
{
|
||||
//
|
||||
AddsIfNotExists(
|
||||
tmpFlats,
|
||||
pvPivots,
|
||||
smoothingPoint);
|
||||
|
||||
//
|
||||
Clean(tmpFlats);
|
||||
}
|
||||
|
||||
//
|
||||
// LL ...
|
||||
FindSameValueInBuffer(
|
||||
tmpFlats,
|
||||
pvLLLBuffer);
|
||||
tmpFlatsCount = ArraySize(tmpFlats);
|
||||
if (tmpFlatsCount > 0)
|
||||
{
|
||||
//
|
||||
AddsIfNotExists(
|
||||
tmpFlats,
|
||||
pvPivots,
|
||||
smoothingPoint);
|
||||
|
||||
//
|
||||
Clean(tmpFlats);
|
||||
}
|
||||
|
||||
//
|
||||
// HINDMOST ...
|
||||
// LEVEL 4 ...
|
||||
|
||||
//
|
||||
// HH ...
|
||||
FindSameValueInBuffer(
|
||||
tmpFlats,
|
||||
pvHHHBuffer);
|
||||
tmpFlatsCount = ArraySize(tmpFlats);
|
||||
if (tmpFlatsCount > 0)
|
||||
{
|
||||
//
|
||||
AddsIfNotExists(
|
||||
tmpFlats,
|
||||
pvPivots,
|
||||
smoothingPoint);
|
||||
|
||||
//
|
||||
Clean(tmpFlats);
|
||||
}
|
||||
|
||||
//
|
||||
// LL ...
|
||||
FindSameValueInBuffer(
|
||||
tmpFlats,
|
||||
pvHLLBuffer);
|
||||
tmpFlatsCount = ArraySize(tmpFlats);
|
||||
if (tmpFlatsCount > 0)
|
||||
{
|
||||
//
|
||||
AddsIfNotExists(
|
||||
tmpFlats,
|
||||
pvPivots,
|
||||
smoothingPoint);
|
||||
|
||||
//
|
||||
Clean(tmpFlats);
|
||||
}
|
||||
|
||||
//
|
||||
// PEAKS and VALES ...
|
||||
|
||||
//
|
||||
// PEAKS ...
|
||||
FindSameValueInBuffer(
|
||||
tmpFlats,
|
||||
pvPBuffer);
|
||||
tmpFlatsCount = ArraySize(tmpFlats);
|
||||
if (tmpFlatsCount > 0)
|
||||
{
|
||||
//
|
||||
AddsIfNotExists(
|
||||
tmpFlats,
|
||||
pvPivots,
|
||||
smoothingPoint);
|
||||
|
||||
//
|
||||
Clean(tmpFlats);
|
||||
}
|
||||
|
||||
//
|
||||
// VALES ...
|
||||
FindSameValueInBuffer(
|
||||
tmpFlats,
|
||||
pvVBuffer);
|
||||
tmpFlatsCount = ArraySize(tmpFlats);
|
||||
if (tmpFlatsCount > 0)
|
||||
{
|
||||
//
|
||||
AddsIfNotExists(
|
||||
tmpFlats,
|
||||
pvPivots,
|
||||
smoothingPoint);
|
||||
|
||||
//
|
||||
Clean(tmpFlats);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Extract Support and Resistances ...
|
||||
XOHCLSupRes XPVHLPFindCandleSupprtAndResistance(
|
||||
int bar_index, // Bar Index ...
|
||||
int count = 3 // Number of Requireds ...
|
||||
)
|
||||
{
|
||||
//
|
||||
XOHCLSupRes result = ExtractSupportAndResistance(
|
||||
bar_index,
|
||||
pvPivots,
|
||||
count,
|
||||
_Symbol,
|
||||
_Period);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// END Helper Functions ...
|
||||
//
|
||||
+1383
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user