This commit is contained in:
2024-12-14 01:15:29 +03:30
parent 940931d78a
commit 5d0431893c
3 changed files with 260 additions and 31 deletions
@@ -46,6 +46,7 @@ enum ENUM_X_CYCLE_EVENTS
SAR_CHANGE_DETECTED,
NEW_PEAK_DETECTED,
NEW_VALE_DETECTED,
PIVOT_POINT_DETECTED,
VWAP_ORDER_CHANGE_ETECTED,
VWAP_STATE_CHANGE_DETCTED,
CONSOLIDATION_BREAKED_DETECTED
@@ -1727,6 +1728,72 @@ class XC121SMCCycleHelper : public XCBase
);
}
}
//
// Check Valid Peaks and Vales ...
if (isNewPeak || isNewVale)
{
//
int count = 0;
double value = 0;
int repetition = 0;
int minRepetition = 40;
ENUM_TIMEFRAMES period = GetPeriod();
int periodSeconds = PeriodSeconds(period);
ENUM_XPV_PIVOTS type = isNewPeak
? XPV_PEAK
: XPV_VALE;
//
XValueChange lastChange;
XValueChange prevChange;
//
count = CountPeaksChanges();
if (isNewPeak && count >= 2)
{
//
lastChange = mPeaksChanges[count - 1];
prevChange = mPeaksChanges[count - 2];
}
//
count = CountValesChanges();
if (isNewVale && count >= 2)
{
//
lastChange = mValesChanges[count - 1];
prevChange = mValesChanges[count - 2];
}
//
value = prevChange.after;
int delayTime = ((int)lastChange.time - (int)prevChange.time);
repetition = delayTime / periodSeconds;
//
bool isValidPivot = repetition >= minRepetition;
if (isValidPivot)
{
//
XPVPivotPoint pivotPoint;
pivotPoint.type = type;
pivotPoint.value = value;
pivotPoint.repetition = repetition;
//
AddRef(
pivotPoint,
mPivotPoints //
);
//
Add(
PIVOT_POINT_DETECTED,
events //
);
}
}
}
//
@@ -1748,6 +1815,9 @@ class XC121SMCCycleHelper : public XCBase
XConsolidationZone mConsolidationZones[]; // Holds Consolidation Zones ...
XConsolidationZone mActioveConsolidationZone; // Holds Actiove Consolidation Zone ...
//
XPVPivotPoint mPivotPoints[]; // Holds Pivots ...
//
// Actions ...