Add Support for Cleanup Unused Saved Changes in Cycle Helper class for prevent Memory Issues ...
This commit is contained in:
@@ -2163,6 +2163,9 @@ class XC121SMCCycleHelper : public XCBase
|
|||||||
//
|
//
|
||||||
isInited = AddSarChange(sarChanged);
|
isInited = AddSarChange(sarChanged);
|
||||||
|
|
||||||
|
//
|
||||||
|
if (isInited)
|
||||||
|
{
|
||||||
//
|
//
|
||||||
Add(
|
Add(
|
||||||
SAR_CHANGE_DETECTED,
|
SAR_CHANGE_DETECTED,
|
||||||
@@ -2170,6 +2173,7 @@ class XC121SMCCycleHelper : public XCBase
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Detect Peaks Changes ...
|
// Detect Peaks Changes ...
|
||||||
@@ -2208,6 +2212,9 @@ class XC121SMCCycleHelper : public XCBase
|
|||||||
//
|
//
|
||||||
isInited = AddPeaksChange(peaksChanged);
|
isInited = AddPeaksChange(peaksChanged);
|
||||||
|
|
||||||
|
//
|
||||||
|
if (isInited)
|
||||||
|
{
|
||||||
//
|
//
|
||||||
Add(
|
Add(
|
||||||
NEW_PEAK_DETECTED,
|
NEW_PEAK_DETECTED,
|
||||||
@@ -2215,6 +2222,7 @@ class XC121SMCCycleHelper : public XCBase
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Detect Vales Changes ...
|
// Detect Vales Changes ...
|
||||||
@@ -2253,6 +2261,9 @@ class XC121SMCCycleHelper : public XCBase
|
|||||||
//
|
//
|
||||||
isInited = AddValesChange(valesChanged);
|
isInited = AddValesChange(valesChanged);
|
||||||
|
|
||||||
|
//
|
||||||
|
if (isInited)
|
||||||
|
{
|
||||||
//
|
//
|
||||||
Add(
|
Add(
|
||||||
NEW_VALE_DETECTED,
|
NEW_VALE_DETECTED,
|
||||||
@@ -2260,6 +2271,7 @@ class XC121SMCCycleHelper : public XCBase
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// VWap Direction Change ...
|
// VWap Direction Change ...
|
||||||
@@ -2350,6 +2362,9 @@ class XC121SMCCycleHelper : public XCBase
|
|||||||
//
|
//
|
||||||
isInited = AddVWapOrderChange(vwapOrderChanged);
|
isInited = AddVWapOrderChange(vwapOrderChanged);
|
||||||
|
|
||||||
|
//
|
||||||
|
if (isInited)
|
||||||
|
{
|
||||||
//
|
//
|
||||||
Add(
|
Add(
|
||||||
VWAP_ORDER_CHANGE_ETECTED,
|
VWAP_ORDER_CHANGE_ETECTED,
|
||||||
@@ -2357,6 +2372,7 @@ class XC121SMCCycleHelper : public XCBase
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// States Changed ...
|
// States Changed ...
|
||||||
@@ -2445,6 +2461,9 @@ class XC121SMCCycleHelper : public XCBase
|
|||||||
//
|
//
|
||||||
isInited = AddVWapStateChange(vwapStateChanged);
|
isInited = AddVWapStateChange(vwapStateChanged);
|
||||||
|
|
||||||
|
//
|
||||||
|
if (isInited)
|
||||||
|
{
|
||||||
//
|
//
|
||||||
Add(
|
Add(
|
||||||
VWAP_STATE_CHANGE_DETCTED,
|
VWAP_STATE_CHANGE_DETCTED,
|
||||||
@@ -2452,6 +2471,7 @@ class XC121SMCCycleHelper : public XCBase
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Detect Consolidations ...
|
// Detect Consolidations ...
|
||||||
@@ -2499,11 +2519,9 @@ class XC121SMCCycleHelper : public XCBase
|
|||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Add Active to List ...
|
// Add Active to List ...
|
||||||
AddRef(
|
bool isInited = AddConsolidationZone(mActioveConsolidationZone);
|
||||||
mActioveConsolidationZone,
|
if (isInited)
|
||||||
mConsolidationZones //
|
{
|
||||||
);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Clean Active Zone ...
|
// Clean Active Zone ...
|
||||||
mActioveConsolidationZone.Clean();
|
mActioveConsolidationZone.Clean();
|
||||||
@@ -2516,6 +2534,7 @@ class XC121SMCCycleHelper : public XCBase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check Valid Peaks and Vales ...
|
// Check Valid Peaks and Vales ...
|
||||||
@@ -2575,11 +2594,9 @@ class XC121SMCCycleHelper : public XCBase
|
|||||||
pivotPoint.repetition = repetition;
|
pivotPoint.repetition = repetition;
|
||||||
|
|
||||||
//
|
//
|
||||||
AddRef(
|
bool isInited = AddPivotPoint(pivotPoint);
|
||||||
pivotPoint,
|
if (isInited)
|
||||||
mPivotPoints //
|
{
|
||||||
);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
Add(
|
Add(
|
||||||
PIVOT_POINT_DETECTED,
|
PIVOT_POINT_DETECTED,
|
||||||
@@ -2588,6 +2605,7 @@ class XC121SMCCycleHelper : public XCBase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Calculate XPVPivot ...
|
// Calculate XPVPivot ...
|
||||||
@@ -2634,11 +2652,9 @@ class XC121SMCCycleHelper : public XCBase
|
|||||||
if (mActivePeakPivot.repetition >= pvValidation)
|
if (mActivePeakPivot.repetition >= pvValidation)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
AddRef(
|
bool isInited = AddPivot(mActivePeakPivot);
|
||||||
mActivePeakPivot,
|
if (isInited)
|
||||||
mPivots //
|
{
|
||||||
);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
Add(
|
Add(
|
||||||
PEAK_PIVOT_ENDED,
|
PEAK_PIVOT_ENDED,
|
||||||
@@ -2648,6 +2664,7 @@ class XC121SMCCycleHelper : public XCBase
|
|||||||
//
|
//
|
||||||
mActivePeakPivot.Clean();
|
mActivePeakPivot.Clean();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -2705,11 +2722,9 @@ class XC121SMCCycleHelper : public XCBase
|
|||||||
if (mActiveValePivot.repetition >= pvValidation)
|
if (mActiveValePivot.repetition >= pvValidation)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
AddRef(
|
bool isInited = AddPivot(mActiveValePivot);
|
||||||
mActiveValePivot,
|
if (isInited)
|
||||||
mPivots //
|
{
|
||||||
);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
Add(
|
Add(
|
||||||
VALE_PIVOT_ENDED,
|
VALE_PIVOT_ENDED,
|
||||||
@@ -2719,6 +2734,7 @@ class XC121SMCCycleHelper : public XCBase
|
|||||||
//
|
//
|
||||||
mActiveValePivot.Clean();
|
mActiveValePivot.Clean();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -3368,5 +3384,143 @@ class XC121SMCCycleHelper : public XCBase
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add Specified Consolidation Zone to List ...
|
||||||
|
*
|
||||||
|
* @param zone: XConsolidationZone instance Reference ...
|
||||||
|
*
|
||||||
|
* @return ( bool )
|
||||||
|
*/
|
||||||
|
bool AddConsolidationZone(XConsolidationZone &zone)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
result = zone.IsValid();
|
||||||
|
|
||||||
|
//
|
||||||
|
int beforeCount = CountConsolidationZones();
|
||||||
|
|
||||||
|
//
|
||||||
|
AddRef(
|
||||||
|
zone,
|
||||||
|
mConsolidationZones //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
int afterCount = CountConsolidationZones();
|
||||||
|
|
||||||
|
//
|
||||||
|
result = afterCount == beforeCount + 1;
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Cleaning Up Unused Items ...
|
||||||
|
int maxAllowed = MaxAllowedSavedChanges();
|
||||||
|
CleanupArray(
|
||||||
|
mConsolidationZones,
|
||||||
|
maxAllowed //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add Specified Pivot Point to List ...
|
||||||
|
*
|
||||||
|
* @param pivotPoint: XPVPivotPoint instance Reference ...
|
||||||
|
*
|
||||||
|
* @return ( bool )
|
||||||
|
*/
|
||||||
|
bool AddPivotPoint(XPVPivotPoint &pivotPoint)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
if (!pivotPoint.IsValid())
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
int beforeCount = CountPivotPoints();
|
||||||
|
|
||||||
|
//
|
||||||
|
AddRef(
|
||||||
|
pivotPoint,
|
||||||
|
mPivotPoints //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
int afterCount = CountPivotPoints();
|
||||||
|
|
||||||
|
//
|
||||||
|
result = afterCount == beforeCount + 1;
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Cleaning Up Unused Items ...
|
||||||
|
int maxAllowed = MaxAllowedSavedChanges();
|
||||||
|
CleanupArray(
|
||||||
|
mPivotPoints,
|
||||||
|
maxAllowed //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add Specified Pivot to List ...
|
||||||
|
*
|
||||||
|
* @param pivot: XPVPivot instance Reference ...
|
||||||
|
*
|
||||||
|
* @return ( bool )
|
||||||
|
*/
|
||||||
|
bool AddPivot(XPVPivot &pivot)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
if (!pivot.IsValid())
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
int beforeCount = CountPivots();
|
||||||
|
|
||||||
|
//
|
||||||
|
AddRef(
|
||||||
|
pivot,
|
||||||
|
mPivots //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
int afterCount = CountPivots();
|
||||||
|
|
||||||
|
//
|
||||||
|
result = afterCount == beforeCount + 1;
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Cleaning Up Unused Items ...
|
||||||
|
int maxAllowed = MaxAllowedSavedChanges();
|
||||||
|
CleanupArray(
|
||||||
|
mPivots,
|
||||||
|
maxAllowed //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -588,8 +588,9 @@ bool DetectX121SMCXTWPVSiganlSetup(
|
|||||||
//
|
//
|
||||||
isBearish =
|
isBearish =
|
||||||
//
|
//
|
||||||
bearishConditions1 ||
|
bearishConditions1
|
||||||
bearishConditions2
|
// ||
|
||||||
|
// bearishConditions2
|
||||||
//
|
//
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user