add xche to supports list ...
This commit is contained in:
@@ -128,7 +128,8 @@ class XC121SMCCycleHelper : public XCBase
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
if (requiredPOIS < 10) {
|
||||
if (requiredPOIS < 10)
|
||||
{
|
||||
requiredPOIS = 10;
|
||||
}
|
||||
|
||||
@@ -882,6 +883,199 @@ class XC121SMCCycleHelper : public XCBase
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Detect Market Structure Method 2 ...
|
||||
*
|
||||
* @param model: XMarketStructure instance Reference ...
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool DetectMarketStructure(
|
||||
ENUM_X_DIRECTION &dir,
|
||||
int pivotsCount = 3 //
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
int barIndex = 0;
|
||||
|
||||
//
|
||||
if (pivotsCount < 3)
|
||||
{
|
||||
pivotsCount = 3;
|
||||
}
|
||||
|
||||
//
|
||||
dir = X_DIRECTION_NONE;
|
||||
string symbol = GetSymbol();
|
||||
ENUM_TIMEFRAMES period = GetPeriod();
|
||||
|
||||
//
|
||||
int hpIndex = -1;
|
||||
int hpIndexes[];
|
||||
double hpValues[];
|
||||
|
||||
//
|
||||
int lvIndex = -1;
|
||||
int lvIndexes[];
|
||||
double lvValues[];
|
||||
|
||||
//
|
||||
for (int i = 0; i < pivotsCount; i++)
|
||||
{
|
||||
//
|
||||
hpIndex = barIndex;
|
||||
lvIndex = barIndex;
|
||||
|
||||
//
|
||||
double lastHP = 0;
|
||||
double lastLV = 0;
|
||||
|
||||
//
|
||||
int hpCount = ArraySize(hpIndexes);
|
||||
int lvCount = ArraySize(lvIndexes);
|
||||
|
||||
//
|
||||
if (IsValidSize(hpCount))
|
||||
{
|
||||
//
|
||||
lastHP = hpValues[hpCount - 1];
|
||||
hpIndex = hpIndexes[hpCount - 1];
|
||||
}
|
||||
|
||||
//
|
||||
if (IsValidSize(lvCount))
|
||||
{
|
||||
//
|
||||
lastLV = lvValues[lvCount - 1];
|
||||
lvIndex = lvIndexes[lvCount - 1];
|
||||
}
|
||||
|
||||
//
|
||||
if (lastHP == 0)
|
||||
{
|
||||
//
|
||||
lastHP = mX121Helper
|
||||
.xpvHelper
|
||||
.GetPeak(hpIndex);
|
||||
}
|
||||
|
||||
//
|
||||
if (lastLV == 0)
|
||||
{
|
||||
//
|
||||
lastLV = mX121Helper
|
||||
.xpvHelper
|
||||
.GetVale(lvIndex);
|
||||
}
|
||||
|
||||
//
|
||||
int highestPeakIndex = -1;
|
||||
double highesrPeak =
|
||||
mX121Helper
|
||||
.xpvHelper
|
||||
.GetHigherPeak(
|
||||
highestPeakIndex,
|
||||
lastHP,
|
||||
hpIndex //
|
||||
);
|
||||
if (IsValidIndex(highestPeakIndex))
|
||||
{
|
||||
//
|
||||
Add(
|
||||
highestPeakIndex,
|
||||
hpIndexes //
|
||||
);
|
||||
|
||||
//
|
||||
Add(
|
||||
highesrPeak,
|
||||
hpValues //
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
int lowestValeIndex = -1;
|
||||
double lowestVale =
|
||||
mX121Helper
|
||||
.xpvHelper
|
||||
.GetLowerVale(
|
||||
lowestValeIndex,
|
||||
lastLV,
|
||||
lvIndex //
|
||||
);
|
||||
if (IsValidIndex(lowestValeIndex))
|
||||
{
|
||||
//
|
||||
Add(
|
||||
lowestValeIndex,
|
||||
lvIndexes //
|
||||
);
|
||||
|
||||
//
|
||||
Add(
|
||||
lowestVale,
|
||||
lvValues //
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
bool canBreak = ArraySize(hpIndexes) >= pivotsCount ||
|
||||
ArraySize(lvIndexes) >= pivotsCount;
|
||||
if (canBreak)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
ArrayReverse(hpValues);
|
||||
ArrayReverse(hpIndexes);
|
||||
int countHPs = ArraySize(hpIndexes);
|
||||
|
||||
//
|
||||
ArrayReverse(lvValues);
|
||||
ArrayReverse(lvIndexes);
|
||||
int countLVs = ArraySize(lvIndexes);
|
||||
|
||||
//
|
||||
bool isValidHPs = countHPs >= pivotsCount;
|
||||
bool isValidLVs = countLVs >= pivotsCount;
|
||||
|
||||
//
|
||||
result = isValidHPs ||
|
||||
isValidLVs;
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
if (isValidHPs && isValidLVs)
|
||||
{
|
||||
//
|
||||
hpIndex = hpIndexes[countHPs - 1];
|
||||
lvIndex = lvIndexes[countLVs - 1];
|
||||
}
|
||||
|
||||
//
|
||||
dir =
|
||||
!isValidHPs && isValidLVs
|
||||
? X_DIRECTION_BULLISH
|
||||
: !isValidLVs && isValidHPs
|
||||
? X_DIRECTION_BEARISH
|
||||
: hpIndex < lvIndex
|
||||
? X_DIRECTION_BEARISH
|
||||
: lvIndex < hpIndex
|
||||
? X_DIRECTION_BULLISH
|
||||
: X_DIRECTION_ALL;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Tools ...
|
||||
|
||||
|
||||
Reference in New Issue
Block a user