add support for PV Pivot Detection in One Function ...

This commit is contained in:
2025-05-04 10:52:14 +03:30
parent 637deda2c1
commit cf3846bee9
4 changed files with 1386 additions and 623 deletions
+638
View File
@@ -447,3 +447,641 @@
// conditions.swingHighBuffer[cIDX] > conditions.fiboLevel1Buffer[cIDX]
// //
;
///////////////////////////////////////////////////////////////////////////////////
//
// bool DetectPeakPivot(
// int barIndex,
// XOHCL &zBar,
// XOHCL &cBar,
// XOHCL &pBar,
// XOHCL &p2Bar,
// XCAEAConditions &conditions //
// )
// {
// //
// bool result = false;
// //
// // Validate Args ...
// result =
// //
// barIndex >= 0 &&
// zBar.IsValid() &&
// cBar.IsValid() &&
// pBar.IsValid() &&
// p2Bar.IsValid() &&
// detectPeakPivots
// //
// ;
// if (!result)
// {
// return result;
// }
// //
// // Define Requirements ...
// //
// int zIDX = 0;
// int cIDX = zIDX + 1;
// int pIDX = cIDX + 1;
// int p2IDX = pIDX + 1;
// //
// datetime cTime = zBar.time;
// string symbol = zBar.symbol;
// ENUM_TIMEFRAMES period = zBar.period;
// double points = GetPoints(symbol);
// //
// // Reading Conditional Values ...
// //
// // PEAK ...
// double zPeak = conditions.peakBuffer[zIDX];
// double cPeak = conditions.peakBuffer[cIDX];
// double pPeak = conditions.peakBuffer[pIDX];
// double p2Peak = conditions.peakBuffer[p2IDX];
// //
// // PEAK Golden ...
// double zPeakGolden = conditions.peakGoldenBuffer[zIDX];
// double cPeakGolden = conditions.peakGoldenBuffer[cIDX];
// double pPeakGolden = conditions.peakGoldenBuffer[pIDX];
// double p2PeakGolden = conditions.peakGoldenBuffer[p2IDX];
// //
// // VALE ...
// double zVale = conditions.valeBuffer[zIDX];
// double cVale = conditions.valeBuffer[cIDX];
// double pVale = conditions.valeBuffer[pIDX];
// double p2Vale = conditions.valeBuffer[p2IDX];
// //
// // VALE Golden ...
// double zValeGolden = conditions.valeGoldenBuffer[zIDX];
// double cValeGolden = conditions.valeGoldenBuffer[cIDX];
// double pValeGolden = conditions.valeGoldenBuffer[pIDX];
// double p2ValeGolden = conditions.valeGoldenBuffer[p2IDX];
// //
// // SWING High ..
// double zSwingHigh = conditions.swingHighBuffer[zIDX];
// double cSwingHigh = conditions.swingHighBuffer[cIDX];
// double pSwingHigh = conditions.swingHighBuffer[pIDX];
// double p2SwingHigh = conditions.swingHighBuffer[p2IDX];
// //
// // SWING Low ...
// double zSwingLow = conditions.swingLowBuffer[zIDX];
// double cSwingLow = conditions.swingLowBuffer[cIDX];
// double pSwingLow = conditions.swingLowBuffer[pIDX];
// double p2SwingLow = conditions.swingLowBuffer[p2IDX];
// //
// // SUPPORT ...
// double zSupport = conditions.supportBuffer[zIDX];
// double cSupport = conditions.supportBuffer[cIDX];
// double pSupport = conditions.supportBuffer[pIDX];
// double p2Support = conditions.supportBuffer[p2IDX];
// //
// // RESISTANCE ...
// double zResistance = conditions.resistanceBuffer[zIDX];
// double cResistance = conditions.resistanceBuffer[cIDX];
// double pResistance = conditions.resistanceBuffer[pIDX];
// double p2Resistance = conditions.resistanceBuffer[p2IDX];
// //
// // Detecting Bar Conditions ...
// //
// ENUM_X_DIRECTION cBarDir;
// //
// // Rejected ...
// bool isCBarRejected = helper
// .barAnalyser
// .IsRejected(
// cBar,
// cBarDir,
// false, // Force Type ...
// true // Force Fibo Pressure ...
// );
// bool isCBarBullishRejected =
// isCBarRejected &&
// IsBullish(cBarDir);
// bool isCBarBearishRejected =
// isCBarRejected &&
// IsBearish(cBarDir);
// //
// // Engulfed ...
// bool isCBarEngulfed = helper
// .barAnalyser
// .IsEngulfed(
// cBar,
// cBarDir //
// );
// bool isCBarBullishEngulfed =
// isCBarEngulfed &&
// IsBullish(cBarDir);
// bool isCBarBearishEngulfed =
// isCBarEngulfed &&
// IsBearish(cBarDir);
// //
// // Prepare Conditinal Conditions ...
// //
// bool isPeakSameLast = cPeak == pPeak;
// bool isPeakSameLastPrev = pPeak == p2Peak;
// //
// if (applySwingsOnPVPivots)
// {
// //
// isPeakSameLast =
// isPeakSameLast &&
// cSwingHigh == cPeak &&
// cSwingHigh == pSwingHigh;
// //
// isPeakSameLastPrev =
// isPeakSameLastPrev &&
// pSwingHigh == pPeak &&
// pSwingHigh == p2SwingHigh;
// }
// //
// if (applySupportAndResistanceOnPVPivots)
// {
// //
// isPeakSameLast =
// isPeakSameLast &&
// cResistance == cPeak &&
// cResistance == pResistance;
// //
// isPeakSameLastPrev =
// isPeakSameLastPrev &&
// pResistance == pPeak &&
// pResistance == p2Resistance;
// }
// //
// bool isPeakSwitchedToSameLast = isPeakSameLast &&
// !isPeakSameLastPrev;
// bool isPeakFinishedFromSameLast = !isPeakSameLast &&
// isPeakSameLastPrev;
// //
// // ZERO ...
// // Default Peak and Vale Selection ...
// bool isTypeZeroStart = isPeakFinishedFromSameLast;
// bool isTypeZeroContinue = isPeakSameLast;
// bool isTypeZeroFinished = isPeakSwitchedToSameLast;
// if (isTypeZeroFinished)
// {
// //
// bool hasSelectionType = selectRejectedPVPivots ||
// selectEngulfedPVPivots;
// //
// bool isPVRejected =
// isCBarBearishRejected &&
// selectRejectedPVPivots;
// //
// bool isPVEngulfed =
// isCBarBearishEngulfed &&
// selectEngulfedPVPivots;
// //
// bool isBarPassed =
// !hasSelectionType
// ? true
// : isPVRejected ||
// isPVEngulfed;
// //
// isTypeZeroFinished =
// isBarPassed &&
// isTypeZeroFinished;
// if (!isTypeZeroFinished)
// {
// peakPivot.Clean();
// }
// }
// //
// // Summarizing Conditions ...
// //
// result = false;
// //
// bool hasStartCondition =
// //
// isTypeZeroStart
// //
// ;
// bool hasContinuationCondition =
// //
// isTypeZeroContinue
// //
// ;
// bool hasEndCondition =
// //
// isTypeZeroFinished
// //
// ;
// //
// // ReInstance Pivot ...
// if (hasStartCondition)
// {
// //
// peakPivot.Clean();
// //
// peakPivot.type = XCA_PEAK;
// peakPivot.symbol = symbol;
// peakPivot.period = period;
// //
// peakPivot.to = pBar.time;
// peakPivot.from = pBar.time;
// peakPivot.value = pPeak;
// peakPivot.reserve = pPeakGolden;
// }
// //
// // Calculate and Fill Pivot Requirements ...
// if (hasContinuationCondition)
// {
// //
// peakPivot.from = pBar.time;
// //
// peakPivot.reserve =
// peakPivot.reserve == 0
// ? pPeakGolden
// : MathMax(peakPivot.reserve, pPeakGolden);
// }
// //
// // End up Pivot and Store it ...
// if (hasEndCondition)
// {
// //
// result =
// peakPivot.IsValid() &&
// peakPivot.GetAge() >= pivotVerifications;
// if (result)
// {
// //
// XBoxZone iBox;
// result = peakPivot.AsBox(iBox);
// if (result)
// {
// //
// newPeakPivotDetected = AddBox(
// iBox,
// peakPivots //
// );
// }
// //
// iBox.Clean();
// }
// //
// peakPivot.Clean();
// }
// //
// return result;
// }
// //
// bool DetectValePivot(
// int barIndex,
// XOHCL &zBar,
// XOHCL &cBar,
// XOHCL &pBar,
// XOHCL &p2Bar,
// XCAEAConditions &conditions //
// )
// {
// //
// bool result = false;
// //
// // Validate Args ...
// result =
// //
// barIndex >= 0 &&
// zBar.IsValid() &&
// cBar.IsValid() &&
// pBar.IsValid() &&
// p2Bar.IsValid() &&
// detectValePivots
// //
// ;
// if (!result)
// {
// return result;
// }
// //
// // Define Requirements ...
// //
// int zIDX = 0;
// int cIDX = zIDX + 1;
// int pIDX = cIDX + 1;
// int p2IDX = pIDX + 1;
// //
// datetime cTime = zBar.time;
// string symbol = zBar.symbol;
// ENUM_TIMEFRAMES period = zBar.period;
// double points = GetPoints(symbol);
// //
// // Reading Conditional Values ...
// //
// // PEAK ...
// double zPeak = conditions.peakBuffer[zIDX];
// double cPeak = conditions.peakBuffer[cIDX];
// double pPeak = conditions.peakBuffer[pIDX];
// double p2Peak = conditions.peakBuffer[p2IDX];
// //
// // PEAK Golden ...
// double zPeakGolden = conditions.peakGoldenBuffer[zIDX];
// double cPeakGolden = conditions.peakGoldenBuffer[cIDX];
// double pPeakGolden = conditions.peakGoldenBuffer[pIDX];
// double p2PeakGolden = conditions.peakGoldenBuffer[p2IDX];
// //
// // VALE ...
// double zVale = conditions.valeBuffer[zIDX];
// double cVale = conditions.valeBuffer[cIDX];
// double pVale = conditions.valeBuffer[pIDX];
// double p2Vale = conditions.valeBuffer[p2IDX];
// //
// // VALE Golden ...
// double zValeGolden = conditions.valeGoldenBuffer[zIDX];
// double cValeGolden = conditions.valeGoldenBuffer[cIDX];
// double pValeGolden = conditions.valeGoldenBuffer[pIDX];
// double p2ValeGolden = conditions.valeGoldenBuffer[p2IDX];
// //
// // SWING High ..
// double zSwingHigh = conditions.swingHighBuffer[zIDX];
// double cSwingHigh = conditions.swingHighBuffer[cIDX];
// double pSwingHigh = conditions.swingHighBuffer[pIDX];
// double p2SwingHigh = conditions.swingHighBuffer[p2IDX];
// //
// // SWING Low ...
// double zSwingLow = conditions.swingLowBuffer[zIDX];
// double cSwingLow = conditions.swingLowBuffer[cIDX];
// double pSwingLow = conditions.swingLowBuffer[pIDX];
// double p2SwingLow = conditions.swingLowBuffer[p2IDX];
// //
// // SUPPORT ...
// double zSupport = conditions.supportBuffer[zIDX];
// double cSupport = conditions.supportBuffer[cIDX];
// double pSupport = conditions.supportBuffer[pIDX];
// double p2Support = conditions.supportBuffer[p2IDX];
// //
// // RESISTANCE ...
// double zResistance = conditions.resistanceBuffer[zIDX];
// double cResistance = conditions.resistanceBuffer[cIDX];
// double pResistance = conditions.resistanceBuffer[pIDX];
// double p2Resistance = conditions.resistanceBuffer[p2IDX];
// //
// // Detecting Bar Conditions ...
// //
// ENUM_X_DIRECTION cBarDir;
// //
// // Rejected ...
// bool isCBarRejected = helper
// .barAnalyser
// .IsRejected(
// cBar,
// cBarDir,
// false, // Force Type ...
// true // Force Fibo Pressure ...
// );
// bool isCBarBullishRejected =
// isCBarRejected &&
// IsBullish(cBarDir);
// bool isCBarBearishRejected =
// isCBarRejected &&
// IsBearish(cBarDir);
// //
// // Engulfed ...
// bool isCBarEngulfed = helper
// .barAnalyser
// .IsEngulfed(
// cBar,
// cBarDir //
// );
// bool isCBarBullishEngulfed =
// isCBarEngulfed &&
// IsBullish(cBarDir);
// bool isCBarBearishEngulfed =
// isCBarEngulfed &&
// IsBearish(cBarDir);
// //
// // Prepare Conditinal Conditions ...
// //
// bool isValeSameLast = cVale == pVale;
// bool isValeSameLastPrev = pVale == p2Vale;
// //
// if (applySwingsOnPVPivots)
// {
// //
// isValeSameLast =
// isValeSameLast &&
// cSwingLow == cVale &&
// cSwingLow == pSwingLow;
// //
// isValeSameLastPrev =
// isValeSameLastPrev &&
// pSwingLow == pVale &&
// pSwingLow == p2SwingLow;
// }
// //
// if (applySupportAndResistanceOnPVPivots)
// {
// //
// isValeSameLast =
// isValeSameLast &&
// cSupport == cVale &&
// cSupport == pSupport;
// //
// isValeSameLastPrev =
// isValeSameLastPrev &&
// pSupport == pVale &&
// pSupport == p2Support;
// }
// //
// bool isValeSwitchedToSameLast = isValeSameLast &&
// !isValeSameLastPrev;
// bool isValeFinishedFromSameLast = !isValeSameLast &&
// isValeSameLastPrev;
// //
// // ZERO ...
// // Default Peak and Vale Selection ...
// bool isTypeZeroStart = isValeFinishedFromSameLast;
// bool isTypeZeroContinue = isValeSameLast;
// bool isTypeZeroFinished = isValeSwitchedToSameLast;
// if (isTypeZeroFinished)
// {
// //
// bool hasSelectionType = selectRejectedPVPivots ||
// selectEngulfedPVPivots;
// //
// bool isPVRejected =
// isCBarBullishRejected &&
// selectRejectedPVPivots;
// //
// bool isPVEngulfed =
// isCBarBullishEngulfed &&
// selectEngulfedPVPivots;
// //
// bool isBarPassed =
// !hasSelectionType
// ? true
// : isPVRejected ||
// isPVEngulfed;
// //
// isTypeZeroFinished =
// isBarPassed &&
// isTypeZeroFinished;
// if (!isTypeZeroFinished)
// {
// valePivot.Clean();
// }
// }
// //
// // Summarizing Conditions ...
// //
// result = false;
// //
// bool hasStartCondition =
// //
// isTypeZeroStart
// //
// ;
// bool hasContinuationCondition =
// //
// isTypeZeroContinue
// //
// ;
// bool hasEndCondition =
// //
// isTypeZeroFinished
// //
// ;
// //
// // ReInstance Pivot ...
// if (hasStartCondition)
// {
// //
// valePivot.Clean();
// //
// valePivot.type = XCA_VALE;
// valePivot.symbol = symbol;
// valePivot.period = period;
// //
// valePivot.to = pBar.time;
// valePivot.from = pBar.time;
// valePivot.value = pVale;
// valePivot.reserve = pValeGolden;
// }
// //
// // Calculate and Fill Pivot Requirements ...
// if (hasContinuationCondition)
// {
// //
// valePivot.from = pBar.time;
// //
// valePivot.reserve =
// valePivot.reserve == 0
// ? pValeGolden
// : MathMin(valePivot.reserve, pValeGolden);
// }
// //
// // End up Pivot and Store it ...
// if (hasEndCondition)
// {
// //
// result =
// valePivot.IsValid() &&
// valePivot.GetAge() >= pivotVerifications;
// if (result)
// {
// //
// XBoxZone iBox;
// result = valePivot.AsBox(iBox);
// if (result)
// {
// //
// newPeakPivotDetected = AddBox(
// iBox,
// valePivots //
// );
// }
// //
// iBox.Clean();
// }
// //
// valePivot.Clean();
// }
// //
// return result;
// }
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -800,7 +800,7 @@ class XCXCAEAPOIDrawer : public XCBase
bool canUpdateTo = IsValid(to);
if (canUpdateTo)
{
// item.to = to;
item.to = to;
}
//
@@ -853,7 +853,7 @@ class XCXCAEAPOIDrawer : public XCBase
bool canUpdateTo = IsValid(to);
if (canUpdateTo)
{
// item.to = to;
item.to = to;
}
//
+34 -15
View File
@@ -207,12 +207,12 @@ class XCXCAEASignaller : XCBase
// drawer.Draw(cTime);
//
// drawer.DrawPeakPivots(cTime);
// drawer.DrawValePivots(cTime);
drawer.DrawPeakPivots(cTime);
drawer.DrawValePivots(cTime);
// drawer.DrawFVGBullishPivots(cTime);
// drawer.DrawFVGBearishPivots(cTime);
drawer.DrawTrendBullishPivots(cTime);
drawer.DrawTrendBearishPivots(cTime);
// drawer.DrawTrendBullishPivots(cTime);
// drawer.DrawTrendBearishPivots(cTime);
//
// Retrieve Valid Pviots ...
@@ -871,7 +871,8 @@ class XCXCAEASignaller : XCBase
detector = new XCXCAEAPOIDetector(helper);
//
detector.maxAllowedPivots = 50;
// Common Configurations ...
detector.maxAllowedPivots = 0;
detector.pivotVerifications = 5;
detector.ticksDividerInPoints = 15;
detector.pivotDetectionLoopbac = 200;
@@ -881,6 +882,9 @@ class XCXCAEASignaller : XCBase
//
// PV ...
//
detector.maxAllowedPVLifetime = 0;
detector.applySwingsOnPVPivots = true;
detector.selectRejectedPVPivots = true;
detector.selectEngulfedPVPivots = true;
@@ -896,20 +900,32 @@ class XCXCAEASignaller : XCBase
//
// FVG ...
detector.maxAllowedFVGLife = 0;
detector.detectFVGTypeOne = true;
detector.detectFVGTypeTwo = false;
detector.applyPVToFVGBoundary = false;
detector.detectFVGBullishPivots = true;
detector.detectFVGBearishPivots = true;
detector.selectRejectedFVGPivots = true;
detector.selectEngulfedFVGPivots = true;
detector.applyLastBarToFVGBoundary = false;
detector.selectOnlyFVGWhichHasIndirectionalLastBar = true;
//
detector.selectSameBarFVGs = true;
detector.maxAllowedFVGLifetime = 0;
detector.validateFVGUsingPV = false;
detector.applyPVToFVGBoundary = false;
detector.selectRejectedFVGPivots = true;
detector.selectEngulfedFVGPivots = true;
detector.validateFVGUsingManalyser = true;
detector.applyLastBarToFVGBoundary = false;
detector.selectOnlyFVGWhichHasIndirectionalLastBar = true;
//
// Bullish ...
detector.detectFVGBullishPivots = true;
//
// Bearish ...
detector.detectFVGBearishPivots = true;
//
// TREND ...
//
detector.maxAllowedTrendLifetime = 0;
//
// Bullish ...
detector.detectTrendBullishPivots = true;
@@ -918,6 +934,9 @@ class XCXCAEASignaller : XCBase
// Bearish ...
detector.detectTrendBearishPivots = true;
//
// DRAWER ...
//
// Initialize and Configure Drawer ...
drawer = new XCXCAEAPOIDrawer(detector);