Try to Cleanup Memory for Fix Memory Leaks ...
This commit is contained in:
@@ -34,11 +34,15 @@ class XCBase
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Represent Basic Unique Tag ...
|
// Represent Basic Unique Tag ...
|
||||||
virtual string GetTag();
|
virtual string GetTag() {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Retrieve Class Token ...
|
// Retrieve Class Token ...
|
||||||
virtual string GetToken();
|
virtual string GetToken() {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Protected
|
// Protected
|
||||||
|
|||||||
@@ -54,6 +54,8 @@ class XCBaseExpert : public XCBaseAlert
|
|||||||
// Deconstructor ...
|
// Deconstructor ...
|
||||||
void ~XCBaseExpert()
|
void ~XCBaseExpert()
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
delete mTrader;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -649,6 +651,7 @@ class XCBaseExpert : public XCBaseAlert
|
|||||||
virtual void DestroyEA()
|
virtual void DestroyEA()
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
|
delete mTrader;
|
||||||
delete mCTHelper;
|
delete mCTHelper;
|
||||||
delete mCCHelper;
|
delete mCCHelper;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ class XCPOIDetector : public XCBaseAlert
|
|||||||
//
|
//
|
||||||
public:
|
public:
|
||||||
//
|
//
|
||||||
XCPOIDrawer mDrawer;
|
XCPOIDrawer *mDrawer;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Constructors ...
|
// Constructors ...
|
||||||
@@ -69,6 +69,10 @@ class XCPOIDetector : public XCBaseAlert
|
|||||||
mPeriod //
|
mPeriod //
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Create Default Drawer Instance ...
|
||||||
|
mDrawer = new XCPOIDrawer();
|
||||||
|
|
||||||
//
|
//
|
||||||
// Apply Default Configurations ...
|
// Apply Default Configurations ...
|
||||||
Default();
|
Default();
|
||||||
@@ -1048,6 +1052,10 @@ class XCPOIDetector : public XCBaseAlert
|
|||||||
DestroyPOIs();
|
DestroyPOIs();
|
||||||
DestroySessions();
|
DestroySessions();
|
||||||
DestroyEventListeners();
|
DestroyEventListeners();
|
||||||
|
|
||||||
|
//
|
||||||
|
delete mDrawer;
|
||||||
|
delete mTicksZone;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -1212,6 +1220,22 @@ class XCPOIDetector : public XCBaseAlert
|
|||||||
//
|
//
|
||||||
Clean(mBullishFairValueGaps);
|
Clean(mBullishFairValueGaps);
|
||||||
Clean(mBearishFairValueGaps);
|
Clean(mBearishFairValueGaps);
|
||||||
|
|
||||||
|
//
|
||||||
|
ArrayFree(mSwingHighs);
|
||||||
|
ArrayFree(mSwingLows);
|
||||||
|
ArrayFree(mBullishMomentumBars);
|
||||||
|
ArrayFree(mBearishMomentumBars);
|
||||||
|
ArrayFree(mBullishRejectionBars);
|
||||||
|
ArrayFree(mBearishRejectionBars);
|
||||||
|
ArrayFree(mSupportZones);
|
||||||
|
ArrayFree(mResistanceZones);
|
||||||
|
ArrayFree(mSupplyZones);
|
||||||
|
ArrayFree(mDemandZones);
|
||||||
|
ArrayFree(mBullishOrderBlocks);
|
||||||
|
ArrayFree(mBearishOrderBlocks);
|
||||||
|
ArrayFree(mBullishFairValueGaps);
|
||||||
|
ArrayFree(mBearishFairValueGaps);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1226,7 +1250,11 @@ class XCPOIDetector : public XCBaseAlert
|
|||||||
*/
|
*/
|
||||||
void DestroyEventListeners()
|
void DestroyEventListeners()
|
||||||
{
|
{
|
||||||
|
//
|
||||||
Clean(mEventListeners);
|
Clean(mEventListeners);
|
||||||
|
|
||||||
|
//
|
||||||
|
ArrayFree(mEventListeners);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -1327,17 +1355,6 @@ class XCPOIDetector : public XCBaseAlert
|
|||||||
swing,
|
swing,
|
||||||
mSwingHighs //
|
mSwingHighs //
|
||||||
);
|
);
|
||||||
|
|
||||||
//
|
|
||||||
// XCSwingHighObject *iObj;
|
|
||||||
// bool isCreated = mDrawer.CreateSwingHigh(
|
|
||||||
// swing,
|
|
||||||
// iObj //
|
|
||||||
// );
|
|
||||||
// if (isCreated)
|
|
||||||
// {
|
|
||||||
// AddObjectIfNotExists(iObj);
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1397,17 +1414,6 @@ class XCPOIDetector : public XCBaseAlert
|
|||||||
swing,
|
swing,
|
||||||
mSwingLows //
|
mSwingLows //
|
||||||
);
|
);
|
||||||
|
|
||||||
// //
|
|
||||||
// XCSwingLowObject *iObj;
|
|
||||||
// bool isCreated = mDrawer.CreateSwingLow(
|
|
||||||
// swing,
|
|
||||||
// iObj //
|
|
||||||
// );
|
|
||||||
// if (isCreated)
|
|
||||||
// {
|
|
||||||
// AddObjectIfNotExists(iObj);
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1463,17 +1469,6 @@ class XCPOIDetector : public XCBaseAlert
|
|||||||
momentumBar,
|
momentumBar,
|
||||||
mBullishMomentumBars //
|
mBullishMomentumBars //
|
||||||
);
|
);
|
||||||
|
|
||||||
//
|
|
||||||
// XCBullishMomentumObject *iObj;
|
|
||||||
// bool isCreated = mDrawer.CreateBullishMomentumBar(
|
|
||||||
// momentumBar,
|
|
||||||
// iObj //
|
|
||||||
// );
|
|
||||||
// if (isCreated)
|
|
||||||
// {
|
|
||||||
// AddObjectIfNotExists(iObj);
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1529,17 +1524,6 @@ class XCPOIDetector : public XCBaseAlert
|
|||||||
momentumBar,
|
momentumBar,
|
||||||
mBearishMomentumBars //
|
mBearishMomentumBars //
|
||||||
);
|
);
|
||||||
|
|
||||||
//
|
|
||||||
// XCBearishMomentumObject *iObj;
|
|
||||||
// bool isCreated = mDrawer.CreateBearishMomentumBar(
|
|
||||||
// momentumBar,
|
|
||||||
// iObj //
|
|
||||||
// );
|
|
||||||
// if (isCreated)
|
|
||||||
// {
|
|
||||||
// AddObjectIfNotExists(iObj);
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1595,17 +1579,6 @@ class XCPOIDetector : public XCBaseAlert
|
|||||||
rejectionBar,
|
rejectionBar,
|
||||||
mBullishRejectionBars //
|
mBullishRejectionBars //
|
||||||
);
|
);
|
||||||
|
|
||||||
// //
|
|
||||||
// XCBullishRejectionObject *iObj;
|
|
||||||
// bool isCreated = mDrawer.CreateBullishRejectionBar(
|
|
||||||
// rejectionBar,
|
|
||||||
// iObj //
|
|
||||||
// );
|
|
||||||
// if (isCreated)
|
|
||||||
// {
|
|
||||||
// AddObjectIfNotExists(iObj);
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1661,17 +1634,6 @@ class XCPOIDetector : public XCBaseAlert
|
|||||||
rejectionBar,
|
rejectionBar,
|
||||||
mBearishRejectionBars //
|
mBearishRejectionBars //
|
||||||
);
|
);
|
||||||
|
|
||||||
//
|
|
||||||
// XCBearishRejectionObject *iObj;
|
|
||||||
// bool isCreated = mDrawer.CreateBearishRejectionBar(
|
|
||||||
// rejectionBar,
|
|
||||||
// iObj //
|
|
||||||
// );
|
|
||||||
// if (isCreated)
|
|
||||||
// {
|
|
||||||
// AddObjectIfNotExists(iObj);
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1735,17 +1697,6 @@ class XCPOIDetector : public XCBaseAlert
|
|||||||
support,
|
support,
|
||||||
mSupportZones //
|
mSupportZones //
|
||||||
);
|
);
|
||||||
|
|
||||||
// //
|
|
||||||
// XCSupportZoneObject *iObj;
|
|
||||||
// bool isCreated = mDrawer.CreateSupportZone(
|
|
||||||
// support,
|
|
||||||
// iObj //
|
|
||||||
// );
|
|
||||||
// if (isCreated)
|
|
||||||
// {
|
|
||||||
// AddObjectIfNotExists(iObj);
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1805,17 +1756,6 @@ class XCPOIDetector : public XCBaseAlert
|
|||||||
resistance,
|
resistance,
|
||||||
mResistanceZones //
|
mResistanceZones //
|
||||||
);
|
);
|
||||||
|
|
||||||
// //
|
|
||||||
// XCResistanceZoneObject *iObj;
|
|
||||||
// bool isCreated = mDrawer.CreateResistanceZone(
|
|
||||||
// resistance,
|
|
||||||
// iObj //
|
|
||||||
// );
|
|
||||||
// if (isCreated)
|
|
||||||
// {
|
|
||||||
// AddObjectIfNotExists(iObj);
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1902,17 +1842,6 @@ class XCPOIDetector : public XCBaseAlert
|
|||||||
supply,
|
supply,
|
||||||
mSupplyZones //
|
mSupplyZones //
|
||||||
);
|
);
|
||||||
|
|
||||||
// //
|
|
||||||
// XCSupplyZoneObject *iObj;
|
|
||||||
// bool isCreated = mDrawer.CreateSupplyZone(
|
|
||||||
// supply,
|
|
||||||
// iObj //
|
|
||||||
// );
|
|
||||||
// if (isCreated)
|
|
||||||
// {
|
|
||||||
// AddObjectIfNotExists(iObj);
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1999,17 +1928,6 @@ class XCPOIDetector : public XCBaseAlert
|
|||||||
demand,
|
demand,
|
||||||
mDemandZones //
|
mDemandZones //
|
||||||
);
|
);
|
||||||
|
|
||||||
// //
|
|
||||||
// XCDemandZoneObject *iObj;
|
|
||||||
// bool isCreated = mDrawer.CreateDemandZone(
|
|
||||||
// demand,
|
|
||||||
// iObj //
|
|
||||||
// );
|
|
||||||
// if (isCreated)
|
|
||||||
// {
|
|
||||||
// AddObjectIfNotExists(iObj);
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2085,17 +2003,6 @@ class XCPOIDetector : public XCBaseAlert
|
|||||||
ob,
|
ob,
|
||||||
mBullishOrderBlocks //
|
mBullishOrderBlocks //
|
||||||
);
|
);
|
||||||
|
|
||||||
// //
|
|
||||||
// XCBullishOrderBlockObject *iObj;
|
|
||||||
// bool isCreated = mDrawer.CreateBullishOrderBlock(
|
|
||||||
// ob,
|
|
||||||
// iObj //
|
|
||||||
// );
|
|
||||||
// if (isCreated)
|
|
||||||
// {
|
|
||||||
// AddObjectIfNotExists(iObj);
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2242,17 +2149,6 @@ class XCPOIDetector : public XCBaseAlert
|
|||||||
ob,
|
ob,
|
||||||
mBearishOrderBlocks //
|
mBearishOrderBlocks //
|
||||||
);
|
);
|
||||||
|
|
||||||
// //
|
|
||||||
// XCBearishOrderBlockObject *iObj;
|
|
||||||
// bool isCreated = mDrawer.CreateBearishOrderBlock(
|
|
||||||
// ob,
|
|
||||||
// iObj //
|
|
||||||
// );
|
|
||||||
// if (isCreated)
|
|
||||||
// {
|
|
||||||
// AddObjectIfNotExists(iObj);
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2402,17 +2298,6 @@ class XCPOIDetector : public XCBaseAlert
|
|||||||
fvg,
|
fvg,
|
||||||
mBullishFairValueGaps //
|
mBullishFairValueGaps //
|
||||||
);
|
);
|
||||||
|
|
||||||
// //
|
|
||||||
// XCBullishFairValueGapObject *iObj;
|
|
||||||
// bool isCreated = mDrawer.CreateBullishFairValueGap(
|
|
||||||
// fvg,
|
|
||||||
// iObj //
|
|
||||||
// );
|
|
||||||
// if (isCreated)
|
|
||||||
// {
|
|
||||||
// AddObjectIfNotExists(iObj);
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2491,17 +2376,6 @@ class XCPOIDetector : public XCBaseAlert
|
|||||||
fvg,
|
fvg,
|
||||||
mBearishFairValueGaps //
|
mBearishFairValueGaps //
|
||||||
);
|
);
|
||||||
|
|
||||||
// //
|
|
||||||
// XCBearishFairValueGapObject *iObj;
|
|
||||||
// bool isCreated = mDrawer.CreateBearishFairValueGap(
|
|
||||||
// fvg,
|
|
||||||
// iObj //
|
|
||||||
// );
|
|
||||||
// if (isCreated)
|
|
||||||
// {
|
|
||||||
// AddObjectIfNotExists(iObj);
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4341,16 +4215,6 @@ class XCPOIDetector : public XCBaseAlert
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// //
|
|
||||||
// if (mTicksZoneObject != NULL)
|
|
||||||
// {
|
|
||||||
// mTicksZoneObject.Destroy();
|
|
||||||
// }
|
|
||||||
// mDrawer.CreateTicksZone(
|
|
||||||
// mTicksZone,
|
|
||||||
// mTicksZoneObject //
|
|
||||||
// );
|
|
||||||
|
|
||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,6 +44,8 @@ class XCPOIDrawer : public XCBase
|
|||||||
// Deconstructor ...
|
// Deconstructor ...
|
||||||
void ~XCPOIDrawer()
|
void ~XCPOIDrawer()
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
ArrayFree(mTicksZoneSpecs);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -598,6 +598,17 @@ class XCTrade : public XCBase
|
|||||||
Clean(mOnPartialCloseEventHandlers);
|
Clean(mOnPartialCloseEventHandlers);
|
||||||
Clean(mPositionsChangedEventHandlers);
|
Clean(mPositionsChangedEventHandlers);
|
||||||
Clean(mTradeStateChangedEventHandlers);
|
Clean(mTradeStateChangedEventHandlers);
|
||||||
|
|
||||||
|
//
|
||||||
|
ArrayFree(mOnModifyEventHandlers);
|
||||||
|
ArrayFree(mStopLossEventHandlers);
|
||||||
|
ArrayFree(mTakeProfitEventHandlers);
|
||||||
|
ArrayFree(mDealsChangedEventHandlers);
|
||||||
|
ArrayFree(mOnForceCloseEventHandlers);
|
||||||
|
ArrayFree(mOrdersChangedEventHandlers);
|
||||||
|
ArrayFree(mOnPartialCloseEventHandlers);
|
||||||
|
ArrayFree(mPositionsChangedEventHandlers);
|
||||||
|
ArrayFree(mTradeStateChangedEventHandlers);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ input bool eaReportNewHours = false; // Report New Hours
|
|||||||
//
|
//
|
||||||
// Define Local Variables ...
|
// Define Local Variables ...
|
||||||
|
|
||||||
XC121SMCExpert eaExpert;
|
XC121SMCExpert *eaExpert;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Event Handlers ...
|
// Event Handlers ...
|
||||||
@@ -132,6 +132,7 @@ int OnInit()
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Configure EA Expert Class ...
|
// Configure EA Expert Class ...
|
||||||
|
eaExpert = new XC121SMCExpert();
|
||||||
|
|
||||||
//
|
//
|
||||||
// Event Handlers ...
|
// Event Handlers ...
|
||||||
@@ -241,6 +242,9 @@ void OnDeinit(const int reason)
|
|||||||
//
|
//
|
||||||
// Destroy Timer ...
|
// Destroy Timer ...
|
||||||
eaExpert.HandleOnDeInit();
|
eaExpert.HandleOnDeInit();
|
||||||
|
|
||||||
|
//
|
||||||
|
delete eaExpert;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -475,6 +475,16 @@ class XCX121XATRHelper : public XCBaseHelper
|
|||||||
// Deconstructor ...
|
// Deconstructor ...
|
||||||
~XCX121XATRHelper()
|
~XCX121XATRHelper()
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
ArrayFree(rsiBuffer);
|
||||||
|
ArrayFree(atrUpperBuffer);
|
||||||
|
ArrayFree(atrLowerBuffer);
|
||||||
|
ArrayFree(atrBuffer);
|
||||||
|
ArrayFree(atrUpperRawBuffer);
|
||||||
|
ArrayFree(atrLowerRawBuffer);
|
||||||
|
|
||||||
|
//
|
||||||
|
mInputs.Clean();
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -482,7 +492,7 @@ class XCX121XATRHelper : public XCBaseHelper
|
|||||||
bool Init(
|
bool Init(
|
||||||
string symbol, // Trading Symbol
|
string symbol, // Trading Symbol
|
||||||
ENUM_TIMEFRAMES period, // Trading Period
|
ENUM_TIMEFRAMES period, // Trading Period
|
||||||
X121XATRInputs &inputs // Inputs
|
X121XATRInputs &inputs // Inputs
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -880,8 +890,8 @@ class XCX121XATRHelper : public XCBaseHelper
|
|||||||
//
|
//
|
||||||
bool GetConditions(
|
bool GetConditions(
|
||||||
X121XATRConditions &conditions, //
|
X121XATRConditions &conditions, //
|
||||||
int barIndex = 0, //
|
int barIndex = 0, //
|
||||||
int loopback = 5 //
|
int loopback = 5 //
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -420,6 +420,18 @@ class XCX121XCHEHelper : public XCBaseHelper
|
|||||||
// Deconstructor ...
|
// Deconstructor ...
|
||||||
~XCX121XCHEHelper()
|
~XCX121XCHEHelper()
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
mInputs.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
ArrayFree(le1Buffer);
|
||||||
|
ArrayFree(se1Buffer);
|
||||||
|
ArrayFree(le2Buffer);
|
||||||
|
ArrayFree(se2Buffer);
|
||||||
|
ArrayFree(le1StartBuffer);
|
||||||
|
ArrayFree(se1StartBuffer);
|
||||||
|
ArrayFree(le2StartBuffer);
|
||||||
|
ArrayFree(se2StartBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -421,6 +421,18 @@ class XCX121XDONHelper : public XCBaseHelper
|
|||||||
// Deconstructor ...
|
// Deconstructor ...
|
||||||
~XCX121XDONHelper()
|
~XCX121XDONHelper()
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
mInputs.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
ArrayFree(donOpenUpperBuffer);
|
||||||
|
ArrayFree(donOpenLowerBuffer);
|
||||||
|
ArrayFree(donHighUpperBuffer);
|
||||||
|
ArrayFree(donHighLowerBuffer);
|
||||||
|
ArrayFree(donLowUpperBuffer);
|
||||||
|
ArrayFree(donLowLowerBuffer);
|
||||||
|
ArrayFree(donCloseUpperBuffer);
|
||||||
|
ArrayFree(donCloseLowerBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -428,7 +440,7 @@ class XCX121XDONHelper : public XCBaseHelper
|
|||||||
bool Init(
|
bool Init(
|
||||||
string symbol, // Trading Symbol
|
string symbol, // Trading Symbol
|
||||||
ENUM_TIMEFRAMES period, // Trading Period
|
ENUM_TIMEFRAMES period, // Trading Period
|
||||||
X121XDONInputs &inputs // Inputs
|
X121XDONInputs &inputs // Inputs
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -950,8 +962,8 @@ class XCX121XDONHelper : public XCBaseHelper
|
|||||||
//
|
//
|
||||||
bool GetConditions(
|
bool GetConditions(
|
||||||
X121XDONConditions &conditions, //
|
X121XDONConditions &conditions, //
|
||||||
int barIndex = 0, //
|
int barIndex = 0, //
|
||||||
int loopback = 5 //
|
int loopback = 5 //
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -514,6 +514,23 @@ class XCX121XPVHelper : public XCBaseHelper
|
|||||||
// Deconstructor ...
|
// Deconstructor ...
|
||||||
~XCX121XPVHelper()
|
~XCX121XPVHelper()
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
mInputs.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
ArrayFree(peaksBuffer);
|
||||||
|
ArrayFree(valesBuffer);
|
||||||
|
ArrayFree(sarBuffer);
|
||||||
|
ArrayFree(cHHBuffer);
|
||||||
|
ArrayFree(cLLBuffer);
|
||||||
|
ArrayFree(sHHBuffer);
|
||||||
|
ArrayFree(sLLBuffer);
|
||||||
|
ArrayFree(mHHBuffer);
|
||||||
|
ArrayFree(mLLBuffer);
|
||||||
|
ArrayFree(lHHBuffer);
|
||||||
|
ArrayFree(lLLBuffer);
|
||||||
|
ArrayFree(hHHBuffer);
|
||||||
|
ArrayFree(hLLBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -354,6 +354,16 @@ class XCX121XSTRHelper : public XCBaseHelper
|
|||||||
// Deconstructor ...
|
// Deconstructor ...
|
||||||
~XCX121XSTRHelper()
|
~XCX121XSTRHelper()
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
mInputs.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
ArrayFree(strBuffer);
|
||||||
|
ArrayFree(atrBuffer);
|
||||||
|
ArrayFree(strPriceBuffer);
|
||||||
|
ArrayFree(strUpBuffer);
|
||||||
|
ArrayFree(strDownBuffer);
|
||||||
|
ArrayFree(strStateBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -463,13 +463,25 @@ class XCX121XVWAPHelper : public XCBaseHelper
|
|||||||
// Deconstructor ...
|
// Deconstructor ...
|
||||||
~XCX121XVWAPHelper()
|
~XCX121XVWAPHelper()
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
mInputs.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
ArrayFree(vwapFastBuffer);
|
||||||
|
ArrayFree(vwapMidBuffer);
|
||||||
|
ArrayFree(vwapSlowBuffer);
|
||||||
|
ArrayFree(vwapVolumeBuffer);
|
||||||
|
ArrayFree(vwapPriceBuffer);
|
||||||
|
ArrayFree(vwapFastStateBuffer);
|
||||||
|
ArrayFree(vwapMidStateBuffer);
|
||||||
|
ArrayFree(vwapSlowStateBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Tools ...
|
// Tools ...
|
||||||
bool Init(
|
bool Init(
|
||||||
string symbol, // Trading Symbol
|
string symbol, // Trading Symbol
|
||||||
ENUM_TIMEFRAMES period, // Trading Period
|
ENUM_TIMEFRAMES period, // Trading Period
|
||||||
X121XVWAPInputs &inputs // Inputs
|
X121XVWAPInputs &inputs // Inputs
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@@ -1032,8 +1044,8 @@ class XCX121XVWAPHelper : public XCBaseHelper
|
|||||||
//
|
//
|
||||||
bool GetConditions(
|
bool GetConditions(
|
||||||
X121XVWAPConditions &conditions, //
|
X121XVWAPConditions &conditions, //
|
||||||
int barIndex = 0, //
|
int barIndex = 0, //
|
||||||
int loopback = 5 //
|
int loopback = 5 //
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -135,19 +135,23 @@ class XCXCCHelper : public XCBaseHelper
|
|||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Public ...
|
// Public ...
|
||||||
public:
|
public:
|
||||||
//
|
//
|
||||||
// Props ...
|
// Props ...
|
||||||
|
|
||||||
//
|
//
|
||||||
// Constructors ...
|
// Constructors ...
|
||||||
XCXCCHelper() : XCBaseHelper(_Symbol, _Period)
|
XCXCCHelper()
|
||||||
|
: XCBaseHelper(_Symbol, _Period)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Deconstructor ...
|
// Deconstructor ...
|
||||||
~XCXCCHelper() {}
|
~XCXCCHelper()
|
||||||
|
{
|
||||||
|
mInputs.Clean();
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Tools ...
|
// Tools ...
|
||||||
@@ -232,10 +236,10 @@ public:
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Protected ...
|
// Protected ...
|
||||||
protected:
|
protected:
|
||||||
//
|
//
|
||||||
// Private ...
|
// Private ...
|
||||||
private:
|
private:
|
||||||
//
|
//
|
||||||
// Props ...
|
// Props ...
|
||||||
XCCInputs mInputs; // Inputs ...
|
XCCInputs mInputs; // Inputs ...
|
||||||
|
|||||||
@@ -138,6 +138,7 @@ class XCXCTHelper : public XCBaseHelper
|
|||||||
// Deconstructor ...
|
// Deconstructor ...
|
||||||
~XCXCTHelper()
|
~XCXCTHelper()
|
||||||
{
|
{
|
||||||
|
mInputs.Clean();
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -7043,8 +7043,8 @@ template <typename T>
|
|||||||
void Clean(T &buffer[])
|
void Clean(T &buffer[])
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
ArrayFree(buffer);
|
|
||||||
ArrayResize(buffer, 0);
|
ArrayResize(buffer, 0);
|
||||||
|
ArrayFree(buffer);
|
||||||
}
|
}
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void SpecificClean(T &buffer[])
|
void SpecificClean(T &buffer[])
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ class XCX121SMCBaseStrategy : public XCBaseAlert
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Constructor(s) ...
|
// Constructor(s) ...
|
||||||
void XCX121SMCBaseStrategy(
|
XCX121SMCBaseStrategy(
|
||||||
//
|
//
|
||||||
// Base ...
|
// Base ...
|
||||||
string _symbol, // Trading Symbol
|
string _symbol, // Trading Symbol
|
||||||
@@ -61,7 +61,7 @@ class XCX121SMCBaseStrategy : public XCBaseAlert
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Deconstructor ...
|
// Deconstructor ...
|
||||||
void ~XCX121SMCBaseStrategy()
|
~XCX121SMCBaseStrategy()
|
||||||
{
|
{
|
||||||
DeInit();
|
DeInit();
|
||||||
}
|
}
|
||||||
@@ -500,6 +500,9 @@ class XCX121SMCBaseStrategy : public XCBaseAlert
|
|||||||
// Waits Until Next Candle if Current Tick has Guard ...
|
// Waits Until Next Candle if Current Tick has Guard ...
|
||||||
mGuardBarTracker.Waits();
|
mGuardBarTracker.Waits();
|
||||||
|
|
||||||
|
//
|
||||||
|
ArrayFree(positions);
|
||||||
|
|
||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -863,6 +866,9 @@ class XCX121SMCBaseStrategy : public XCBaseAlert
|
|||||||
{
|
{
|
||||||
AddObjectIfNotExists(objects[i]);
|
AddObjectIfNotExists(objects[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
ArrayFree(objects);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -959,6 +965,10 @@ class XCX121SMCBaseStrategy : public XCBaseAlert
|
|||||||
//
|
//
|
||||||
delete mPOIDrawer;
|
delete mPOIDrawer;
|
||||||
|
|
||||||
|
//
|
||||||
|
ArrayFree(mTicks);
|
||||||
|
ArrayFree(mSignalEventHandlers);
|
||||||
|
|
||||||
//
|
//
|
||||||
Destroy();
|
Destroy();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1108,8 +1108,7 @@ class XC121SMCCycleHelper : public XCBase
|
|||||||
{
|
{
|
||||||
//
|
//
|
||||||
delete mX121Helper;
|
delete mX121Helper;
|
||||||
|
delete mPOIDetector;
|
||||||
//
|
|
||||||
delete mBarAnalyser;
|
delete mBarAnalyser;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1628,6 +1628,14 @@ class XC121SMCTradeHandler : public XCBaseAlert
|
|||||||
// Deconstructor ...
|
// Deconstructor ...
|
||||||
~XC121SMCTradeHandler()
|
~XC121SMCTradeHandler()
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
ArrayFree(mData);
|
||||||
|
ArrayFree(mSymbolInfos);
|
||||||
|
ArrayFree(mLastExecutedSignals);
|
||||||
|
|
||||||
|
//
|
||||||
|
delete mDrawer;
|
||||||
|
|
||||||
//
|
//
|
||||||
delete mTrader;
|
delete mTrader;
|
||||||
delete mCollector;
|
delete mCollector;
|
||||||
@@ -3882,7 +3890,6 @@ class XC121SMCTradeHandler : public XCBaseAlert
|
|||||||
double mHedgeingMinRequiredProfitPerVolumeStep; // Minimum Required Profit Per Volume Step for Hedging ...
|
double mHedgeingMinRequiredProfitPerVolumeStep; // Minimum Required Profit Per Volume Step for Hedging ...
|
||||||
|
|
||||||
//
|
//
|
||||||
XCBarAnalyser mBarAnalyser;
|
|
||||||
XCPOIDrawer *mDrawer;
|
XCPOIDrawer *mDrawer;
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -55,6 +55,19 @@ class XC121SMCExpert : public XCBaseExpert
|
|||||||
//
|
//
|
||||||
TOnX121SMCSignal OnSignalEventListener;
|
TOnX121SMCSignal OnSignalEventListener;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Constructor(s) ...
|
||||||
|
XC121SMCExpert()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Deconstructor(s) ...
|
||||||
|
~XC121SMCExpert()
|
||||||
|
{
|
||||||
|
ArrayFree(mStrategies);
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Getter(s) / Setter(s) ...
|
// Getter(s) / Setter(s) ...
|
||||||
|
|
||||||
@@ -2306,6 +2319,9 @@ class XC121SMCExpert : public XCBaseExpert
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
Clean(guards);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -348,6 +348,8 @@ bool DetectX121SMCGuards(
|
|||||||
bool isConsolidationZoneBreakedUp = false;
|
bool isConsolidationZoneBreakedUp = false;
|
||||||
bool isConsolidationZoneBreakedDown = false;
|
bool isConsolidationZoneBreakedDown = false;
|
||||||
bool hasConsolidationZone = x121SMCConsolidationZone.IsValid();
|
bool hasConsolidationZone = x121SMCConsolidationZone.IsValid();
|
||||||
|
|
||||||
|
//
|
||||||
if (!hasConsolidationZone)
|
if (!hasConsolidationZone)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -414,8 +416,10 @@ bool DetectX121SMCGuards(
|
|||||||
// Decision ...
|
// Decision ...
|
||||||
double decisionPriceZoneUpper = 0;
|
double decisionPriceZoneUpper = 0;
|
||||||
double decisionPriceZoneLower = 0;
|
double decisionPriceZoneLower = 0;
|
||||||
bool isValidDecisionPriceZoneForPeak = false;
|
bool isDecisionPriceZoneBearish = false;
|
||||||
bool isValidDecisionPriceZoneForVale = false;
|
bool isDecisionPriceZoneBullish = false;
|
||||||
|
bool isDecisionPriceZoneValidForPeak = false;
|
||||||
|
bool isDecisionPriceZoneValidForVale = false;
|
||||||
bool isDecisionPriceZoneLowerRejected = false;
|
bool isDecisionPriceZoneLowerRejected = false;
|
||||||
bool isDecisionPriceZoneUpperRejected = false;
|
bool isDecisionPriceZoneUpperRejected = false;
|
||||||
bool isDecisionPriceZoneUpperBreakedUp = false;
|
bool isDecisionPriceZoneUpperBreakedUp = false;
|
||||||
@@ -443,24 +447,28 @@ bool DetectX121SMCGuards(
|
|||||||
decisionPriceZoneLower //
|
decisionPriceZoneLower //
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
isDecisionPriceZoneBearish = x121SMCDecisionPriceZone.IsBearish();
|
||||||
|
isDecisionPriceZoneBullish = x121SMCDecisionPriceZone.IsBullish();
|
||||||
|
|
||||||
|
//
|
||||||
|
XOHCL iBar;
|
||||||
|
bool isInited = iBar.Init(
|
||||||
|
symbol,
|
||||||
|
decisionXConditions.period,
|
||||||
|
cIndex //
|
||||||
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
if (hasBoundary)
|
if (hasBoundary)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
XOHCL iBar;
|
isDecisionPriceZoneValidForPeak =
|
||||||
bool isInited = iBar.Init(
|
|
||||||
symbol,
|
|
||||||
decisionXConditions.period,
|
|
||||||
cIndex //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
isValidDecisionPriceZoneForPeak =
|
|
||||||
decisionXConditions.peaksBuffer[1] <= decisionPriceZoneUpper &&
|
decisionXConditions.peaksBuffer[1] <= decisionPriceZoneUpper &&
|
||||||
decisionXConditions.peaksBuffer[1] >= decisionPriceZoneLower;
|
decisionXConditions.peaksBuffer[1] >= decisionPriceZoneLower;
|
||||||
|
|
||||||
//
|
//
|
||||||
isValidDecisionPriceZoneForVale =
|
isDecisionPriceZoneValidForVale =
|
||||||
decisionXConditions.valesBuffer[1] <= decisionPriceZoneUpper &&
|
decisionXConditions.valesBuffer[1] <= decisionPriceZoneUpper &&
|
||||||
decisionXConditions.valesBuffer[1] >= decisionPriceZoneLower;
|
decisionXConditions.valesBuffer[1] >= decisionPriceZoneLower;
|
||||||
|
|
||||||
@@ -500,14 +508,49 @@ bool DetectX121SMCGuards(
|
|||||||
iBar //
|
iBar //
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Clear Price Zone ...
|
||||||
|
bool canReset =
|
||||||
|
//
|
||||||
|
(!isInited ||
|
||||||
|
!hasBoundary)
|
||||||
|
//
|
||||||
|
||
|
||||||
|
//
|
||||||
|
(isInited &&
|
||||||
|
hasBoundary &&
|
||||||
|
(iBar.high < decisionPriceZoneLower ||
|
||||||
|
iBar.low > decisionPriceZoneUpper))
|
||||||
|
//
|
||||||
|
;
|
||||||
|
if (canReset)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
x121SMCDecisionPriceZone.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
decisionPriceZoneUpper = 0;
|
||||||
|
decisionPriceZoneLower = 0;
|
||||||
|
isDecisionPriceZoneBearish = false;
|
||||||
|
isDecisionPriceZoneBullish = false;
|
||||||
|
isDecisionPriceZoneValidForPeak = false;
|
||||||
|
isDecisionPriceZoneValidForVale = false;
|
||||||
|
isDecisionPriceZoneLowerRejected = false;
|
||||||
|
isDecisionPriceZoneUpperRejected = false;
|
||||||
|
isDecisionPriceZoneUpperBreakedUp = false;
|
||||||
|
isDecisionPriceZoneLowerBreakedDown = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Analyse ...
|
// Analyse ...
|
||||||
double analysePriceZoneUpper = 0;
|
double analysePriceZoneUpper = 0;
|
||||||
double analysePriceZoneLower = 0;
|
double analysePriceZoneLower = 0;
|
||||||
bool isValidAnalysePriceZoneForPeak = false;
|
bool isAnalysePriceZoneBearish = false;
|
||||||
bool isValidAnalysePriceZoneForVale = false;
|
bool isAnalysePriceZoneBullish = false;
|
||||||
|
bool isAnalysePriceZoneValidForPeak = false;
|
||||||
|
bool isAnalysePriceZoneValidForVale = false;
|
||||||
bool isAnalysePriceZoneLowerRejected = false;
|
bool isAnalysePriceZoneLowerRejected = false;
|
||||||
bool isAnalysePriceZoneUpperRejected = false;
|
bool isAnalysePriceZoneUpperRejected = false;
|
||||||
bool isAnalysePriceZoneUpperBreakedUp = false;
|
bool isAnalysePriceZoneUpperBreakedUp = false;
|
||||||
@@ -535,24 +578,28 @@ bool DetectX121SMCGuards(
|
|||||||
analysePriceZoneLower //
|
analysePriceZoneLower //
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
isAnalysePriceZoneBearish = x121SMCAnalysePriceZone.IsBearish();
|
||||||
|
isAnalysePriceZoneBullish = x121SMCAnalysePriceZone.IsBullish();
|
||||||
|
|
||||||
|
//
|
||||||
|
XOHCL iBar;
|
||||||
|
bool isInited = iBar.Init(
|
||||||
|
symbol,
|
||||||
|
analyseXConditions.period,
|
||||||
|
cIndex //
|
||||||
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
if (hasBoundary)
|
if (hasBoundary)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
XOHCL iBar;
|
isAnalysePriceZoneValidForPeak =
|
||||||
bool isInited = iBar.Init(
|
|
||||||
symbol,
|
|
||||||
analyseXConditions.period,
|
|
||||||
cIndex //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
isValidAnalysePriceZoneForPeak =
|
|
||||||
analyseXConditions.peaksBuffer[1] <= analysePriceZoneUpper &&
|
analyseXConditions.peaksBuffer[1] <= analysePriceZoneUpper &&
|
||||||
analyseXConditions.peaksBuffer[1] >= analysePriceZoneLower;
|
analyseXConditions.peaksBuffer[1] >= analysePriceZoneLower;
|
||||||
|
|
||||||
//
|
//
|
||||||
isValidAnalysePriceZoneForVale =
|
isAnalysePriceZoneValidForVale =
|
||||||
analyseXConditions.valesBuffer[1] <= analysePriceZoneUpper &&
|
analyseXConditions.valesBuffer[1] <= analysePriceZoneUpper &&
|
||||||
analyseXConditions.valesBuffer[1] >= analysePriceZoneLower;
|
analyseXConditions.valesBuffer[1] >= analysePriceZoneLower;
|
||||||
|
|
||||||
@@ -592,14 +639,49 @@ bool DetectX121SMCGuards(
|
|||||||
iBar //
|
iBar //
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Clear Price Zone ...
|
||||||
|
bool canReset =
|
||||||
|
//
|
||||||
|
(!isInited ||
|
||||||
|
!hasBoundary)
|
||||||
|
//
|
||||||
|
||
|
||||||
|
//
|
||||||
|
(isInited &&
|
||||||
|
hasBoundary &&
|
||||||
|
(iBar.high < analysePriceZoneLower ||
|
||||||
|
iBar.low > analysePriceZoneUpper))
|
||||||
|
//
|
||||||
|
;
|
||||||
|
if (canReset)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
x121SMCAnalysePriceZone.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
analysePriceZoneUpper = 0;
|
||||||
|
analysePriceZoneLower = 0;
|
||||||
|
isAnalysePriceZoneBearish = false;
|
||||||
|
isAnalysePriceZoneBullish = false;
|
||||||
|
isAnalysePriceZoneValidForPeak = false;
|
||||||
|
isAnalysePriceZoneValidForVale = false;
|
||||||
|
isAnalysePriceZoneLowerRejected = false;
|
||||||
|
isAnalysePriceZoneUpperRejected = false;
|
||||||
|
isAnalysePriceZoneUpperBreakedUp = false;
|
||||||
|
isAnalysePriceZoneLowerBreakedDown = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Verification ...
|
// Verification ...
|
||||||
double verificationPriceZoneUpper = 0;
|
double verificationPriceZoneUpper = 0;
|
||||||
double verificationPriceZoneLower = 0;
|
double verificationPriceZoneLower = 0;
|
||||||
bool isValidVerificationPriceZoneForPeak = false;
|
bool isVerificationPriceZoneBearish = false;
|
||||||
bool isValidVerificationPriceZoneForVale = false;
|
bool isVerificationPriceZoneBullish = false;
|
||||||
|
bool isVerificationPriceZoneValidForPeak = false;
|
||||||
|
bool isVerificationPriceZoneValidForVale = false;
|
||||||
bool isVerificationPriceZoneLowerRejected = false;
|
bool isVerificationPriceZoneLowerRejected = false;
|
||||||
bool isVerificationPriceZoneUpperRejected = false;
|
bool isVerificationPriceZoneUpperRejected = false;
|
||||||
bool isVerificationPriceZoneUpperBreakedUp = false;
|
bool isVerificationPriceZoneUpperBreakedUp = false;
|
||||||
@@ -627,24 +709,28 @@ bool DetectX121SMCGuards(
|
|||||||
verificationPriceZoneLower //
|
verificationPriceZoneLower //
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
isVerificationPriceZoneBearish = x121SMCVerificationPriceZone.IsBearish();
|
||||||
|
isVerificationPriceZoneBullish = x121SMCVerificationPriceZone.IsBullish();
|
||||||
|
|
||||||
|
//
|
||||||
|
XOHCL iBar;
|
||||||
|
bool isInited = iBar.Init(
|
||||||
|
symbol,
|
||||||
|
verificationXConditions.period,
|
||||||
|
cIndex //
|
||||||
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
if (hasBoundary)
|
if (hasBoundary)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
XOHCL iBar;
|
isVerificationPriceZoneValidForPeak =
|
||||||
bool isInited = iBar.Init(
|
|
||||||
symbol,
|
|
||||||
verificationXConditions.period,
|
|
||||||
cIndex //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
isValidVerificationPriceZoneForPeak =
|
|
||||||
verificationXConditions.peaksBuffer[1] <= verificationPriceZoneUpper &&
|
verificationXConditions.peaksBuffer[1] <= verificationPriceZoneUpper &&
|
||||||
verificationXConditions.peaksBuffer[1] >= verificationPriceZoneLower;
|
verificationXConditions.peaksBuffer[1] >= verificationPriceZoneLower;
|
||||||
|
|
||||||
//
|
//
|
||||||
isValidVerificationPriceZoneForVale =
|
isVerificationPriceZoneValidForVale =
|
||||||
verificationXConditions.valesBuffer[1] <= verificationPriceZoneUpper &&
|
verificationXConditions.valesBuffer[1] <= verificationPriceZoneUpper &&
|
||||||
verificationXConditions.valesBuffer[1] >= verificationPriceZoneLower;
|
verificationXConditions.valesBuffer[1] >= verificationPriceZoneLower;
|
||||||
|
|
||||||
@@ -684,6 +770,39 @@ bool DetectX121SMCGuards(
|
|||||||
iBar //
|
iBar //
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Clear Price Zone ...
|
||||||
|
bool canReset =
|
||||||
|
//
|
||||||
|
(!isInited ||
|
||||||
|
!hasBoundary)
|
||||||
|
//
|
||||||
|
||
|
||||||
|
//
|
||||||
|
(isInited &&
|
||||||
|
hasBoundary &&
|
||||||
|
(iBar.high < verificationPriceZoneLower ||
|
||||||
|
iBar.low > verificationPriceZoneUpper))
|
||||||
|
//
|
||||||
|
;
|
||||||
|
if (canReset)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
x121SMCVerificationPriceZone.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
verificationPriceZoneUpper = 0;
|
||||||
|
verificationPriceZoneLower = 0;
|
||||||
|
isVerificationPriceZoneBearish = false;
|
||||||
|
isVerificationPriceZoneBullish = false;
|
||||||
|
isVerificationPriceZoneValidForPeak = false;
|
||||||
|
isVerificationPriceZoneValidForVale = false;
|
||||||
|
isVerificationPriceZoneLowerRejected = false;
|
||||||
|
isVerificationPriceZoneUpperRejected = false;
|
||||||
|
isVerificationPriceZoneUpperBreakedUp = false;
|
||||||
|
isVerificationPriceZoneLowerBreakedDown = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -691,7 +810,87 @@ bool DetectX121SMCGuards(
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Close ...
|
// Close ...
|
||||||
// TODO: Implement Force Close Position ...
|
|
||||||
|
//
|
||||||
|
double tpCloseDiff = (15 * points);
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XPosition iPosition = ownPositions[i];
|
||||||
|
|
||||||
|
//
|
||||||
|
// Position Must be In Profit ...
|
||||||
|
if (iPosition.profit <= 0)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isPricePassed = MathAbs(iPosition.tp - iPosition.price) <= tpCloseDiff;
|
||||||
|
if (!isPricePassed)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isLong = IsLong(iPosition.type);
|
||||||
|
|
||||||
|
//
|
||||||
|
bool iHasGuard =
|
||||||
|
//
|
||||||
|
isLong
|
||||||
|
? //
|
||||||
|
(hasDecisionPriceZone &&
|
||||||
|
isDecisionPriceZoneBearish &&
|
||||||
|
isDecisionPriceZoneValidForPeak)
|
||||||
|
//
|
||||||
|
||
|
||||||
|
//
|
||||||
|
(hasAnalysePriceZone &&
|
||||||
|
isAnalysePriceZoneBearish &&
|
||||||
|
isAnalysePriceZoneValidForPeak)
|
||||||
|
//
|
||||||
|
||
|
||||||
|
//
|
||||||
|
(hasVerificationPriceZone &&
|
||||||
|
isVerificationPriceZoneBearish &&
|
||||||
|
isVerificationPriceZoneValidForPeak)
|
||||||
|
: //
|
||||||
|
(hasDecisionPriceZone &&
|
||||||
|
isDecisionPriceZoneBullish &&
|
||||||
|
isDecisionPriceZoneValidForVale)
|
||||||
|
//
|
||||||
|
||
|
||||||
|
//
|
||||||
|
(hasAnalysePriceZone &&
|
||||||
|
isAnalysePriceZoneBullish &&
|
||||||
|
isAnalysePriceZoneValidForVale)
|
||||||
|
//
|
||||||
|
||
|
||||||
|
//
|
||||||
|
(hasVerificationPriceZone &&
|
||||||
|
isVerificationPriceZoneBullish &&
|
||||||
|
isVerificationPriceZoneValidForVale)
|
||||||
|
//
|
||||||
|
;
|
||||||
|
if (iHasGuard)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
X121SMCGuard iGuard;
|
||||||
|
|
||||||
|
//
|
||||||
|
iGuard.time = cTime;
|
||||||
|
iGuard.symbol = symbol;
|
||||||
|
iGuard.provider = provider;
|
||||||
|
iGuard.action = X_121_SMC_GUARD_ACTION_CLOSE;
|
||||||
|
|
||||||
|
//
|
||||||
|
AddGuard(
|
||||||
|
iGuard,
|
||||||
|
guards //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Close All ...
|
// Close All ...
|
||||||
@@ -699,13 +898,15 @@ bool DetectX121SMCGuards(
|
|||||||
//
|
//
|
||||||
MqlDateTime mDate;
|
MqlDateTime mDate;
|
||||||
bool hasDate = TimeCurrent(mDate);
|
bool hasDate = TimeCurrent(mDate);
|
||||||
if (hasDate) {
|
if (hasDate)
|
||||||
|
{
|
||||||
//
|
//
|
||||||
ENUM_X_WEEK_DAYS dayOfWeek = GetDayOfWeek();
|
ENUM_X_WEEK_DAYS dayOfWeek = GetDayOfWeek();
|
||||||
|
|
||||||
//
|
//
|
||||||
bool isWeekend = dayOfWeek == X_WEEK_DAY_FRIDAY;
|
bool isWeekend = dayOfWeek == X_WEEK_DAY_FRIDAY;
|
||||||
if (isWeekend && mDate.hour == 23 && mDate.min == 30) {
|
if (isWeekend && mDate.hour == 23 && mDate.min == 30)
|
||||||
|
{
|
||||||
//
|
//
|
||||||
X121SMCGuard guard;
|
X121SMCGuard guard;
|
||||||
|
|
||||||
@@ -797,6 +998,20 @@ bool DetectX121SMCGuards(
|
|||||||
hasTriggerBearishTrend ||
|
hasTriggerBearishTrend ||
|
||||||
!hasDecisionBullishTrend
|
!hasDecisionBullishTrend
|
||||||
//
|
//
|
||||||
|
// (hasAnalysePriceZone &&
|
||||||
|
// isAnalysePriceZoneBearish &&
|
||||||
|
// isAnalysePriceZoneValidForPeak &&
|
||||||
|
// (isAnalysePriceZoneUpperRejected ||
|
||||||
|
// isAnalysePriceZoneLowerBreakedDown))
|
||||||
|
// //
|
||||||
|
// ||
|
||||||
|
// //
|
||||||
|
// (hasVerificationPriceZone &&
|
||||||
|
// isVerificationPriceZoneBearish &&
|
||||||
|
// isVerificationPriceZoneValidForPeak &&
|
||||||
|
// (isVerificationPriceZoneUpperRejected ||
|
||||||
|
// isVerificationPriceZoneLowerBreakedDown))
|
||||||
|
//
|
||||||
;
|
;
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -839,6 +1054,20 @@ bool DetectX121SMCGuards(
|
|||||||
hasTriggerBullishTrend ||
|
hasTriggerBullishTrend ||
|
||||||
!hasDecisionBearishTrend
|
!hasDecisionBearishTrend
|
||||||
//
|
//
|
||||||
|
// (hasAnalysePriceZone &&
|
||||||
|
// isAnalysePriceZoneBullish &&
|
||||||
|
// isAnalysePriceZoneValidForVale &&
|
||||||
|
// (isAnalysePriceZoneLowerRejected ||
|
||||||
|
// isAnalysePriceZoneUpperBreakedUp))
|
||||||
|
// //
|
||||||
|
// ||
|
||||||
|
// //
|
||||||
|
// (hasVerificationPriceZone &&
|
||||||
|
// isVerificationPriceZoneBullish &&
|
||||||
|
// isVerificationPriceZoneValidForVale &&
|
||||||
|
// (isVerificationPriceZoneLowerRejected ||
|
||||||
|
// isVerificationPriceZoneUpperBreakedUp))
|
||||||
|
//
|
||||||
;
|
;
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -879,14 +1108,54 @@ bool DetectX121SMCGuards(
|
|||||||
if (hasLongs)
|
if (hasLongs)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
bool hasGuard =
|
bool hasConsolidationGuard =
|
||||||
//
|
|
||||||
(hasConsolidationZone &&
|
(hasConsolidationZone &&
|
||||||
isConsolidationZoneBreaked &&
|
isConsolidationZoneBreaked &&
|
||||||
isConsolidationZoneBreakedUp)
|
isConsolidationZoneBreakedUp);
|
||||||
|
|
||||||
|
//
|
||||||
|
bool hasDecisionPriceZoneGuard =
|
||||||
|
(hasDecisionPriceZone &&
|
||||||
|
isDecisionPriceZoneBullish &&
|
||||||
|
isDecisionPriceZoneValidForVale &&
|
||||||
|
isDecisionPriceZoneUpperBreakedUp);
|
||||||
|
|
||||||
|
//
|
||||||
|
bool hasAnalysePriceZoneGuard =
|
||||||
|
(hasAnalysePriceZone &&
|
||||||
|
isAnalysePriceZoneBullish &&
|
||||||
|
isAnalysePriceZoneValidForVale &&
|
||||||
|
isAnalysePriceZoneUpperBreakedUp);
|
||||||
|
|
||||||
|
//
|
||||||
|
bool hasVerificationPriceZoneGuard =
|
||||||
|
(hasVerificationPriceZone &&
|
||||||
|
isVerificationPriceZoneBullish &&
|
||||||
|
isVerificationPriceZoneValidForVale &&
|
||||||
|
isVerificationPriceZoneUpperBreakedUp);
|
||||||
|
|
||||||
|
//
|
||||||
|
bool hasGuard =
|
||||||
|
//
|
||||||
|
hasConsolidationGuard ||
|
||||||
|
hasDecisionPriceZoneGuard ||
|
||||||
|
hasAnalysePriceZoneGuard ||
|
||||||
|
hasVerificationPriceZoneGuard
|
||||||
//
|
//
|
||||||
;
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
double guardStop =
|
||||||
|
hasConsolidationGuard
|
||||||
|
? consolidationZoneLower
|
||||||
|
: hasDecisionPriceZoneGuard
|
||||||
|
? decisionPriceZoneLower
|
||||||
|
: hasAnalysePriceZoneGuard
|
||||||
|
? analysePriceZoneLower
|
||||||
|
: hasVerificationPriceZoneGuard
|
||||||
|
? verificationPriceZoneLower
|
||||||
|
: 0;
|
||||||
|
|
||||||
//
|
//
|
||||||
if (hasGuard)
|
if (hasGuard)
|
||||||
{
|
{
|
||||||
@@ -905,14 +1174,14 @@ bool DetectX121SMCGuards(
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Price Must Greater than Zone Lower ...
|
// Price Must Greater than Zone Lower ...
|
||||||
if (iPosition.price < consolidationZoneLower)
|
if (iPosition.price < guardStop)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Position Entry Must Lesser than Zone Lower ...
|
// Position Entry Must Lesser than Zone Lower ...
|
||||||
if (iPosition.entry > consolidationZoneLower)
|
if (iPosition.entry > guardStop)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -920,7 +1189,7 @@ bool DetectX121SMCGuards(
|
|||||||
//
|
//
|
||||||
// Position SL must be Zero or Lesser than Zone Lower ...
|
// Position SL must be Zero or Lesser than Zone Lower ...
|
||||||
if (iPosition.sl != 0 &&
|
if (iPosition.sl != 0 &&
|
||||||
iPosition.sl > consolidationZoneLower)
|
iPosition.sl > guardStop)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -938,7 +1207,7 @@ bool DetectX121SMCGuards(
|
|||||||
iGuard.ticket = iPosition.ticket;
|
iGuard.ticket = iPosition.ticket;
|
||||||
|
|
||||||
//
|
//
|
||||||
iGuard.sl = consolidationZoneLower;
|
iGuard.sl = guardStop;
|
||||||
|
|
||||||
//
|
//
|
||||||
AddGuard(
|
AddGuard(
|
||||||
@@ -953,14 +1222,54 @@ bool DetectX121SMCGuards(
|
|||||||
if (hasShorts)
|
if (hasShorts)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
bool hasGuard =
|
bool hasConsolidationGuard =
|
||||||
//
|
|
||||||
(hasConsolidationZone &&
|
(hasConsolidationZone &&
|
||||||
isConsolidationZoneBreaked &&
|
isConsolidationZoneBreaked &&
|
||||||
isConsolidationZoneBreakedDown)
|
isConsolidationZoneBreakedDown);
|
||||||
|
|
||||||
|
//
|
||||||
|
bool hasDecisionPriceZoneGuard =
|
||||||
|
(hasDecisionPriceZone &&
|
||||||
|
isDecisionPriceZoneBearish &&
|
||||||
|
isDecisionPriceZoneValidForPeak &&
|
||||||
|
isDecisionPriceZoneLowerBreakedDown);
|
||||||
|
|
||||||
|
//
|
||||||
|
bool hasAnalysePriceZoneGuard =
|
||||||
|
(hasAnalysePriceZone &&
|
||||||
|
isAnalysePriceZoneBearish &&
|
||||||
|
isAnalysePriceZoneValidForPeak &&
|
||||||
|
isAnalysePriceZoneLowerBreakedDown);
|
||||||
|
|
||||||
|
//
|
||||||
|
bool hasVerificationPriceZoneGuard =
|
||||||
|
(hasVerificationPriceZone &&
|
||||||
|
isVerificationPriceZoneBearish &&
|
||||||
|
isVerificationPriceZoneValidForPeak &&
|
||||||
|
isVerificationPriceZoneLowerBreakedDown);
|
||||||
|
|
||||||
|
//
|
||||||
|
bool hasGuard =
|
||||||
|
//
|
||||||
|
hasConsolidationGuard ||
|
||||||
|
hasDecisionPriceZoneGuard ||
|
||||||
|
hasAnalysePriceZoneGuard ||
|
||||||
|
hasVerificationPriceZoneGuard
|
||||||
//
|
//
|
||||||
;
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
double guardStop =
|
||||||
|
hasConsolidationGuard
|
||||||
|
? consolidationZoneUpper
|
||||||
|
: hasDecisionPriceZoneGuard
|
||||||
|
? decisionPriceZoneUpper
|
||||||
|
: hasAnalysePriceZoneGuard
|
||||||
|
? analysePriceZoneUpper
|
||||||
|
: hasVerificationPriceZoneGuard
|
||||||
|
? verificationPriceZoneUpper
|
||||||
|
: 0;
|
||||||
|
|
||||||
//
|
//
|
||||||
if (hasGuard)
|
if (hasGuard)
|
||||||
{
|
{
|
||||||
@@ -979,14 +1288,14 @@ bool DetectX121SMCGuards(
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Price Must Lesser than Zone Upper ...
|
// Price Must Lesser than Zone Upper ...
|
||||||
if (iPosition.price > consolidationZoneUpper)
|
if (iPosition.price > guardStop)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Position Entry Must Greater than Zone Upper ...
|
// Position Entry Must Greater than Zone Upper ...
|
||||||
if (iPosition.entry < consolidationZoneUpper)
|
if (iPosition.entry < guardStop)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -994,7 +1303,7 @@ bool DetectX121SMCGuards(
|
|||||||
//
|
//
|
||||||
// Position SL must be Zero or Greater than Zone Upper ...
|
// Position SL must be Zero or Greater than Zone Upper ...
|
||||||
if (iPosition.sl != 0 &&
|
if (iPosition.sl != 0 &&
|
||||||
iPosition.sl < consolidationZoneUpper)
|
iPosition.sl < guardStop)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -1012,7 +1321,7 @@ bool DetectX121SMCGuards(
|
|||||||
iGuard.ticket = iPosition.ticket;
|
iGuard.ticket = iPosition.ticket;
|
||||||
|
|
||||||
//
|
//
|
||||||
iGuard.sl = consolidationZoneUpper;
|
iGuard.sl = guardStop;
|
||||||
|
|
||||||
//
|
//
|
||||||
AddGuard(
|
AddGuard(
|
||||||
@@ -1025,22 +1334,183 @@ bool DetectX121SMCGuards(
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Trail Target ...
|
// Trail Target ...
|
||||||
// TODO: Implement Target Trail ...
|
|
||||||
|
|
||||||
//
|
//
|
||||||
if (hasLongs)
|
if (hasLongs)
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
bool hasAnalyseGuard =
|
||||||
|
//
|
||||||
|
(hasAnalysePriceZone &&
|
||||||
|
isAnalysePriceZoneValidForPeak &&
|
||||||
|
isAnalysePriceZoneUpperRejected)
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool hasVerificationGuard =
|
||||||
|
//
|
||||||
|
(hasVerificationPriceZone &&
|
||||||
|
isVerificationPriceZoneValidForPeak &&
|
||||||
|
isVerificationPriceZoneUpperRejected)
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool hasGuard =
|
||||||
|
//
|
||||||
|
hasAnalyseGuard ||
|
||||||
|
hasVerificationGuard
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
double guardTP =
|
||||||
|
hasAnalyseGuard
|
||||||
|
? analysePriceZoneUpper
|
||||||
|
: hasVerificationGuard
|
||||||
|
? verificationPriceZoneUpper
|
||||||
|
: 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
if (hasGuard)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
for (int i = 0; i < longsCount; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XPosition iPosition = ownLongPositions[i];
|
||||||
|
|
||||||
|
//
|
||||||
|
// Position Must Be In Profit ...
|
||||||
|
if (iPosition.profit <= 0)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
X121SMCGuard iGuard;
|
||||||
|
|
||||||
|
//
|
||||||
|
iGuard.time = cTime;
|
||||||
|
iGuard.symbol = symbol;
|
||||||
|
iGuard.provider = provider;
|
||||||
|
iGuard.action = X_121_SMC_GUARD_ACTION_TRAIL_TARGET;
|
||||||
|
|
||||||
|
//
|
||||||
|
iGuard.ticket = iPosition.ticket;
|
||||||
|
|
||||||
|
//
|
||||||
|
iGuard.tp = guardTP;
|
||||||
|
|
||||||
|
//
|
||||||
|
AddGuard(
|
||||||
|
iGuard,
|
||||||
|
guards //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
if (hasShorts)
|
if (hasShorts)
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
bool hasAnalyseGuard =
|
||||||
|
//
|
||||||
|
(hasAnalysePriceZone &&
|
||||||
|
isAnalysePriceZoneValidForVale &&
|
||||||
|
isAnalysePriceZoneLowerRejected)
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool hasVerificationGuard =
|
||||||
|
//
|
||||||
|
(hasVerificationPriceZone &&
|
||||||
|
isVerificationPriceZoneValidForVale &&
|
||||||
|
isVerificationPriceZoneLowerRejected)
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool hasGuard =
|
||||||
|
//
|
||||||
|
hasAnalyseGuard ||
|
||||||
|
hasVerificationGuard
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
double guardTP =
|
||||||
|
hasAnalyseGuard
|
||||||
|
? analysePriceZoneLower
|
||||||
|
: hasVerificationGuard
|
||||||
|
? verificationPriceZoneLower
|
||||||
|
: 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
if (hasGuard)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
for (int i = 0; i < shortsCount; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XPosition iPosition = ownShortPositions[i];
|
||||||
|
|
||||||
|
//
|
||||||
|
// Position Must Be In Profit ...
|
||||||
|
if (iPosition.profit <= 0)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
X121SMCGuard iGuard;
|
||||||
|
|
||||||
|
//
|
||||||
|
iGuard.time = cTime;
|
||||||
|
iGuard.symbol = symbol;
|
||||||
|
iGuard.provider = provider;
|
||||||
|
iGuard.action = X_121_SMC_GUARD_ACTION_TRAIL_TARGET;
|
||||||
|
|
||||||
|
//
|
||||||
|
iGuard.ticket = iPosition.ticket;
|
||||||
|
|
||||||
|
//
|
||||||
|
iGuard.tp = guardTP;
|
||||||
|
|
||||||
|
//
|
||||||
|
AddGuard(
|
||||||
|
iGuard,
|
||||||
|
guards //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Hedge ...
|
// Hedge ...
|
||||||
// TODO: Implement Hedge ...
|
// TODO: Implement Hedge ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// Release Arrays ...
|
||||||
|
ArrayFree(ownPositions);
|
||||||
|
ArrayFree(ownLongPositions);
|
||||||
|
ArrayFree(ownShortPositions);
|
||||||
|
ArrayFree(triggerPoiEvents);
|
||||||
|
ArrayFree(triggerCycleEvents);
|
||||||
|
ArrayFree(decisionPoiEvents);
|
||||||
|
ArrayFree(decisionCycleEvents);
|
||||||
|
ArrayFree(analysePoiEvents);
|
||||||
|
ArrayFree(analyseCycleEvents);
|
||||||
|
ArrayFree(verificationPoiEvents);
|
||||||
|
ArrayFree(verificationCycleEvents);
|
||||||
|
ArrayFree(consolidationPoiEvents);
|
||||||
|
ArrayFree(consolidationCycleEvents);
|
||||||
|
ArrayFree(visionPoiEvents);
|
||||||
|
ArrayFree(visionCycleEvents);
|
||||||
|
|
||||||
//
|
//
|
||||||
count = ArraySize(guards);
|
count = ArraySize(guards);
|
||||||
result = IsValidSize(count);
|
result = IsValidSize(count);
|
||||||
|
|||||||
@@ -823,6 +823,23 @@ bool DetectX121SMCXPZSiganlSetup(
|
|||||||
isBearish;
|
isBearish;
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
//
|
||||||
|
// Cleanup Arrays ...
|
||||||
|
ArrayFree(triggerPoiEvents);
|
||||||
|
ArrayFree(triggerCycleEvents);
|
||||||
|
ArrayFree(decisionPoiEvents);
|
||||||
|
ArrayFree(decisionCycleEvents);
|
||||||
|
ArrayFree(analysePoiEvents);
|
||||||
|
ArrayFree(analyseCycleEvents);
|
||||||
|
ArrayFree(verificationPoiEvents);
|
||||||
|
ArrayFree(verificationCycleEvents);
|
||||||
|
ArrayFree(consolidationPoiEvents);
|
||||||
|
ArrayFree(consolidationCycleEvents);
|
||||||
|
ArrayFree(visionPoiEvents);
|
||||||
|
ArrayFree(visionCycleEvents);
|
||||||
|
|
||||||
|
//
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -833,6 +850,21 @@ bool DetectX121SMCXPZSiganlSetup(
|
|||||||
? X_DIRECTION_BULLISH
|
? X_DIRECTION_BULLISH
|
||||||
: X_DIRECTION_BEARISH;
|
: X_DIRECTION_BEARISH;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Cleanup Arrays ...
|
||||||
|
ArrayFree(triggerPoiEvents);
|
||||||
|
ArrayFree(triggerCycleEvents);
|
||||||
|
ArrayFree(decisionPoiEvents);
|
||||||
|
ArrayFree(decisionCycleEvents);
|
||||||
|
ArrayFree(analysePoiEvents);
|
||||||
|
ArrayFree(analyseCycleEvents);
|
||||||
|
ArrayFree(verificationPoiEvents);
|
||||||
|
ArrayFree(verificationCycleEvents);
|
||||||
|
ArrayFree(consolidationPoiEvents);
|
||||||
|
ArrayFree(consolidationCycleEvents);
|
||||||
|
ArrayFree(visionPoiEvents);
|
||||||
|
ArrayFree(visionCycleEvents);
|
||||||
|
|
||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -1193,6 +1225,21 @@ bool DetectX121SMCXPZSiganlTrigger(
|
|||||||
conditions.Clean();
|
conditions.Clean();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Cleanup Arrays ...
|
||||||
|
ArrayFree(triggerPoiEvents);
|
||||||
|
ArrayFree(triggerCycleEvents);
|
||||||
|
ArrayFree(decisionPoiEvents);
|
||||||
|
ArrayFree(decisionCycleEvents);
|
||||||
|
ArrayFree(analysePoiEvents);
|
||||||
|
ArrayFree(analyseCycleEvents);
|
||||||
|
ArrayFree(verificationPoiEvents);
|
||||||
|
ArrayFree(verificationCycleEvents);
|
||||||
|
ArrayFree(consolidationPoiEvents);
|
||||||
|
ArrayFree(consolidationCycleEvents);
|
||||||
|
ArrayFree(visionPoiEvents);
|
||||||
|
ArrayFree(visionCycleEvents);
|
||||||
|
|
||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -1488,6 +1535,21 @@ bool DetectX121SMCXPZSiganlTrigger(
|
|||||||
? X_POSITION_TYPE_LONG
|
? X_POSITION_TYPE_LONG
|
||||||
: X_POSITION_TYPE_SHORT;
|
: X_POSITION_TYPE_SHORT;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Cleanup Arrays ...
|
||||||
|
ArrayFree(triggerPoiEvents);
|
||||||
|
ArrayFree(triggerCycleEvents);
|
||||||
|
ArrayFree(decisionPoiEvents);
|
||||||
|
ArrayFree(decisionCycleEvents);
|
||||||
|
ArrayFree(analysePoiEvents);
|
||||||
|
ArrayFree(analyseCycleEvents);
|
||||||
|
ArrayFree(verificationPoiEvents);
|
||||||
|
ArrayFree(verificationCycleEvents);
|
||||||
|
ArrayFree(consolidationPoiEvents);
|
||||||
|
ArrayFree(consolidationCycleEvents);
|
||||||
|
ArrayFree(visionPoiEvents);
|
||||||
|
ArrayFree(visionCycleEvents);
|
||||||
|
|
||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -883,6 +883,22 @@ bool DetectX121SMCXSTRPVSiganlSetup(
|
|||||||
isBearish;
|
isBearish;
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
// Cleanup Arrays ...
|
||||||
|
ArrayFree(triggerPoiEvents);
|
||||||
|
ArrayFree(triggerCycleEvents);
|
||||||
|
ArrayFree(decisionPoiEvents);
|
||||||
|
ArrayFree(decisionCycleEvents);
|
||||||
|
ArrayFree(analysePoiEvents);
|
||||||
|
ArrayFree(analyseCycleEvents);
|
||||||
|
ArrayFree(verificationPoiEvents);
|
||||||
|
ArrayFree(verificationCycleEvents);
|
||||||
|
ArrayFree(consolidationPoiEvents);
|
||||||
|
ArrayFree(consolidationCycleEvents);
|
||||||
|
ArrayFree(visionPoiEvents);
|
||||||
|
ArrayFree(visionCycleEvents);
|
||||||
|
|
||||||
|
//
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -893,6 +909,21 @@ bool DetectX121SMCXSTRPVSiganlSetup(
|
|||||||
? X_DIRECTION_BULLISH
|
? X_DIRECTION_BULLISH
|
||||||
: X_DIRECTION_BEARISH;
|
: X_DIRECTION_BEARISH;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Cleanup Arrays ...
|
||||||
|
ArrayFree(triggerPoiEvents);
|
||||||
|
ArrayFree(triggerCycleEvents);
|
||||||
|
ArrayFree(decisionPoiEvents);
|
||||||
|
ArrayFree(decisionCycleEvents);
|
||||||
|
ArrayFree(analysePoiEvents);
|
||||||
|
ArrayFree(analyseCycleEvents);
|
||||||
|
ArrayFree(verificationPoiEvents);
|
||||||
|
ArrayFree(verificationCycleEvents);
|
||||||
|
ArrayFree(consolidationPoiEvents);
|
||||||
|
ArrayFree(consolidationCycleEvents);
|
||||||
|
ArrayFree(visionPoiEvents);
|
||||||
|
ArrayFree(visionCycleEvents);
|
||||||
|
|
||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -1253,6 +1284,21 @@ bool DetectX121SMCXSTRPVSiganlTrigger(
|
|||||||
conditions.Clean();
|
conditions.Clean();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Cleanup Arrays ...
|
||||||
|
ArrayFree(triggerPoiEvents);
|
||||||
|
ArrayFree(triggerCycleEvents);
|
||||||
|
ArrayFree(decisionPoiEvents);
|
||||||
|
ArrayFree(decisionCycleEvents);
|
||||||
|
ArrayFree(analysePoiEvents);
|
||||||
|
ArrayFree(analyseCycleEvents);
|
||||||
|
ArrayFree(verificationPoiEvents);
|
||||||
|
ArrayFree(verificationCycleEvents);
|
||||||
|
ArrayFree(consolidationPoiEvents);
|
||||||
|
ArrayFree(consolidationCycleEvents);
|
||||||
|
ArrayFree(visionPoiEvents);
|
||||||
|
ArrayFree(visionCycleEvents);
|
||||||
|
|
||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -1548,6 +1594,21 @@ bool DetectX121SMCXSTRPVSiganlTrigger(
|
|||||||
? X_POSITION_TYPE_LONG
|
? X_POSITION_TYPE_LONG
|
||||||
: X_POSITION_TYPE_SHORT;
|
: X_POSITION_TYPE_SHORT;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Cleanup Arrays ...
|
||||||
|
ArrayFree(triggerPoiEvents);
|
||||||
|
ArrayFree(triggerCycleEvents);
|
||||||
|
ArrayFree(decisionPoiEvents);
|
||||||
|
ArrayFree(decisionCycleEvents);
|
||||||
|
ArrayFree(analysePoiEvents);
|
||||||
|
ArrayFree(analyseCycleEvents);
|
||||||
|
ArrayFree(verificationPoiEvents);
|
||||||
|
ArrayFree(verificationCycleEvents);
|
||||||
|
ArrayFree(consolidationPoiEvents);
|
||||||
|
ArrayFree(consolidationCycleEvents);
|
||||||
|
ArrayFree(visionPoiEvents);
|
||||||
|
ArrayFree(visionCycleEvents);
|
||||||
|
|
||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,6 @@
|
|||||||
#include "../Classes/x-121.smc.market.cycle.helper.class.mq5"
|
#include "../Classes/x-121.smc.market.cycle.helper.class.mq5"
|
||||||
|
|
||||||
//
|
//
|
||||||
#include "../Signals/x-121.smc.test.signal.lib.mq5"
|
|
||||||
#include "../Signals/x-121.smc.xpz.signal.lib.mq5"
|
#include "../Signals/x-121.smc.xpz.signal.lib.mq5"
|
||||||
#include "../Signals/x-121.smc.xstrpv.signal.lib.mq5"
|
#include "../Signals/x-121.smc.xstrpv.signal.lib.mq5"
|
||||||
|
|
||||||
@@ -43,7 +42,6 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
|||||||
public:
|
public:
|
||||||
//
|
//
|
||||||
// Props ...
|
// Props ...
|
||||||
bool useTestSignal;
|
|
||||||
bool useXPZSignal;
|
bool useXPZSignal;
|
||||||
bool useXSTRPVSignal;
|
bool useXSTRPVSignal;
|
||||||
|
|
||||||
@@ -64,6 +62,10 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
|||||||
// Deconstructur ...
|
// Deconstructur ...
|
||||||
void ~XCX121SMCStrategy()
|
void ~XCX121SMCStrategy()
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
Destroy();
|
||||||
|
ArrayFree(mXPZConditionsCollection);
|
||||||
|
ArrayFree(mXSTRPVConditionsCollection);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -188,19 +190,9 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
|||||||
bool hasSignal = false;
|
bool hasSignal = false;
|
||||||
|
|
||||||
//
|
//
|
||||||
bool hasTestSignal = false;
|
|
||||||
bool hasXPZSignal = false;
|
bool hasXPZSignal = false;
|
||||||
bool hasXSTRPVSignal = false;
|
bool hasXSTRPVSignal = false;
|
||||||
|
|
||||||
//
|
|
||||||
// Test Signal ...
|
|
||||||
if (useTestSignal && !hasSignal)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
hasTestSignal = DetectTestSignal(conditions);
|
|
||||||
hasSignal = hasTestSignal;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// XOBGPV Signal ...
|
// XOBGPV Signal ...
|
||||||
if (useXPZSignal && !hasSignal)
|
if (useXPZSignal && !hasSignal)
|
||||||
@@ -374,12 +366,6 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// XTEST Guard Detection ...
|
|
||||||
if (useTestSignal)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// XSTRPV Guard Detection ...
|
// XSTRPV Guard Detection ...
|
||||||
if (useXSTRPVSignal)
|
if (useXSTRPVSignal)
|
||||||
@@ -452,122 +438,6 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
|||||||
//
|
//
|
||||||
// Signalling Functions ...
|
// Signalling Functions ...
|
||||||
|
|
||||||
//
|
|
||||||
// Test Signal ...
|
|
||||||
X121SMCStrategyTestSignalConditions mTestConditions;
|
|
||||||
bool DetectTestSignal(
|
|
||||||
X121SMCStrategyConditions &conditions //
|
|
||||||
)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
bool result = false;
|
|
||||||
|
|
||||||
//
|
|
||||||
bool isBullish = false;
|
|
||||||
bool isBearish = false;
|
|
||||||
|
|
||||||
//
|
|
||||||
string symbol = GetSymbol();
|
|
||||||
ENUM_TIMEFRAMES period = GetPeriod();
|
|
||||||
|
|
||||||
//
|
|
||||||
datetime cTime = TimeCurrent();
|
|
||||||
|
|
||||||
//
|
|
||||||
ENUM_X_121_SMC_PROVIDERS provider = X_121_SMC_PROVIDER_XTEST;
|
|
||||||
string providerStr = ToString(provider);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Detect Setup Conditions ...
|
|
||||||
datetime setupTime = mTestConditions.setupTime;
|
|
||||||
bool isSetuped = mTestConditions.IsSetuped();
|
|
||||||
ENUM_X_DIRECTION setupDir = mTestConditions.dir;
|
|
||||||
if (!isSetuped)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// Detect Signal Setup ...
|
|
||||||
isSetuped = DetectX121SMCTestSiganlSetup(
|
|
||||||
symbol,
|
|
||||||
period,
|
|
||||||
mTestConditions,
|
|
||||||
mTriggerCycleHelper,
|
|
||||||
mDecisionCycleHelper,
|
|
||||||
mAnalyseCycleHelper,
|
|
||||||
mVerificationCycleHelper,
|
|
||||||
mConsolidationCycleHelper,
|
|
||||||
mVisionCycleHelper //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
setupDir = mTestConditions.dir;
|
|
||||||
setupTime = mTestConditions.setupTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
result = isSetuped;
|
|
||||||
if (!result)
|
|
||||||
{
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Detect Trigger Conditions ...
|
|
||||||
bool canTrigger = mTestConditions.CanTrigger();
|
|
||||||
datetime triggerTime = mTestConditions.triggerTime;
|
|
||||||
if (!canTrigger)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// Detect Signal Trigger ...
|
|
||||||
canTrigger = DetectX121SMCTestSiganlTrigger(
|
|
||||||
mTestConditions,
|
|
||||||
symbol,
|
|
||||||
period,
|
|
||||||
mTriggerCycleHelper,
|
|
||||||
mDecisionCycleHelper,
|
|
||||||
mAnalyseCycleHelper,
|
|
||||||
mVerificationCycleHelper,
|
|
||||||
mConsolidationCycleHelper,
|
|
||||||
mVisionCycleHelper //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
result = canTrigger;
|
|
||||||
if (!result)
|
|
||||||
{
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
triggerTime = mTestConditions.triggerTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Check Signal Direction ...
|
|
||||||
|
|
||||||
//
|
|
||||||
isBullish = IsBullish(setupDir);
|
|
||||||
isBearish = IsBearish(setupDir);
|
|
||||||
result = isBullish ||
|
|
||||||
isBearish;
|
|
||||||
if (!result)
|
|
||||||
{
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Issues Signal on Conditions ...
|
|
||||||
conditions.signalDir = setupDir;
|
|
||||||
conditions.provider = providerStr;
|
|
||||||
conditions.sl = mTestConditions.sl;
|
|
||||||
conditions.target = mTestConditions.target;
|
|
||||||
|
|
||||||
//
|
|
||||||
mTestConditions.Clean();
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// XSTRPV Signal ...
|
// XSTRPV Signal ...
|
||||||
bool DetectXSTRPVSignal(
|
bool DetectXSTRPVSignal(
|
||||||
@@ -1035,7 +905,6 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
|||||||
void InitialHelpers()
|
void InitialHelpers()
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
useTestSignal = false;
|
|
||||||
useXPZSignal = true;
|
useXPZSignal = true;
|
||||||
useXSTRPVSignal = true;
|
useXSTRPVSignal = true;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user