last ...
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -58,9 +58,6 @@ struct X121SMCStrategyXPZSignalConditions
|
||||
bool isPriceZoneValidForPeak;
|
||||
bool isPriceZoneValidForVale;
|
||||
|
||||
//
|
||||
XPVPivot pivotZone;
|
||||
|
||||
//
|
||||
// Constructor ...
|
||||
X121SMCStrategyXPZSignalConditions()
|
||||
@@ -181,7 +178,6 @@ struct X121SMCStrategyXPZSignalConditions
|
||||
|
||||
//
|
||||
priceZone.Clean();
|
||||
pivotZone.Clean();
|
||||
isPriceZoneValidForPeak = false;
|
||||
isPriceZoneValidForVale = false;
|
||||
}
|
||||
@@ -194,13 +190,6 @@ struct X121SMCStrategyXPZSignalConditions
|
||||
X121SMCStrategyXPZSignalConditions mXPZConditions;
|
||||
X121SMCStrategyXPZSignalConditions mXPZConditionsCollection[];
|
||||
|
||||
//
|
||||
double X121SMCXPZPivotPeak;
|
||||
double X121SMCXPZPivotVale;
|
||||
datetime X121SMCXPZPivotEnd;
|
||||
datetime X121SMCXPZPivotStart;
|
||||
ENUM_XPV_PIVOTS X121SMCXPZPivotType = XPV_NONE;
|
||||
|
||||
//
|
||||
// Extension Functions ...
|
||||
|
||||
@@ -425,25 +414,63 @@ bool DetectX121SMCXPZSiganlSetup(
|
||||
|
||||
//
|
||||
// Consolidation ...
|
||||
|
||||
//
|
||||
bool hasConsolidationBullishTrend = consolidationXConditions.isTrendBullish;
|
||||
bool hasConsolidationBearishTrend = consolidationXConditions.isTrendBearish;
|
||||
ENUM_X_DIRECTION consolidationTrendDir;
|
||||
bool hasConsolidationTrend =
|
||||
consolidationCycleHelper
|
||||
.DetectMarketStructure(
|
||||
consolidationTrendDir //
|
||||
);
|
||||
bool hasConsolidationBullishTrend =
|
||||
hasConsolidationTrend &&
|
||||
IsBullish(consolidationTrendDir);
|
||||
bool hasConsolidationBearishTrend =
|
||||
hasConsolidationTrend &&
|
||||
IsBearish(consolidationTrendDir);
|
||||
|
||||
//
|
||||
// Verification ...
|
||||
bool hasVerificationBullishTrend = verificationXConditions.isTrendBullish;
|
||||
bool hasVerificationBearishTrend = verificationXConditions.isTrendBearish;
|
||||
ENUM_X_DIRECTION verificationTrendDir;
|
||||
bool hasVerificationTrend =
|
||||
verificationCycleHelper
|
||||
.DetectMarketStructure(
|
||||
verificationTrendDir //
|
||||
);
|
||||
bool hasVerificationBullishTrend =
|
||||
hasVerificationTrend &&
|
||||
IsBullish(verificationTrendDir);
|
||||
bool hasVerificationBearishTrend =
|
||||
hasVerificationTrend &&
|
||||
IsBearish(verificationTrendDir);
|
||||
|
||||
//
|
||||
// Analyse ...
|
||||
bool hasAnalyseBullishTrend = analyseXConditions.isTrendBullish;
|
||||
bool hasAnalyseBearishTrend = analyseXConditions.isTrendBearish;
|
||||
ENUM_X_DIRECTION analyseTrendDir;
|
||||
bool hasAnalyseTrend =
|
||||
analyseCycleHelper
|
||||
.DetectMarketStructure(
|
||||
analyseTrendDir //
|
||||
);
|
||||
bool hasAnalyseBullishTrend =
|
||||
hasAnalyseTrend &&
|
||||
IsBullish(analyseTrendDir);
|
||||
bool hasAnalyseBearishTrend =
|
||||
hasAnalyseTrend &&
|
||||
IsBearish(analyseTrendDir);
|
||||
|
||||
//
|
||||
// Decision ...
|
||||
bool hasDecisionBullishTrend = decisionXConditions.isTrendBullish;
|
||||
bool hasDecisionBearishTrend = decisionXConditions.isTrendBearish;
|
||||
ENUM_X_DIRECTION decisionTrendDir;
|
||||
bool hasDecisionTrend =
|
||||
decisionCycleHelper
|
||||
.DetectMarketStructure(
|
||||
decisionTrendDir //
|
||||
);
|
||||
bool hasDecisionBullishTrend =
|
||||
hasDecisionTrend &&
|
||||
IsBullish(decisionTrendDir);
|
||||
bool hasDecisionBearishTrend =
|
||||
hasDecisionTrend &&
|
||||
IsBearish(decisionTrendDir);
|
||||
|
||||
//
|
||||
// Detect Bar State ...
|
||||
@@ -541,314 +568,6 @@ bool DetectX121SMCXPZSiganlSetup(
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
// Detect PV Pivot ...
|
||||
|
||||
//
|
||||
bool isPivotPeakZoneRejected = false;
|
||||
bool isPivotPeakZoneBreakedUp = false;
|
||||
bool isPivotPeakZoneBreakedDown = false;
|
||||
bool isPivotValeZoneRejected = false;
|
||||
bool isPivotValeZoneBreakedUp = false;
|
||||
bool isPivotValeZoneBreakedDown = false;
|
||||
bool hasPivot = conditions.pivotZone.IsValid();
|
||||
if (!hasPivot)
|
||||
{
|
||||
//
|
||||
hasPivot = IsValid(X121SMCXPZPivotStart);
|
||||
if (!hasPivot)
|
||||
{
|
||||
//
|
||||
bool isNewVale = decisionXConditions.isNewVale;
|
||||
bool isNewValeOverLast = decisionXConditions.isNewValeOverLast;
|
||||
bool isNewValeUnderLast = decisionXConditions.isNewValeUnderLast;
|
||||
bool isSameVales = decisionXConditions.valesBuffer[1] ==
|
||||
decisionXConditions.valesBuffer[2] &&
|
||||
decisionXConditions.valesBuffer[2] ==
|
||||
decisionXConditions.valesBuffer[3];
|
||||
bool isSameCycleVales = decisionXConditions.valesBuffer[1] ==
|
||||
analyseXConditions.valesBuffer[1] &&
|
||||
analyseXConditions.valesBuffer[1] ==
|
||||
verificationXConditions.valesBuffer[1];
|
||||
|
||||
//
|
||||
bool isNewPeak = decisionXConditions.isNewPeak;
|
||||
bool isNewPeakOverLast = decisionXConditions.isNewPeakOverLast;
|
||||
bool isNewPeakUnderLast = decisionXConditions.isNewPeakUnderLast;
|
||||
bool isSamePeaks = decisionXConditions.peaksBuffer[1] ==
|
||||
decisionXConditions.peaksBuffer[2] &&
|
||||
decisionXConditions.peaksBuffer[2] ==
|
||||
decisionXConditions.peaksBuffer[3];
|
||||
bool isSameCyclePeaks = decisionXConditions.peaksBuffer[1] ==
|
||||
analyseXConditions.peaksBuffer[1] &&
|
||||
analyseXConditions.peaksBuffer[1] ==
|
||||
verificationXConditions.peaksBuffer[1];
|
||||
|
||||
//
|
||||
bool isValeStart =
|
||||
// isSameVales;
|
||||
isSameVales &&
|
||||
isSameCycleVales;
|
||||
bool isPeakStart =
|
||||
// isSamePeaks;
|
||||
isSamePeaks &&
|
||||
isSameCyclePeaks;
|
||||
|
||||
//
|
||||
bool isStart = isPeakStart ||
|
||||
isValeStart;
|
||||
if (isStart)
|
||||
{
|
||||
//
|
||||
X121SMCXPZPivotStart = cTime;
|
||||
X121SMCXPZPivotType =
|
||||
isPeakStart
|
||||
? XPV_PEAK
|
||||
: XPV_VALE;
|
||||
|
||||
//
|
||||
X121SMCXPZPivotPeak = decisionXConditions.peaksBuffer[1];
|
||||
X121SMCXPZPivotVale = decisionXConditions.valesBuffer[1];
|
||||
}
|
||||
|
||||
//
|
||||
hasPivot = IsValid(X121SMCXPZPivotStart);
|
||||
|
||||
//
|
||||
// Create XPVPivot instance ...
|
||||
if (hasPivot)
|
||||
{
|
||||
//
|
||||
conditions.pivotZone.symbol = symbol;
|
||||
conditions.pivotZone.period = period;
|
||||
|
||||
//
|
||||
conditions.pivotZone.to = cTime;
|
||||
conditions.pivotZone.repetition = 3;
|
||||
|
||||
//
|
||||
conditions.pivotZone.upper = X121SMCXPZPivotPeak;
|
||||
conditions.pivotZone.lower = X121SMCXPZPivotVale;
|
||||
|
||||
//
|
||||
conditions.pivotZone.type = X121SMCXPZPivotType;
|
||||
conditions.pivotZone.from = X121SMCXPZPivotStart;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
if (hasPivot)
|
||||
{
|
||||
//
|
||||
bool isBreaked = X121SMCXPZPivotType == XPV_PEAK
|
||||
? decisionXConditions.isBreakedUpPrevPeak
|
||||
: decisionXConditions.isBreakedDownPrevVale;
|
||||
|
||||
//
|
||||
if (!isBreaked)
|
||||
{
|
||||
//
|
||||
X121SMCXPZPivotPeak = decisionXConditions.peaksBuffer[1];
|
||||
X121SMCXPZPivotVale = decisionXConditions.valesBuffer[1];
|
||||
|
||||
//
|
||||
conditions.pivotZone.to = cTime;
|
||||
conditions.pivotZone.repetition++;
|
||||
conditions.pivotZone.upper = X121SMCXPZPivotPeak;
|
||||
conditions.pivotZone.lower = X121SMCXPZPivotVale;
|
||||
}
|
||||
else
|
||||
{
|
||||
//
|
||||
X121SMCXPZPivotEnd = cTime;
|
||||
conditions.pivotZone.to = cTime;
|
||||
}
|
||||
|
||||
//
|
||||
// Fill Pivot State ...
|
||||
|
||||
//
|
||||
XPOIState analysePivotState;
|
||||
DetectPivotPOIs(
|
||||
conditions.pivotZone,
|
||||
analyseState,
|
||||
analysePivotState //
|
||||
);
|
||||
|
||||
//
|
||||
XPOIState decisionPivotState;
|
||||
DetectPivotPOIs(
|
||||
conditions.pivotZone,
|
||||
decisionState,
|
||||
decisionPivotState //
|
||||
);
|
||||
|
||||
//
|
||||
// Combine two State ...
|
||||
XPOIState combinedPivotState;
|
||||
XPOIState iStates[];
|
||||
AddRef(
|
||||
analysePivotState,
|
||||
iStates //
|
||||
);
|
||||
AddRef(
|
||||
decisionPivotState,
|
||||
iStates //
|
||||
);
|
||||
CombineStates(
|
||||
combinedPivotState,
|
||||
iStates //
|
||||
);
|
||||
combinedPivotState = decisionPivotState;
|
||||
|
||||
//
|
||||
ArrayFree(iStates);
|
||||
|
||||
//
|
||||
combinedPivotState.time = decisionPivotState.time;
|
||||
combinedPivotState.symbol = decisionPivotState.symbol;
|
||||
combinedPivotState.period = decisionPivotState.period;
|
||||
|
||||
//
|
||||
// Hold Only Areas Which on Upper or Lower bondary of Pivot Zone ...
|
||||
FilterPivotState(
|
||||
conditions.pivotZone,
|
||||
combinedPivotState //
|
||||
);
|
||||
|
||||
//
|
||||
conditions.pivotZone.state = combinedPivotState;
|
||||
|
||||
//
|
||||
double peakUpper = 0;
|
||||
double peakLower = 0;
|
||||
double valeUpper = 0;
|
||||
double valeLower = 0;
|
||||
|
||||
//
|
||||
datetime peakTo = NULL;
|
||||
datetime valeTo = NULL;
|
||||
datetime peakFrom = NULL;
|
||||
datetime valeFrom = NULL;
|
||||
|
||||
//
|
||||
bool hasBoxData = DetectPivotStateBoxData(
|
||||
conditions.pivotZone,
|
||||
peakUpper,
|
||||
peakLower,
|
||||
peakFrom,
|
||||
peakTo,
|
||||
valeUpper,
|
||||
valeLower,
|
||||
valeFrom,
|
||||
valeTo //
|
||||
);
|
||||
|
||||
//
|
||||
// Calculate Pivot Tick Zones ...
|
||||
|
||||
//
|
||||
int ticksLevels = decisionCycleHelper
|
||||
.mPOIDetector
|
||||
.TicksRangeZoneLevel();
|
||||
int ticksRange = decisionCycleHelper
|
||||
.mPOIDetector
|
||||
.TicksRangeZoneRange();
|
||||
|
||||
//
|
||||
CalculatePivotTickZone(
|
||||
conditions.pivotZone,
|
||||
ticksLevels,
|
||||
ticksRange //
|
||||
);
|
||||
|
||||
//
|
||||
isPivotPeakZoneRejected =
|
||||
hasBoxData &&
|
||||
(
|
||||
//
|
||||
IsBarReject(
|
||||
peakLower,
|
||||
X_DIRECTION_BEARISH,
|
||||
cBar //
|
||||
)
|
||||
//
|
||||
||
|
||||
//
|
||||
IsBarReject(
|
||||
peakUpper,
|
||||
X_DIRECTION_BEARISH,
|
||||
cBar //
|
||||
)
|
||||
//
|
||||
);
|
||||
isPivotPeakZoneBreakedUp =
|
||||
hasBoxData &&
|
||||
IsBarBreak(
|
||||
peakUpper,
|
||||
X_DIRECTION_BULLISH,
|
||||
cBar //
|
||||
);
|
||||
isPivotPeakZoneBreakedDown =
|
||||
hasBoxData &&
|
||||
IsBarBreak(
|
||||
peakLower,
|
||||
X_DIRECTION_BEARISH,
|
||||
cBar //
|
||||
);
|
||||
|
||||
//
|
||||
isPivotValeZoneRejected =
|
||||
hasBoxData &&
|
||||
(
|
||||
//
|
||||
IsBarReject(
|
||||
valeLower,
|
||||
X_DIRECTION_BULLISH,
|
||||
cBar //
|
||||
)
|
||||
//
|
||||
||
|
||||
//
|
||||
IsBarReject(
|
||||
valeUpper,
|
||||
X_DIRECTION_BULLISH,
|
||||
cBar //
|
||||
)
|
||||
//
|
||||
);
|
||||
isPivotValeZoneBreakedUp =
|
||||
hasBoxData &&
|
||||
IsBarBreak(
|
||||
valeUpper,
|
||||
X_DIRECTION_BULLISH,
|
||||
cBar //
|
||||
);
|
||||
isPivotValeZoneBreakedDown =
|
||||
hasBoxData &&
|
||||
IsBarBreak(
|
||||
valeLower,
|
||||
X_DIRECTION_BEARISH,
|
||||
cBar //
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
bool isPivotEnded = IsValid(X121SMCXPZPivotEnd);
|
||||
if (isPivotEnded)
|
||||
{
|
||||
//
|
||||
X121SMCXPZPivotPeak = 0;
|
||||
X121SMCXPZPivotVale = 0;
|
||||
X121SMCXPZPivotEnd = NULL;
|
||||
X121SMCXPZPivotStart = NULL;
|
||||
X121SMCXPZPivotType = XPV_NONE;
|
||||
|
||||
//
|
||||
conditions.pivotZone.Clean();
|
||||
}
|
||||
|
||||
//
|
||||
// Detect Price Zone ...
|
||||
|
||||
@@ -989,8 +708,6 @@ bool DetectX121SMCXPZSiganlSetup(
|
||||
|
||||
//
|
||||
bool isPriceZoneBullish =
|
||||
//
|
||||
hasPivot &&
|
||||
//
|
||||
hasVerificationBullishTrend &&
|
||||
hasAnalyseBullishTrend &&
|
||||
@@ -1003,14 +720,14 @@ bool DetectX121SMCXPZSiganlSetup(
|
||||
isCBarBullishFormed &&
|
||||
isInDecisionDiscount &&
|
||||
decisionXConditions.isAtrLowerUnderVale &&
|
||||
decisionXConditions.isAtrLowerSlopeBullish
|
||||
decisionXConditions.isAtrLowerSlopeBullish &&
|
||||
//
|
||||
true
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
bool isPriceZoneBearish =
|
||||
//
|
||||
hasPivot &&
|
||||
//
|
||||
hasVerificationBearishTrend &&
|
||||
hasAnalyseBearishTrend &&
|
||||
@@ -1023,7 +740,9 @@ bool DetectX121SMCXPZSiganlSetup(
|
||||
isInDecisionPremium &&
|
||||
isCBarBearishFormed &&
|
||||
decisionXConditions.isAtrUpperOverPeak &&
|
||||
decisionXConditions.isAtrUpperSlopeBearish
|
||||
decisionXConditions.isAtrUpperSlopeBearish &&
|
||||
//
|
||||
true
|
||||
//
|
||||
;
|
||||
|
||||
|
||||
@@ -445,25 +445,63 @@ bool DetectX121SMCXRSPVISiganlSetup(
|
||||
|
||||
//
|
||||
// Consolidation ...
|
||||
|
||||
//
|
||||
bool hasConsolidationBullishTrend = consolidationXConditions.isTrendBullish;
|
||||
bool hasConsolidationBearishTrend = consolidationXConditions.isTrendBearish;
|
||||
ENUM_X_DIRECTION consolidationTrendDir;
|
||||
bool hasConsolidationTrend =
|
||||
consolidationCycleHelper
|
||||
.DetectMarketStructure(
|
||||
consolidationTrendDir //
|
||||
);
|
||||
bool hasConsolidationBullishTrend =
|
||||
hasConsolidationTrend &&
|
||||
IsBullish(consolidationTrendDir);
|
||||
bool hasConsolidationBearishTrend =
|
||||
hasConsolidationTrend &&
|
||||
IsBearish(consolidationTrendDir);
|
||||
|
||||
//
|
||||
// Verification ...
|
||||
bool hasVerificationBullishTrend = verificationXConditions.isTrendBullish;
|
||||
bool hasVerificationBearishTrend = verificationXConditions.isTrendBearish;
|
||||
ENUM_X_DIRECTION verificationTrendDir;
|
||||
bool hasVerificationTrend =
|
||||
verificationCycleHelper
|
||||
.DetectMarketStructure(
|
||||
verificationTrendDir //
|
||||
);
|
||||
bool hasVerificationBullishTrend =
|
||||
hasVerificationTrend &&
|
||||
IsBullish(verificationTrendDir);
|
||||
bool hasVerificationBearishTrend =
|
||||
hasVerificationTrend &&
|
||||
IsBearish(verificationTrendDir);
|
||||
|
||||
//
|
||||
// Analyse ...
|
||||
bool hasAnalyseBullishTrend = analyseXConditions.isTrendBullish;
|
||||
bool hasAnalyseBearishTrend = analyseXConditions.isTrendBearish;
|
||||
ENUM_X_DIRECTION analyseTrendDir;
|
||||
bool hasAnalyseTrend =
|
||||
analyseCycleHelper
|
||||
.DetectMarketStructure(
|
||||
analyseTrendDir //
|
||||
);
|
||||
bool hasAnalyseBullishTrend =
|
||||
hasAnalyseTrend &&
|
||||
IsBullish(analyseTrendDir);
|
||||
bool hasAnalyseBearishTrend =
|
||||
hasAnalyseTrend &&
|
||||
IsBearish(analyseTrendDir);
|
||||
|
||||
//
|
||||
// Decision ...
|
||||
bool hasDecisionBullishTrend = decisionXConditions.isTrendBullish;
|
||||
bool hasDecisionBearishTrend = decisionXConditions.isTrendBearish;
|
||||
ENUM_X_DIRECTION decisionTrendDir;
|
||||
bool hasDecisionTrend =
|
||||
decisionCycleHelper
|
||||
.DetectMarketStructure(
|
||||
decisionTrendDir //
|
||||
);
|
||||
bool hasDecisionBullishTrend =
|
||||
hasDecisionTrend &&
|
||||
IsBullish(decisionTrendDir);
|
||||
bool hasDecisionBearishTrend =
|
||||
hasDecisionTrend &&
|
||||
IsBearish(decisionTrendDir);
|
||||
|
||||
//
|
||||
// Detect Bar State ...
|
||||
|
||||
@@ -423,25 +423,63 @@ bool DetectX121SMCXSTRPVSiganlSetup(
|
||||
|
||||
//
|
||||
// Consolidation ...
|
||||
|
||||
//
|
||||
bool hasConsolidationBullishTrend = consolidationXConditions.isTrendBullish;
|
||||
bool hasConsolidationBearishTrend = consolidationXConditions.isTrendBearish;
|
||||
ENUM_X_DIRECTION consolidationTrendDir;
|
||||
bool hasConsolidationTrend =
|
||||
consolidationCycleHelper
|
||||
.DetectMarketStructure(
|
||||
consolidationTrendDir //
|
||||
);
|
||||
bool hasConsolidationBullishTrend =
|
||||
hasConsolidationTrend &&
|
||||
IsBullish(consolidationTrendDir);
|
||||
bool hasConsolidationBearishTrend =
|
||||
hasConsolidationTrend &&
|
||||
IsBearish(consolidationTrendDir);
|
||||
|
||||
//
|
||||
// Verification ...
|
||||
bool hasVerificationBullishTrend = verificationXConditions.isTrendBullish;
|
||||
bool hasVerificationBearishTrend = verificationXConditions.isTrendBearish;
|
||||
ENUM_X_DIRECTION verificationTrendDir;
|
||||
bool hasVerificationTrend =
|
||||
verificationCycleHelper
|
||||
.DetectMarketStructure(
|
||||
verificationTrendDir //
|
||||
);
|
||||
bool hasVerificationBullishTrend =
|
||||
hasVerificationTrend &&
|
||||
IsBullish(verificationTrendDir);
|
||||
bool hasVerificationBearishTrend =
|
||||
hasVerificationTrend &&
|
||||
IsBearish(verificationTrendDir);
|
||||
|
||||
//
|
||||
// Analyse ...
|
||||
bool hasAnalyseBullishTrend = analyseXConditions.isTrendBullish;
|
||||
bool hasAnalyseBearishTrend = analyseXConditions.isTrendBearish;
|
||||
ENUM_X_DIRECTION analyseTrendDir;
|
||||
bool hasAnalyseTrend =
|
||||
analyseCycleHelper
|
||||
.DetectMarketStructure(
|
||||
analyseTrendDir //
|
||||
);
|
||||
bool hasAnalyseBullishTrend =
|
||||
hasAnalyseTrend &&
|
||||
IsBullish(analyseTrendDir);
|
||||
bool hasAnalyseBearishTrend =
|
||||
hasAnalyseTrend &&
|
||||
IsBearish(analyseTrendDir);
|
||||
|
||||
//
|
||||
// Decision ...
|
||||
bool hasDecisionBullishTrend = decisionXConditions.isTrendBullish;
|
||||
bool hasDecisionBearishTrend = decisionXConditions.isTrendBearish;
|
||||
ENUM_X_DIRECTION decisionTrendDir;
|
||||
bool hasDecisionTrend =
|
||||
decisionCycleHelper
|
||||
.DetectMarketStructure(
|
||||
decisionTrendDir //
|
||||
);
|
||||
bool hasDecisionBullishTrend =
|
||||
hasDecisionTrend &&
|
||||
IsBullish(decisionTrendDir);
|
||||
bool hasDecisionBearishTrend =
|
||||
hasDecisionTrend &&
|
||||
IsBearish(decisionTrendDir);
|
||||
|
||||
//
|
||||
// Detect Bar State ...
|
||||
|
||||
Reference in New Issue
Block a user