This commit is contained in:
2024-12-16 08:29:07 +03:30
parent 2290e174d8
commit e45fee2729
8 changed files with 6153 additions and 2535 deletions
@@ -997,6 +997,145 @@ class XC121SMCCycleHelper : public XCBase
return result;
}
/**
* Count Pivot Points Change ...
*
* @return ( int )
*/
int CountPivotPoints()
{
return ArraySize(mPivotPoints);
}
/**
* Retrieve All Pivot Point Changes as a Collection ...
*
* @param pivots: XPVPivotPoint instance Reference ...
*
* @return ( int )
*/
int FillPivotPointss(XPVPivotPoint &pivots[])
{
//
int result = 0;
//
Clean(pivots);
//
int count = CountPivotPoints();
if (!IsValidSize(pivots))
{
return result;
}
//
Copy(
mPivotPoints,
pivots //
);
//
result = ArraySize(pivots);
//
return result;
}
/**
* Retrieve All Peak Pivot Point Changes as a Collection ...
*
* @param pivots: XPVPivotPoint instance Reference ...
*
* @return ( int )
*/
int FillPeakPivotPoints(XPVPivotPoint &pivots[])
{
//
int result = 0;
//
Clean(pivots);
//
int count = CountPivotPoints();
if (!IsValidSize(count))
{
return result;
}
//
for (int i = 0; i < count; i++)
{
//
XPVPivotPoint iPivot = mPivotPoints[i];
//
bool isValid = iPivot.IsPeak();
if (isValid)
{
//
AddRef(
iPivot,
pivots //
);
}
}
//
result = ArraySize(pivots);
//
return result;
}
/**
* Retrieve All Vale Pivot Point Changes as a Collection ...
*
* @param pivots: XPVPivotPoint instance Reference ...
*
* @return ( int )
*/
int FillValePivotPoints(XPVPivotPoint &pivots[])
{
//
int result = 0;
//
Clean(pivots);
//
int count = CountPivotPoints();
if (!IsValidSize(count))
{
return result;
}
//
for (int i = 0; i < count; i++)
{
//
XPVPivotPoint iPivot = mPivotPoints[i];
//
bool isValid = iPivot.IsVale();
if (isValid)
{
//
AddRef(
iPivot,
pivots //
);
}
}
//
result = ArraySize(pivots);
//
return result;
}
//
// Virtuals ...
@@ -1456,9 +1595,9 @@ class XC121SMCCycleHelper : public XCBase
int count = 0;
double value = 0;
int repetition = 0;
int minRepetition = 40;
ENUM_TIMEFRAMES period = GetPeriod();
int periodSeconds = PeriodSeconds(period);
int minRepetition = mX121Helper.GetDonChainLength();
ENUM_XPV_PIVOTS type = isNewPeak
? XPV_PEAK
: XPV_VALE;
@@ -1486,31 +1625,37 @@ class XC121SMCCycleHelper : public XCBase
}
//
value = prevChange.after;
int delayTime = ((int)lastChange.time - (int)prevChange.time);
repetition = delayTime / periodSeconds;
//
bool isValidPivot = repetition >= minRepetition;
if (isValidPivot)
if (lastChange.IsValid() &&
prevChange.IsValid())
{
//
XPVPivotPoint pivotPoint;
pivotPoint.type = type;
pivotPoint.value = value;
pivotPoint.repetition = repetition;
value = prevChange.after;
int delayTime = ((int)lastChange.time - (int)prevChange.time);
repetition = delayTime / periodSeconds;
//
AddRef(
pivotPoint,
mPivotPoints //
);
bool isValidPivot = repetition >= minRepetition;
if (isValidPivot)
{
//
XPVPivotPoint pivotPoint;
pivotPoint.type = type;
pivotPoint.value = value;
pivotPoint.time = prevChange.time;
pivotPoint.repetition = repetition;
//
Add(
PIVOT_POINT_DETECTED,
events //
);
//
AddRef(
pivotPoint,
mPivotPoints //
);
//
Add(
PIVOT_POINT_DETECTED,
events //
);
}
}
}
}