Add Support for Cleanup Unused Saved Changes in Cycle Helper class for prevent Memory Issues ...
This commit is contained in:
@@ -624,7 +624,7 @@ class XC121SMCCycleHelper : public XCBase
|
||||
|
||||
/**
|
||||
* Validate Specified Pivot's State ...
|
||||
*
|
||||
*
|
||||
* @param pivot: XPVPivot instance Reference ...
|
||||
* @param barIndex: Integer ...
|
||||
*/
|
||||
@@ -2164,10 +2164,14 @@ class XC121SMCCycleHelper : public XCBase
|
||||
isInited = AddSarChange(sarChanged);
|
||||
|
||||
//
|
||||
Add(
|
||||
SAR_CHANGE_DETECTED,
|
||||
events //
|
||||
);
|
||||
if (isInited)
|
||||
{
|
||||
//
|
||||
Add(
|
||||
SAR_CHANGE_DETECTED,
|
||||
events //
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2209,10 +2213,14 @@ class XC121SMCCycleHelper : public XCBase
|
||||
isInited = AddPeaksChange(peaksChanged);
|
||||
|
||||
//
|
||||
Add(
|
||||
NEW_PEAK_DETECTED,
|
||||
events //
|
||||
);
|
||||
if (isInited)
|
||||
{
|
||||
//
|
||||
Add(
|
||||
NEW_PEAK_DETECTED,
|
||||
events //
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2254,10 +2262,14 @@ class XC121SMCCycleHelper : public XCBase
|
||||
isInited = AddValesChange(valesChanged);
|
||||
|
||||
//
|
||||
Add(
|
||||
NEW_VALE_DETECTED,
|
||||
events //
|
||||
);
|
||||
if (isInited)
|
||||
{
|
||||
//
|
||||
Add(
|
||||
NEW_VALE_DETECTED,
|
||||
events //
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2351,10 +2363,14 @@ class XC121SMCCycleHelper : public XCBase
|
||||
isInited = AddVWapOrderChange(vwapOrderChanged);
|
||||
|
||||
//
|
||||
Add(
|
||||
VWAP_ORDER_CHANGE_ETECTED,
|
||||
events //
|
||||
);
|
||||
if (isInited)
|
||||
{
|
||||
//
|
||||
Add(
|
||||
VWAP_ORDER_CHANGE_ETECTED,
|
||||
events //
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2446,10 +2462,14 @@ class XC121SMCCycleHelper : public XCBase
|
||||
isInited = AddVWapStateChange(vwapStateChanged);
|
||||
|
||||
//
|
||||
Add(
|
||||
VWAP_STATE_CHANGE_DETCTED,
|
||||
events //
|
||||
);
|
||||
if (isInited)
|
||||
{
|
||||
//
|
||||
Add(
|
||||
VWAP_STATE_CHANGE_DETCTED,
|
||||
events //
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2499,20 +2519,19 @@ class XC121SMCCycleHelper : public XCBase
|
||||
{
|
||||
//
|
||||
// Add Active to List ...
|
||||
AddRef(
|
||||
mActioveConsolidationZone,
|
||||
mConsolidationZones //
|
||||
);
|
||||
bool isInited = AddConsolidationZone(mActioveConsolidationZone);
|
||||
if (isInited)
|
||||
{
|
||||
//
|
||||
// Clean Active Zone ...
|
||||
mActioveConsolidationZone.Clean();
|
||||
|
||||
//
|
||||
// Clean Active Zone ...
|
||||
mActioveConsolidationZone.Clean();
|
||||
|
||||
//
|
||||
Add(
|
||||
CONSOLIDATION_BREAKED_DETECTED,
|
||||
events //
|
||||
);
|
||||
//
|
||||
Add(
|
||||
CONSOLIDATION_BREAKED_DETECTED,
|
||||
events //
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2575,16 +2594,15 @@ class XC121SMCCycleHelper : public XCBase
|
||||
pivotPoint.repetition = repetition;
|
||||
|
||||
//
|
||||
AddRef(
|
||||
pivotPoint,
|
||||
mPivotPoints //
|
||||
);
|
||||
|
||||
//
|
||||
Add(
|
||||
PIVOT_POINT_DETECTED,
|
||||
events //
|
||||
);
|
||||
bool isInited = AddPivotPoint(pivotPoint);
|
||||
if (isInited)
|
||||
{
|
||||
//
|
||||
Add(
|
||||
PIVOT_POINT_DETECTED,
|
||||
events //
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2634,19 +2652,18 @@ class XC121SMCCycleHelper : public XCBase
|
||||
if (mActivePeakPivot.repetition >= pvValidation)
|
||||
{
|
||||
//
|
||||
AddRef(
|
||||
mActivePeakPivot,
|
||||
mPivots //
|
||||
);
|
||||
bool isInited = AddPivot(mActivePeakPivot);
|
||||
if (isInited)
|
||||
{
|
||||
//
|
||||
Add(
|
||||
PEAK_PIVOT_ENDED,
|
||||
events //
|
||||
);
|
||||
|
||||
//
|
||||
Add(
|
||||
PEAK_PIVOT_ENDED,
|
||||
events //
|
||||
);
|
||||
|
||||
//
|
||||
mActivePeakPivot.Clean();
|
||||
//
|
||||
mActivePeakPivot.Clean();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2705,19 +2722,18 @@ class XC121SMCCycleHelper : public XCBase
|
||||
if (mActiveValePivot.repetition >= pvValidation)
|
||||
{
|
||||
//
|
||||
AddRef(
|
||||
mActiveValePivot,
|
||||
mPivots //
|
||||
);
|
||||
bool isInited = AddPivot(mActiveValePivot);
|
||||
if (isInited)
|
||||
{
|
||||
//
|
||||
Add(
|
||||
VALE_PIVOT_ENDED,
|
||||
events //
|
||||
);
|
||||
|
||||
//
|
||||
Add(
|
||||
VALE_PIVOT_ENDED,
|
||||
events //
|
||||
);
|
||||
|
||||
//
|
||||
mActiveValePivot.Clean();
|
||||
//
|
||||
mActiveValePivot.Clean();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -3368,5 +3384,143 @@ class XC121SMCCycleHelper : public XCBase
|
||||
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 =
|
||||
//
|
||||
bearishConditions1 ||
|
||||
bearishConditions2
|
||||
bearishConditions1
|
||||
// ||
|
||||
// bearishConditions2
|
||||
//
|
||||
;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user