This commit is contained in:
2025-01-21 05:46:01 +03:30
parent 6363320cc2
commit 560a54af30
16 changed files with 7623 additions and 859 deletions
-64
View File
@@ -199,10 +199,6 @@ struct X121Conditions
double donCloseUpperBuffer[];
double donCloseLowerBuffer[];
//
bool bullishTrendBuffer[];
bool bearishTrendBuffer[];
//
double rsiSlope;
double strSlope;
@@ -497,14 +493,6 @@ struct X121Conditions
bool isStrLowerCrossedOverDonLowLower;
bool isStrLowerCrossedUnderDonLowLower;
//
bool isTrendBullish;
bool isTrendBearish;
//
bool isTrendSwirchedToBullish;
bool isTrendSwirchedToBearish;
//
bool isAtrUpperOverPeak;
bool isAtrUpperEqualsToPeak;
@@ -592,10 +580,6 @@ struct X121Conditions
Clean(donCloseUpperBuffer);
Clean(donCloseLowerBuffer);
//
Clean(bullishTrendBuffer);
Clean(bearishTrendBuffer);
//
ArraySetAsSeries(rsiBuffer, true);
ArraySetAsSeries(atrBuffer, true);
@@ -647,10 +631,6 @@ struct X121Conditions
ArraySetAsSeries(donCloseUpperBuffer, true);
ArraySetAsSeries(donCloseLowerBuffer, true);
//
ArraySetAsSeries(bullishTrendBuffer, true);
ArraySetAsSeries(bearishTrendBuffer, true);
//
cheMin = 0;
cheMax = 0;
@@ -1014,14 +994,6 @@ struct X121Conditions
//
isStrLowerCrossedOverDonLowLower = false;
isStrLowerCrossedUnderDonLowLower = false;
//
isTrendBullish = false;
isTrendBearish = false;
//
isTrendSwirchedToBullish = false;
isTrendSwirchedToBearish = false;
}
/**
@@ -1231,10 +1203,6 @@ struct X121Conditions
"-----------------------" + separator +
"Coplex ..." + separator +
"-----------------------" + separator +
ToString("isTrendBullish", isTrendBullish, ignoreFalseConditions, separator) +
ToString("isTrendBearish", isTrendBearish, ignoreFalseConditions, separator) +
ToString("isTrendSwirchedToBullish", isTrendSwirchedToBullish, ignoreFalseConditions, separator) +
ToString("isTrendSwirchedToBearish", isTrendSwirchedToBearish, ignoreFalseConditions, separator) +
ToString("isSarIncreased", isSarIncreased, ignoreFalseConditions, separator) +
ToString("isSarDecreased", isSarDecreased, ignoreFalseConditions, separator) +
ToString("isSarEqualsToPeak", isSarEqualsToPeak, ignoreFalseConditions, separator) +
@@ -1944,18 +1912,6 @@ class XCX121Helper : public XCBase
conditions.hLLBuffer //
);
//
Copy(
xpvConditions.bullishTrendBuffer,
conditions.bullishTrendBuffer //
);
//
Copy(
xpvConditions.bearishTrendBuffer,
conditions.bearishTrendBuffer //
);
//
// Conditions ...
@@ -2368,20 +2324,6 @@ class XCX121Helper : public XCBase
//
// Complex Conditions ...
//
bool isTrendBullish = conditions.bullishTrendBuffer[0];
bool isTrendBullishPrev = conditions.bullishTrendBuffer[1];
//
bool isTrendBearish = conditions.bearishTrendBuffer[0];
bool isTrendBearishPrev = conditions.bearishTrendBuffer[1];
//
bool isTrendSwirchedToBullish = isTrendBullish &&
!isTrendBullishPrev;
bool isTrendSwirchedToBearish = isTrendBearish &&
!isTrendBearishPrev;
//
double vwapFast = conditions.vwapFastBuffer[cIDX];
double vwapMid = conditions.vwapMidBuffer[cIDX];
@@ -2801,12 +2743,6 @@ class XCX121Helper : public XCBase
conditions.vwapMin = vwapMin;
conditions.vwapMax = vwapMax;
//
conditions.isTrendBullish = isTrendBullish;
conditions.isTrendBearish = isTrendBearish;
conditions.isTrendSwirchedToBullish = isTrendSwirchedToBullish;
conditions.isTrendSwirchedToBearish = isTrendSwirchedToBearish;
//
conditions.isSarIncreased = isSarIncreased;
conditions.isSarDecreased = isSarDecreased;
+2 -388
View File
@@ -270,10 +270,6 @@ struct X121XPVConditions
double hHHBuffer[];
double hLLBuffer[];
//
bool bullishTrendBuffer[];
bool bearishTrendBuffer[];
//
// Conditions ...
@@ -345,8 +341,8 @@ struct X121XPVConditions
Clean(hLLBuffer);
//
Clean(bullishTrendBuffer);
Clean(bearishTrendBuffer);
// Clean(bullishTrendBuffer);
// Clean(bearishTrendBuffer);
//
ArraySetAsSeries(peaksBuffer, true);
@@ -363,10 +359,6 @@ struct X121XPVConditions
ArraySetAsSeries(hHHBuffer, true);
ArraySetAsSeries(hLLBuffer, true);
//
ArraySetAsSeries(bullishTrendBuffer, true);
ArraySetAsSeries(bearishTrendBuffer, true);
//
// Conditions ...
@@ -1612,107 +1604,6 @@ class XCX121XPVHelper : public XCBaseHelper
);
}
//
// Trends ...
// //
// bool GetBullishTrend(
// int barIndex // Bar Index
// )
// {
// //
// if (barIndex < 0)
// {
// barIndex = 0;
// }
// //
// Calculate();
// //
// int count = ArraySize(bullishTrendBuffer);
// if (barIndex >= count)
// {
// barIndex = count - 1;
// }
// //
// return bullishTrendBuffer[barIndex];
// }
// //
// int CopyBullishTrend(
// int start, // Start
// int count, // Number of Items for read
// bool &buffer[], // Dest Buffer
// bool forceClean = true // Force To Clean buffer
// )
// {
// //
// // Update Calculations ...
// Calculate();
// //
// // Copy Items ...
// return Copy(
// start,
// count,
// bullishTrendBuffer,
// buffer,
// forceClean
// //
// );
// }
// //
// bool GetBearishTrend(
// int barIndex // Bar Index
// )
// {
// //
// if (barIndex < 0)
// {
// barIndex = 0;
// }
// //
// Calculate();
// //
// int count = ArraySize(bearishTrendBuffer);
// if (barIndex >= count)
// {
// barIndex = count - 1;
// }
// //
// return bearishTrendBuffer[barIndex];
// }
// //
// int CopyBearishTrend(
// int start, // Start
// int count, // Number of Items for read
// bool &buffer[], // Dest Buffer
// bool forceClean = true // Force To Clean buffer
// )
// {
// //
// // Update Calculations ...
// Calculate();
// //
// // Copy Items ...
// return Copy(
// start,
// count,
// bearishTrendBuffer,
// buffer,
// forceClean
// //
// );
// }
//
// Tools Function ...
@@ -1936,191 +1827,6 @@ class XCX121XPVHelper : public XCBaseHelper
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 = GetPeak(hpIndex);
}
//
if (lastLV == 0)
{
//
lastLV = GetVale(lvIndex);
}
//
int highestPeakIndex = -1;
double highesrPeak =
GetHigherPeak(
highestPeakIndex,
lastHP,
hpIndex //
);
if (IsValidIndex(highestPeakIndex))
{
//
Add(
highestPeakIndex,
hpIndexes //
);
//
Add(
highesrPeak,
hpValues //
);
}
//
int lowestValeIndex = -1;
double lowestVale =
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;
}
//
bool GetConditions(
X121XPVConditions &conditions, //
@@ -2281,48 +1987,6 @@ class XCX121XPVHelper : public XCBaseHelper
conditions.hLLBuffer //
);
// //
// CopyBullishTrend(
// zIndex,
// loopback,
// conditions.bullishTrendBuffer //
// );
// //
// CopyBearishTrend(
// zIndex,
// loopback,
// conditions.bearishTrendBuffer //
// );
//
for (int i = barIndex + 1; i < barIndex + 3; i++)
{
//
ENUM_X_DIRECTION iDirection;
bool iHasDirection = DetectMarketStructure(iDirection);
//
bool iHasBullishTrend = iHasDirection &&
IsBullish(iDirection);
//
bool iHasBearishTrend = iHasDirection &&
IsBearish(iDirection);
//
Add(
iHasBullishTrend,
conditions.bullishTrendBuffer //
);
//
Add(
iHasBearishTrend,
conditions.bearishTrendBuffer //
);
}
//
// Conditions ...
@@ -2400,11 +2064,6 @@ class XCX121XPVHelper : public XCBaseHelper
conditions.isRejectedPrevVale = isRejectedPrevVale;
conditions.isBreakedDownPrevVale = isBreakedDownPrevVale;
// //
// if (isNewVale || isNewPeak) {
// CalculateTrend();
// }
//
return result;
}
@@ -2435,29 +2094,6 @@ class XCX121XPVHelper : public XCBaseHelper
double hHHBuffer[];
double hLLBuffer[];
//
// bool bullishTrendBuffer[];
// bool bearishTrendBuffer[];
//
// void AddTrend(
// bool isBullish,
// bool isBearish //
// )
// {
// //
// Add(
// isBullish,
// bullishTrendBuffer //
// );
// //
// Add(
// isBearish,
// bearishTrendBuffer //
// );
// }
//
void Calculate()
{
@@ -2632,28 +2268,6 @@ class XCX121XPVHelper : public XCBaseHelper
//
);
}
//
// void CalculateTrend()
// {
// //
// ENUM_X_DIRECTION iDirection;
// bool iHasDirection = DetectMarketStructure(iDirection);
// //
// bool iHasBullishTrend = iHasDirection &&
// IsBullish(iDirection);
// //
// bool iHasBearishTrend = iHasDirection &&
// IsBearish(iDirection);
// //
// AddTrend(
// iHasBullishTrend,
// iHasBearishTrend //
// );
// }
};
//