cleanup unused collections and also disable drawings for memory improvement ...
This commit is contained in:
@@ -425,45 +425,6 @@ class XCX121SMCBaseStrategy : public XCBaseAlert
|
|||||||
mLastTick = cTick;
|
mLastTick = cTick;
|
||||||
SaveTickData();
|
SaveTickData();
|
||||||
|
|
||||||
//
|
|
||||||
// Update POIs ...
|
|
||||||
|
|
||||||
//
|
|
||||||
// Trigger ...
|
|
||||||
ENUM_XPOI_EVENTS mTriggerEvents[];
|
|
||||||
mTriggerDetector.Update(mTriggerEvents);
|
|
||||||
mTriggerDetector.GetState(mTriggerState);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Decision ...
|
|
||||||
ENUM_XPOI_EVENTS mDecisionEvents[];
|
|
||||||
mDecisionDetector.Update(mDecisionEvents);
|
|
||||||
mDecisionDetector.GetState(mDecisionState);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Analyse ...
|
|
||||||
ENUM_XPOI_EVENTS mAnalyseEvents[];
|
|
||||||
mAnalyseDetector.Update(mAnalyseEvents);
|
|
||||||
mAnalyseDetector.GetState(mAnalyseState);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Verification ...
|
|
||||||
ENUM_XPOI_EVENTS mVerificationEvents[];
|
|
||||||
mVerificationDetector.Update(mVerificationEvents);
|
|
||||||
mVerificationDetector.GetState(mVerificationState);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Consolidation ...
|
|
||||||
ENUM_XPOI_EVENTS mConsolidationEvents[];
|
|
||||||
mConsolidationDetector.Update(mConsolidationEvents);
|
|
||||||
mConsolidationDetector.GetState(mConsolidationState);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Vision ...
|
|
||||||
ENUM_XPOI_EVENTS mVisionEvents[];
|
|
||||||
mVisionDetector.Update(mVisionEvents);
|
|
||||||
mVisionDetector.GetState(mVisionState);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check Current Processing Tick has Signal or not ...
|
// Check Current Processing Tick has Signal or not ...
|
||||||
XSignal signal;
|
XSignal signal;
|
||||||
@@ -548,23 +509,6 @@ class XCX121SMCBaseStrategy : public XCBaseAlert
|
|||||||
//
|
//
|
||||||
// Props ...
|
// Props ...
|
||||||
|
|
||||||
//
|
|
||||||
// Point Of Interests ...
|
|
||||||
XCPOIDetector *mVisionDetector;
|
|
||||||
XCPOIDetector *mConsolidationDetector;
|
|
||||||
XCPOIDetector *mVerificationDetector;
|
|
||||||
XCPOIDetector *mAnalyseDetector;
|
|
||||||
XCPOIDetector *mDecisionDetector;
|
|
||||||
XCPOIDetector *mTriggerDetector;
|
|
||||||
|
|
||||||
//
|
|
||||||
XPOIState mVisionState;
|
|
||||||
XPOIState mConsolidationState;
|
|
||||||
XPOIState mVerificationState;
|
|
||||||
XPOIState mAnalyseState;
|
|
||||||
XPOIState mDecisionState;
|
|
||||||
XPOIState mTriggerState;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
XCPOIDrawer *mPOIDrawer; // POI Drawer Class ...
|
XCPOIDrawer *mPOIDrawer; // POI Drawer Class ...
|
||||||
CArrayObj mDrawnObjects;
|
CArrayObj mDrawnObjects;
|
||||||
@@ -924,66 +868,6 @@ class XCX121SMCBaseStrategy : public XCBaseAlert
|
|||||||
period //
|
period //
|
||||||
);
|
);
|
||||||
|
|
||||||
//
|
|
||||||
// Initialize POIs ...
|
|
||||||
|
|
||||||
//
|
|
||||||
int poiRequired = 40;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Trigger ...
|
|
||||||
mTriggerDetector = new XCPOIDetector(
|
|
||||||
symbol,
|
|
||||||
PERIOD_M1 //
|
|
||||||
);
|
|
||||||
mTriggerDetector.MaxNumberOfRequiredPOIs(poiRequired);
|
|
||||||
mTriggerDetector.Init();
|
|
||||||
|
|
||||||
//
|
|
||||||
// Decision ...
|
|
||||||
mDecisionDetector = new XCPOIDetector(
|
|
||||||
symbol,
|
|
||||||
PERIOD_M5 //
|
|
||||||
);
|
|
||||||
mDecisionDetector.MaxNumberOfRequiredPOIs(poiRequired);
|
|
||||||
mDecisionDetector.Init();
|
|
||||||
|
|
||||||
//
|
|
||||||
// Analyse ...
|
|
||||||
mAnalyseDetector = new XCPOIDetector(
|
|
||||||
symbol,
|
|
||||||
PERIOD_M15 //
|
|
||||||
);
|
|
||||||
mAnalyseDetector.MaxNumberOfRequiredPOIs(poiRequired);
|
|
||||||
mAnalyseDetector.Init();
|
|
||||||
|
|
||||||
//
|
|
||||||
// Verification ...
|
|
||||||
mVerificationDetector = new XCPOIDetector(
|
|
||||||
symbol,
|
|
||||||
PERIOD_M30 //
|
|
||||||
);
|
|
||||||
mVerificationDetector.MaxNumberOfRequiredPOIs(poiRequired);
|
|
||||||
mVerificationDetector.Init();
|
|
||||||
|
|
||||||
//
|
|
||||||
// Consolidation ...
|
|
||||||
mConsolidationDetector = new XCPOIDetector(
|
|
||||||
symbol,
|
|
||||||
PERIOD_H1 //
|
|
||||||
);
|
|
||||||
mConsolidationDetector.MaxNumberOfRequiredPOIs(poiRequired);
|
|
||||||
mConsolidationDetector.Init();
|
|
||||||
|
|
||||||
//
|
|
||||||
// Vision ...
|
|
||||||
mVisionDetector = new XCPOIDetector(
|
|
||||||
symbol,
|
|
||||||
PERIOD_H4 //
|
|
||||||
);
|
|
||||||
mVisionDetector.MaxNumberOfRequiredPOIs(poiRequired);
|
|
||||||
mVisionDetector.Init();
|
|
||||||
|
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -992,14 +876,6 @@ class XCX121SMCBaseStrategy : public XCBaseAlert
|
|||||||
*/
|
*/
|
||||||
void DeInit()
|
void DeInit()
|
||||||
{
|
{
|
||||||
//
|
|
||||||
delete mVisionDetector;
|
|
||||||
delete mConsolidationDetector;
|
|
||||||
delete mVerificationDetector;
|
|
||||||
delete mAnalyseDetector;
|
|
||||||
delete mDecisionDetector;
|
|
||||||
delete mTriggerDetector;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
delete mPOIDrawer;
|
delete mPOIDrawer;
|
||||||
|
|
||||||
|
|||||||
@@ -57,27 +57,6 @@ enum ENUM_X_121_SMC_PROVIDERS
|
|||||||
X_121_SMC_PROVIDER_XPVSUPDEM,
|
X_121_SMC_PROVIDER_XPVSUPDEM,
|
||||||
};
|
};
|
||||||
|
|
||||||
//
|
|
||||||
// X121 SL Method ...
|
|
||||||
enum ENUM_X_121_SMC_SL_TYPES
|
|
||||||
{
|
|
||||||
X_121_SMC_SL_TYPE_NONE,
|
|
||||||
X_121_SMC_SL_TYPE_LAST_SAR_CHANGED_BAR,
|
|
||||||
X_121_SMC_SL_TYPE_CURRENT_SAR_BOX,
|
|
||||||
X_121_SMC_SL_TYPE_LAST_DIRECTIONAL_SAR,
|
|
||||||
X_121_SMC_SL_TYPE_CURRENT_SAR,
|
|
||||||
X_121_SMC_SL_TYPE_DON_CLOSE_BOX,
|
|
||||||
X_121_SMC_SL_TYPE_FIBO_LEVEL_1_5,
|
|
||||||
X_121_SMC_SL_TYPE_FIBO_LEVEL_3,
|
|
||||||
X_121_SMC_SL_TYPE_VWAP_FAST,
|
|
||||||
X_121_SMC_SL_TYPE_VWAP_MID,
|
|
||||||
X_121_SMC_SL_TYPE_VWAP_SLOW,
|
|
||||||
X_121_SMC_SL_TYPE_SWING,
|
|
||||||
X_121_SMC_SL_TYPE_MOMENTUM,
|
|
||||||
X_121_SMC_SL_TYPE_REJECTION,
|
|
||||||
X_121_SMC_SL_TYPE_TENKAN_SEN,
|
|
||||||
};
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Each Market Cycle (Time Frame) Conditions
|
// Each Market Cycle (Time Frame) Conditions
|
||||||
// Model as this Structure ...
|
// Model as this Structure ...
|
||||||
@@ -279,15 +258,6 @@ struct X121SMCStrategyConditions
|
|||||||
ENUM_TIMEFRAMES period;
|
ENUM_TIMEFRAMES period;
|
||||||
datetime time;
|
datetime time;
|
||||||
|
|
||||||
//
|
|
||||||
// Cycles Conditions here ...
|
|
||||||
X121SMCCycleConditions triggerConditions;
|
|
||||||
X121SMCCycleConditions decisionConditions;
|
|
||||||
X121SMCCycleConditions analyseConditions;
|
|
||||||
X121SMCCycleConditions verificationConditions;
|
|
||||||
X121SMCCycleConditions consolidationConditions;
|
|
||||||
X121SMCCycleConditions visionConditions;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
double sl;
|
double sl;
|
||||||
double tp;
|
double tp;
|
||||||
@@ -323,14 +293,6 @@ struct X121SMCStrategyConditions
|
|||||||
provider = NULL;
|
provider = NULL;
|
||||||
signalDir = X_DIRECTION_NONE;
|
signalDir = X_DIRECTION_NONE;
|
||||||
marketStructureDir = X_DIRECTION_NONE;
|
marketStructureDir = X_DIRECTION_NONE;
|
||||||
|
|
||||||
//
|
|
||||||
triggerConditions.Clean();
|
|
||||||
decisionConditions.Clean();
|
|
||||||
analyseConditions.Clean();
|
|
||||||
verificationConditions.Clean();
|
|
||||||
consolidationConditions.Clean();
|
|
||||||
visionConditions.Clean();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -974,19 +974,27 @@ bool DetectX121SMCXTWPVSiganlSetup(
|
|||||||
|
|
||||||
//
|
//
|
||||||
int condition2MinPVDiffPoint = 30;
|
int condition2MinPVDiffPoint = 30;
|
||||||
bool isPeakDiffPointPassed = analysePeakDiff >= (condition2MinPVDiffPoint * points);
|
bool isAnalysePeakDiffPointPassed = analysePeakDiff >= (condition2MinPVDiffPoint * points);
|
||||||
bool isValeDiffPointPassed = analyseValeDiff >= (condition2MinPVDiffPoint * points);
|
bool isAnalyseValeDiffPointPassed = analyseValeDiff >= (condition2MinPVDiffPoint * points);
|
||||||
|
|
||||||
//
|
//
|
||||||
// DONCHAIN Conditions ...
|
// DONCHAIN Conditions ...
|
||||||
|
|
||||||
// //
|
//
|
||||||
// double analyseDonCloseUpper = analyseConditions.x121Conditions.donCloseUpperBuffer[1];
|
double analyseDonOpenUpper = analyseConditions.x121Conditions.donOpenUpperBuffer[1];
|
||||||
// double analyseDonCloseLower = analyseConditions.x121Conditions.donCloseLowerBuffer[1];
|
double analyseDonOpenLower = analyseConditions.x121Conditions.donOpenLowerBuffer[1];
|
||||||
|
|
||||||
// //
|
//
|
||||||
// double analyseonOpenUpper = analyseConditions.x121Conditions.donOpenUpperBuffer[1];
|
double analyseDonHighUpper = analyseConditions.x121Conditions.donHighUpperBuffer[1];
|
||||||
// double analyseonOpenLower = analyseConditions.x121Conditions.donOpenLowerBuffer[1];
|
double analyseDonHighLower = analyseConditions.x121Conditions.donHighLowerBuffer[1];
|
||||||
|
|
||||||
|
//
|
||||||
|
double analyseDonCloseUpper = analyseConditions.x121Conditions.donCloseUpperBuffer[1];
|
||||||
|
double analyseDonCloseLower = analyseConditions.x121Conditions.donCloseLowerBuffer[1];
|
||||||
|
|
||||||
|
//
|
||||||
|
double analyseDonLowUpper = analyseConditions.x121Conditions.donLowUpperBuffer[1];
|
||||||
|
double analyseDonLowLower = analyseConditions.x121Conditions.donLowLowerBuffer[1];
|
||||||
|
|
||||||
//
|
//
|
||||||
// OPEN ...
|
// OPEN ...
|
||||||
@@ -1136,7 +1144,7 @@ bool DetectX121SMCXTWPVSiganlSetup(
|
|||||||
// Bullish Conditions 1 ...
|
// Bullish Conditions 1 ...
|
||||||
bool bullishConditions1 =
|
bool bullishConditions1 =
|
||||||
//
|
//
|
||||||
// false
|
// false &&
|
||||||
hasBullishTrend &&
|
hasBullishTrend &&
|
||||||
isBullishFiboPassed &&
|
isBullishFiboPassed &&
|
||||||
analyseCBar.IsBullish() &&
|
analyseCBar.IsBullish() &&
|
||||||
@@ -1157,7 +1165,7 @@ bool DetectX121SMCXTWPVSiganlSetup(
|
|||||||
// Bearish Conditions 1 ...
|
// Bearish Conditions 1 ...
|
||||||
bool bearishConditions1 =
|
bool bearishConditions1 =
|
||||||
//
|
//
|
||||||
// false
|
// false &&
|
||||||
hasBearishTrend &&
|
hasBearishTrend &&
|
||||||
isBearishFiboPassed &&
|
isBearishFiboPassed &&
|
||||||
analyseCBar.IsBearish() &&
|
analyseCBar.IsBearish() &&
|
||||||
@@ -1181,11 +1189,11 @@ bool DetectX121SMCXTWPVSiganlSetup(
|
|||||||
// Bullish Conditions 2 ...
|
// Bullish Conditions 2 ...
|
||||||
bool bullishConditions2 =
|
bool bullishConditions2 =
|
||||||
//
|
//
|
||||||
false
|
false &&
|
||||||
// hasBullishTrend &&
|
hasBullishTrend &&
|
||||||
// isNewValeOverLast &&
|
isNewAnalyseValeOverLast &&
|
||||||
// donCloseLower > vale &&
|
isAnalyseValeDiffPointPassed &&
|
||||||
// isValeDiffPointPassed
|
analyseDonCloseLower > analyseVale
|
||||||
//
|
//
|
||||||
;
|
;
|
||||||
if (bullishConditions2)
|
if (bullishConditions2)
|
||||||
@@ -1199,11 +1207,11 @@ bool DetectX121SMCXTWPVSiganlSetup(
|
|||||||
// Bearish Conditions 2 ...
|
// Bearish Conditions 2 ...
|
||||||
bool bearishConditions2 =
|
bool bearishConditions2 =
|
||||||
//
|
//
|
||||||
false
|
false &&
|
||||||
// hasBearishTrend &&
|
hasBearishTrend &&
|
||||||
// isNewPeakUnderLast &&
|
isNewAnalysePeakUnderLast &&
|
||||||
// donCloseUpper > peak &&
|
isAnalysePeakDiffPointPassed &&
|
||||||
// isPeakDiffPointPassed
|
analyseDonCloseUpper > analysePeak
|
||||||
//
|
//
|
||||||
;
|
;
|
||||||
if (bearishConditions2)
|
if (bearishConditions2)
|
||||||
|
|||||||
@@ -317,38 +317,11 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
|||||||
// Props ...
|
// Props ...
|
||||||
|
|
||||||
//
|
//
|
||||||
// Trigger Order Flow ...
|
|
||||||
XPVPivot mOrderFlow[];
|
|
||||||
ENUM_X_DIRECTION mOrderFlowDir;
|
|
||||||
|
|
||||||
//
|
|
||||||
ENUM_XPOI_EVENTS mTriggerPOIEvents[];
|
|
||||||
ENUM_X_CYCLE_EVENTS mTriggerCycleEvents[];
|
|
||||||
XC121SMCCycleHelper *mTriggerCycleHelper;
|
XC121SMCCycleHelper *mTriggerCycleHelper;
|
||||||
|
|
||||||
//
|
|
||||||
ENUM_XPOI_EVENTS mDecisionPOIEvents[];
|
|
||||||
ENUM_X_CYCLE_EVENTS mDecisionCycleEvents[];
|
|
||||||
XC121SMCCycleHelper *mDecisionCycleHelper;
|
XC121SMCCycleHelper *mDecisionCycleHelper;
|
||||||
|
|
||||||
//
|
|
||||||
ENUM_XPOI_EVENTS mAnalysePOIEvents[];
|
|
||||||
ENUM_X_CYCLE_EVENTS mAnalyseCycleEvents[];
|
|
||||||
XC121SMCCycleHelper *mAnalyseCycleHelper;
|
XC121SMCCycleHelper *mAnalyseCycleHelper;
|
||||||
|
|
||||||
//
|
|
||||||
ENUM_XPOI_EVENTS mVerificationPOIEvents[];
|
|
||||||
ENUM_X_CYCLE_EVENTS mVerificationCycleEvents[];
|
|
||||||
XC121SMCCycleHelper *mVerificationCycleHelper;
|
XC121SMCCycleHelper *mVerificationCycleHelper;
|
||||||
|
|
||||||
//
|
|
||||||
ENUM_XPOI_EVENTS mConsolidationPOIEvents[];
|
|
||||||
ENUM_X_CYCLE_EVENTS mConsolidationCycleEvents[];
|
|
||||||
XC121SMCCycleHelper *mConsolidationCycleHelper;
|
XC121SMCCycleHelper *mConsolidationCycleHelper;
|
||||||
|
|
||||||
//
|
|
||||||
ENUM_XPOI_EVENTS mVisionPOIEvents[];
|
|
||||||
ENUM_X_CYCLE_EVENTS mVisionCycleEvents[];
|
|
||||||
XC121SMCCycleHelper *mVisionCycleHelper;
|
XC121SMCCycleHelper *mVisionCycleHelper;
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -386,114 +359,6 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
|||||||
conditions.symbol = symbol;
|
conditions.symbol = symbol;
|
||||||
conditions.period = period;
|
conditions.period = period;
|
||||||
|
|
||||||
//
|
|
||||||
int conditionsLoopback = 7;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Fill Cycles Conditions ...
|
|
||||||
|
|
||||||
//
|
|
||||||
// Trigger ...
|
|
||||||
result = mTriggerCycleHelper.GetConditions(
|
|
||||||
mTriggerCycleEvents,
|
|
||||||
mTriggerPOIEvents,
|
|
||||||
conditions.triggerConditions,
|
|
||||||
zIndex,
|
|
||||||
conditionsLoopback //
|
|
||||||
);
|
|
||||||
if (!result)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
conditions.Clean();
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
conditions.triggerConditions.state = mTriggerState;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Decision ...
|
|
||||||
result = mDecisionCycleHelper.GetConditions(
|
|
||||||
mDecisionCycleEvents,
|
|
||||||
mDecisionPOIEvents,
|
|
||||||
conditions.decisionConditions,
|
|
||||||
zIndex,
|
|
||||||
conditionsLoopback //
|
|
||||||
);
|
|
||||||
if (!result)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
conditions.Clean();
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
conditions.decisionConditions.state = mDecisionState;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Analyse ...
|
|
||||||
result = mAnalyseCycleHelper.GetConditions(
|
|
||||||
mAnalyseCycleEvents,
|
|
||||||
mAnalysePOIEvents,
|
|
||||||
conditions.analyseConditions,
|
|
||||||
zIndex,
|
|
||||||
conditionsLoopback //
|
|
||||||
);
|
|
||||||
if (!result)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
conditions.Clean();
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
conditions.analyseConditions.state = mAnalyseState;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Verification ...
|
|
||||||
result = mVerificationCycleHelper.GetConditions(
|
|
||||||
mVerificationCycleEvents,
|
|
||||||
mVerificationPOIEvents,
|
|
||||||
conditions.verificationConditions,
|
|
||||||
zIndex,
|
|
||||||
conditionsLoopback //
|
|
||||||
);
|
|
||||||
if (!result)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
conditions.Clean();
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
conditions.verificationConditions.state = mVerificationState;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Consolidation ...
|
|
||||||
result = mConsolidationCycleHelper.GetConditions(
|
|
||||||
mConsolidationCycleEvents,
|
|
||||||
mConsolidationPOIEvents,
|
|
||||||
conditions.consolidationConditions,
|
|
||||||
zIndex,
|
|
||||||
conditionsLoopback //
|
|
||||||
);
|
|
||||||
if (!result)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
conditions.Clean();
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
conditions.consolidationConditions.state = mConsolidationState;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Vision ...
|
|
||||||
result = mVisionCycleHelper.GetConditions(
|
|
||||||
mVisionCycleEvents,
|
|
||||||
mVisionPOIEvents,
|
|
||||||
conditions.visionConditions,
|
|
||||||
zIndex,
|
|
||||||
conditionsLoopback //
|
|
||||||
);
|
|
||||||
if (!result)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
conditions.Clean();
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
conditions.visionConditions.state = mVisionState;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -552,56 +417,6 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
|||||||
setupTime = mTestConditions.setupTime;
|
setupTime = mTestConditions.setupTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ClearDraws();
|
|
||||||
// ENUM_X_DIRECTION activeZoneDir;
|
|
||||||
// bool hasTicksZone = mTestConditions.HasTicksZone();
|
|
||||||
// bool hasActiveZone = mTestConditions.HasActiveZone(activeZoneDir);
|
|
||||||
// if (hasActiveZone)
|
|
||||||
// {
|
|
||||||
// //
|
|
||||||
// if (IsBullish(activeZoneDir))
|
|
||||||
// {
|
|
||||||
// //
|
|
||||||
// mTestConditions.activeDemandZone.To(cTime);
|
|
||||||
// XCDemandZoneObject *iObj;
|
|
||||||
// bool isCreated = mPOIDrawer.CreateDemandZone(
|
|
||||||
// mTestConditions.activeDemandZone,
|
|
||||||
// iObj //
|
|
||||||
// );
|
|
||||||
// if (isCreated)
|
|
||||||
// {
|
|
||||||
// AddObjectIfNotExists(iObj);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// //
|
|
||||||
// mTestConditions.activeSupplyZone.To(cTime);
|
|
||||||
// XCSupplyZoneObject *iObj;
|
|
||||||
// bool isCreated = mPOIDrawer.CreateSupplyZone(
|
|
||||||
// mTestConditions.activeSupplyZone,
|
|
||||||
// iObj //
|
|
||||||
// );
|
|
||||||
// if (isCreated)
|
|
||||||
// {
|
|
||||||
// AddObjectIfNotExists(iObj);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// if (hasTicksZone)
|
|
||||||
// {
|
|
||||||
// //
|
|
||||||
// XCTicksZoneObject *iObj;
|
|
||||||
// bool isCreated = mPOIDrawer.CreateTicksZone(
|
|
||||||
// mTestConditions.ticksZone,
|
|
||||||
// iObj //
|
|
||||||
// );
|
|
||||||
// if (isCreated)
|
|
||||||
// {
|
|
||||||
// AddObjectIfNotExists(iObj);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
//
|
//
|
||||||
result = isSetuped;
|
result = isSetuped;
|
||||||
if (!result)
|
if (!result)
|
||||||
@@ -720,77 +535,77 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Handle Required Drawings ...
|
// Handle Required Drawings ...
|
||||||
bool hasPivot = mXTWPVConditions.HasPivot();
|
// bool hasPivot = mXTWPVConditions.HasPivot();
|
||||||
bool hasPriceInsideZone = mXTWPVConditions.HasPriceInsideZones();
|
// bool hasPriceInsideZone = mXTWPVConditions.HasPriceInsideZones();
|
||||||
bool hasConsolidationZone = mXTWPVConditions.HasConsolidationZone();
|
// bool hasConsolidationZone = mXTWPVConditions.HasConsolidationZone();
|
||||||
bool canDraw = hasPivot ||
|
// bool canDraw = hasPivot ||
|
||||||
hasPriceInsideZone ||
|
// hasPriceInsideZone ||
|
||||||
hasConsolidationZone;
|
// hasConsolidationZone;
|
||||||
if (canDraw)
|
// if (canDraw)
|
||||||
{
|
// {
|
||||||
//
|
// //
|
||||||
ClearDraws();
|
// ClearDraws();
|
||||||
|
|
||||||
//
|
// //
|
||||||
// Draw Consolidation Zone ...
|
// // Draw Consolidation Zone ...
|
||||||
if (hasConsolidationZone)
|
// if (hasConsolidationZone)
|
||||||
{
|
// {
|
||||||
//
|
// //
|
||||||
XCConsolidationZoneObject *iObj;
|
// XCConsolidationZoneObject *iObj;
|
||||||
bool isCreated = mPOIDrawer.CreateConsolidationZone(
|
// bool isCreated = mPOIDrawer.CreateConsolidationZone(
|
||||||
mXTWPVConditions.consolidationZone,
|
// mXTWPVConditions.consolidationZone,
|
||||||
iObj //
|
// iObj //
|
||||||
);
|
// );
|
||||||
if (isCreated)
|
// if (isCreated)
|
||||||
{
|
// {
|
||||||
AddObjectIfNotExists(iObj);
|
// AddObjectIfNotExists(iObj);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
//
|
// //
|
||||||
// Draw Pivot Zone ...
|
// // Draw Pivot Zone ...
|
||||||
if (hasPivot)
|
// if (hasPivot)
|
||||||
{
|
// {
|
||||||
//
|
// //
|
||||||
XCBaseObject *drawnObjects[];
|
// XCBaseObject *drawnObjects[];
|
||||||
int drawnObjectsCount = DrawXTWPVPivotZone(
|
// int drawnObjectsCount = DrawXTWPVPivotZone(
|
||||||
mXTWPVConditions,
|
// mXTWPVConditions,
|
||||||
mPOIDrawer,
|
// mPOIDrawer,
|
||||||
drawnObjects,
|
// drawnObjects,
|
||||||
false, // Draw State ...
|
// false, // Draw State ...
|
||||||
false, // Draw Ticks Zone ...
|
// false, // Draw Ticks Zone ...
|
||||||
true, // Ignore SwingHighs ...
|
// true, // Ignore SwingHighs ...
|
||||||
true, // Ignore SwingLows ...
|
// true, // Ignore SwingLows ...
|
||||||
true, // Ignore SupportZones ...
|
// true, // Ignore SupportZones ...
|
||||||
true, // Ignore ResistanceZones ...
|
// true, // Ignore ResistanceZones ...
|
||||||
true, // Ignore SupplyZones ...
|
// true, // Ignore SupplyZones ...
|
||||||
true, // Ignore DemandZones ...
|
// true, // Ignore DemandZones ...
|
||||||
true, // Ignore BullishOrderBlocks ...
|
// true, // Ignore BullishOrderBlocks ...
|
||||||
true, // Ignore BearishOrderBlocks ...
|
// true, // Ignore BearishOrderBlocks ...
|
||||||
true, // Ignore BullishFairValueGaps ...
|
// true, // Ignore BullishFairValueGaps ...
|
||||||
true, // Ignore BearishFairValueGaps ...
|
// true, // Ignore BearishFairValueGaps ...
|
||||||
true, // Ignore BullishRejectionBars ...
|
// true, // Ignore BullishRejectionBars ...
|
||||||
true, // Ignore BearishRejectionBars ...
|
// true, // Ignore BearishRejectionBars ...
|
||||||
true, // Ignore BullishMomentumBars ...
|
// true, // Ignore BullishMomentumBars ...
|
||||||
true // Ignore BearishMomentumBars ...
|
// true // Ignore BearishMomentumBars ...
|
||||||
);
|
// );
|
||||||
AddObjectsIfNotExists(drawnObjects);
|
// AddObjectsIfNotExists(drawnObjects);
|
||||||
}
|
// }
|
||||||
|
|
||||||
//
|
// //
|
||||||
// Draw Price Inside Zones ...
|
// // Draw Price Inside Zones ...
|
||||||
if (hasPriceInsideZone)
|
// if (hasPriceInsideZone)
|
||||||
{
|
// {
|
||||||
//
|
// //
|
||||||
XCBaseObject *drawnObjects[];
|
// XCBaseObject *drawnObjects[];
|
||||||
int drawnObjectsCount = DrawTWPVPriceInsideZones(
|
// int drawnObjectsCount = DrawTWPVPriceInsideZones(
|
||||||
mXTWPVConditions,
|
// mXTWPVConditions,
|
||||||
mPOIDrawer,
|
// mPOIDrawer,
|
||||||
drawnObjects //
|
// drawnObjects //
|
||||||
);
|
// );
|
||||||
AddObjectsIfNotExists(drawnObjects);
|
// AddObjectsIfNotExists(drawnObjects);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
//
|
//
|
||||||
result = isSetuped;
|
result = isSetuped;
|
||||||
@@ -982,225 +797,6 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// SL Selector Methods ...
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Select Specified Type of Stop Loss ...
|
|
||||||
*
|
|
||||||
* @param conditions: X121SMCStrategyConditions instance Reference ...
|
|
||||||
* @param forDir: ENUM_X_DIRECTION member, Signal Direction ...
|
|
||||||
* @param type: ENUM_X_121_SMC_SL_TYPES member, Specified Required SL Type ...
|
|
||||||
*
|
|
||||||
* @return ( double )
|
|
||||||
*/
|
|
||||||
double SelectSL(
|
|
||||||
X121SMCStrategyConditions &conditions,
|
|
||||||
ENUM_X_DIRECTION forDir,
|
|
||||||
ENUM_X_121_SMC_SL_TYPES type //
|
|
||||||
)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
double result = 0;
|
|
||||||
|
|
||||||
//
|
|
||||||
string symbol = GetSymbol();
|
|
||||||
ENUM_TIMEFRAMES period = GetPeriod();
|
|
||||||
|
|
||||||
//
|
|
||||||
bool isValid =
|
|
||||||
//
|
|
||||||
HasDirection(forDir) &&
|
|
||||||
conditions.IsValid() &&
|
|
||||||
type != X_121_SMC_SL_TYPE_NONE
|
|
||||||
//
|
|
||||||
;
|
|
||||||
if (!isValid)
|
|
||||||
{
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
XOHCL zBar;
|
|
||||||
bool isInited = zBar.Init(
|
|
||||||
symbol,
|
|
||||||
period,
|
|
||||||
0 //
|
|
||||||
);
|
|
||||||
if (!isInited)
|
|
||||||
{
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
bool isBullish = IsBullish(forDir);
|
|
||||||
|
|
||||||
//
|
|
||||||
if (type == X_121_SMC_SL_TYPE_FIBO_LEVEL_3)
|
|
||||||
{
|
|
||||||
result = conditions.triggerConditions.x121Conditions.fl3Buffer[0];
|
|
||||||
}
|
|
||||||
else if (type == X_121_SMC_SL_TYPE_FIBO_LEVEL_1_5)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
result =
|
|
||||||
isBullish
|
|
||||||
? conditions.triggerConditions.x121Conditions.fl1Buffer[0]
|
|
||||||
: conditions.triggerConditions.x121Conditions.fl5Buffer[0];
|
|
||||||
}
|
|
||||||
else if (type == X_121_SMC_SL_TYPE_DON_CLOSE_BOX)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
result =
|
|
||||||
isBullish
|
|
||||||
? conditions.triggerConditions.x121Conditions.donCloseLowerBuffer[0]
|
|
||||||
: conditions.triggerConditions.x121Conditions.donCloseUpperBuffer[0];
|
|
||||||
}
|
|
||||||
else if (type == X_121_SMC_SL_TYPE_SWING)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
int swingLowsCount = conditions.triggerConditions.state.CountSwingLows();
|
|
||||||
int swingHighsCount = conditions.triggerConditions.state.CountSwingHighs();
|
|
||||||
result =
|
|
||||||
isBullish
|
|
||||||
? conditions.triggerConditions.state.swingLows[swingLowsCount - 1].GetValue()
|
|
||||||
: conditions.triggerConditions.state.swingHighs[swingHighsCount - 1].GetValue();
|
|
||||||
}
|
|
||||||
else if (type == X_121_SMC_SL_TYPE_REJECTION)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
result =
|
|
||||||
isBullish
|
|
||||||
? conditions.triggerConditions.state.bullishRejectionBars[conditions.triggerConditions.state.CountBullishRejectionBars() - 1].Lower()
|
|
||||||
: conditions.triggerConditions.state.bearishRejectionBars[conditions.triggerConditions.state.CountBearishRejectionBars() - 1].Upper();
|
|
||||||
}
|
|
||||||
else if (type == X_121_SMC_SL_TYPE_MOMENTUM)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
result =
|
|
||||||
isBullish
|
|
||||||
? conditions.triggerConditions.state.bullishMomentumBars[conditions.triggerConditions.state.CountBullishMomentumBars() - 1].Lower()
|
|
||||||
: conditions.triggerConditions.state.bearishMomentumBars[conditions.triggerConditions.state.CountBearishMomentumBars() - 1].Upper();
|
|
||||||
}
|
|
||||||
else if (type == X_121_SMC_SL_TYPE_VWAP_FAST)
|
|
||||||
{
|
|
||||||
result = conditions.triggerConditions.x121Conditions.vwapFastBuffer[0];
|
|
||||||
}
|
|
||||||
else if (type == X_121_SMC_SL_TYPE_VWAP_MID)
|
|
||||||
{
|
|
||||||
result = conditions.triggerConditions.x121Conditions.vwapMidBuffer[0];
|
|
||||||
}
|
|
||||||
else if (type == X_121_SMC_SL_TYPE_VWAP_SLOW)
|
|
||||||
{
|
|
||||||
result = conditions.triggerConditions.x121Conditions.vwapSlowBuffer[0];
|
|
||||||
}
|
|
||||||
else if (type == X_121_SMC_SL_TYPE_CURRENT_SAR)
|
|
||||||
{
|
|
||||||
result = conditions.triggerConditions.x121Conditions.sarBuffer[0];
|
|
||||||
}
|
|
||||||
else if (type == X_121_SMC_SL_TYPE_TENKAN_SEN)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
double hh = zBar.FindHighest(
|
|
||||||
9,
|
|
||||||
MODE_HIGH //
|
|
||||||
);
|
|
||||||
double ll = zBar.FindLowest(
|
|
||||||
9,
|
|
||||||
MODE_LOW //
|
|
||||||
);
|
|
||||||
double mid = (hh - ll) / 2;
|
|
||||||
result = isBullish
|
|
||||||
? ll - mid
|
|
||||||
: hh + mid;
|
|
||||||
}
|
|
||||||
else if (type == X_121_SMC_SL_TYPE_CURRENT_SAR_BOX ||
|
|
||||||
type == X_121_SMC_SL_TYPE_LAST_SAR_CHANGED_BAR ||
|
|
||||||
type == X_121_SMC_SL_TYPE_LAST_DIRECTIONAL_SAR)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
XOHCL cSarChangeBar;
|
|
||||||
XOHCL pSarChangeBar;
|
|
||||||
XValueChange cSarChange; // Current Sar Change (IsDirect) ...
|
|
||||||
XValueChange pSarChange; // Prev Sar Change (Direct) ...
|
|
||||||
XValueChange sarChanges[];
|
|
||||||
int sarChangesCount = mTriggerCycleHelper
|
|
||||||
.FillSarChanges(sarChanges);
|
|
||||||
if (!IsValidSize(sarChangesCount) || sarChangesCount < 2)
|
|
||||||
{
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
//
|
|
||||||
cSarChange = sarChanges[sarChangesCount - 1];
|
|
||||||
pSarChange = sarChanges[sarChangesCount - 2];
|
|
||||||
|
|
||||||
//
|
|
||||||
bool isFilled = cSarChange.FillBar(
|
|
||||||
cSarChangeBar,
|
|
||||||
symbol,
|
|
||||||
period //
|
|
||||||
);
|
|
||||||
if (!isFilled)
|
|
||||||
{
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
isFilled = pSarChange.FillBar(
|
|
||||||
pSarChangeBar,
|
|
||||||
symbol,
|
|
||||||
period //
|
|
||||||
);
|
|
||||||
if (!isFilled)
|
|
||||||
{
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
if (type == X_121_SMC_SL_TYPE_LAST_SAR_CHANGED_BAR)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
result = isBullish
|
|
||||||
? pSarChangeBar.low
|
|
||||||
: pSarChangeBar.high;
|
|
||||||
}
|
|
||||||
else if (type == X_121_SMC_SL_TYPE_CURRENT_SAR_BOX)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
result =
|
|
||||||
isBullish
|
|
||||||
? zBar.FindLowest(
|
|
||||||
MathAbs(cSarChangeBar.Index() - 1),
|
|
||||||
MODE_LOW //
|
|
||||||
)
|
|
||||||
: zBar.FindHighest(
|
|
||||||
MathAbs(cSarChangeBar.Index() - 1),
|
|
||||||
MODE_HIGH //
|
|
||||||
);
|
|
||||||
}
|
|
||||||
else if (type == X_121_SMC_SL_TYPE_LAST_DIRECTIONAL_SAR)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
XOHCL prevBar;
|
|
||||||
bool isInited = cSarChangeBar.GetPreviousBar(prevBar);
|
|
||||||
if (!isInited)
|
|
||||||
{
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
result = isBullish
|
|
||||||
? prevBar.low
|
|
||||||
: prevBar.high;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user