last ...
This commit is contained in:
@@ -58,6 +58,9 @@ struct X121SMCStrategyXPZSignalConditions
|
|||||||
bool isPriceZoneValidForPeak;
|
bool isPriceZoneValidForPeak;
|
||||||
bool isPriceZoneValidForVale;
|
bool isPriceZoneValidForVale;
|
||||||
|
|
||||||
|
//
|
||||||
|
XPVPivot pivotZone;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Constructor ...
|
// Constructor ...
|
||||||
X121SMCStrategyXPZSignalConditions()
|
X121SMCStrategyXPZSignalConditions()
|
||||||
@@ -178,6 +181,7 @@ struct X121SMCStrategyXPZSignalConditions
|
|||||||
|
|
||||||
//
|
//
|
||||||
priceZone.Clean();
|
priceZone.Clean();
|
||||||
|
pivotZone.Clean();
|
||||||
isPriceZoneValidForPeak = false;
|
isPriceZoneValidForPeak = false;
|
||||||
isPriceZoneValidForVale = false;
|
isPriceZoneValidForVale = false;
|
||||||
}
|
}
|
||||||
@@ -190,6 +194,13 @@ struct X121SMCStrategyXPZSignalConditions
|
|||||||
X121SMCStrategyXPZSignalConditions mXPZConditions;
|
X121SMCStrategyXPZSignalConditions mXPZConditions;
|
||||||
X121SMCStrategyXPZSignalConditions mXPZConditionsCollection[];
|
X121SMCStrategyXPZSignalConditions mXPZConditionsCollection[];
|
||||||
|
|
||||||
|
//
|
||||||
|
double X121SMCXPZPivotPeak;
|
||||||
|
double X121SMCXPZPivotVale;
|
||||||
|
datetime X121SMCXPZPivotEnd;
|
||||||
|
datetime X121SMCXPZPivotStart;
|
||||||
|
ENUM_XPV_PIVOTS X121SMCXPZPivotType = XPV_NONE;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Extension Functions ...
|
// Extension Functions ...
|
||||||
|
|
||||||
@@ -415,12 +426,6 @@ bool DetectX121SMCXPZSiganlSetup(
|
|||||||
//
|
//
|
||||||
// Consolidation ...
|
// Consolidation ...
|
||||||
|
|
||||||
//
|
|
||||||
if (decisionXConditions.isTrendSwirchedToBearish)
|
|
||||||
{
|
|
||||||
Print("Trend Switced To Bearish ...");
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
bool hasConsolidationBullishTrend = consolidationXConditions.isTrendBullish;
|
bool hasConsolidationBullishTrend = consolidationXConditions.isTrendBullish;
|
||||||
bool hasConsolidationBearishTrend = consolidationXConditions.isTrendBearish;
|
bool hasConsolidationBearishTrend = consolidationXConditions.isTrendBearish;
|
||||||
@@ -536,6 +541,314 @@ 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 ...
|
// Detect Price Zone ...
|
||||||
|
|
||||||
@@ -676,6 +989,8 @@ bool DetectX121SMCXPZSiganlSetup(
|
|||||||
|
|
||||||
//
|
//
|
||||||
bool isPriceZoneBullish =
|
bool isPriceZoneBullish =
|
||||||
|
//
|
||||||
|
hasPivot &&
|
||||||
//
|
//
|
||||||
hasVerificationBullishTrend &&
|
hasVerificationBullishTrend &&
|
||||||
hasAnalyseBullishTrend &&
|
hasAnalyseBullishTrend &&
|
||||||
@@ -688,14 +1003,14 @@ bool DetectX121SMCXPZSiganlSetup(
|
|||||||
isCBarBullishFormed &&
|
isCBarBullishFormed &&
|
||||||
isInDecisionDiscount &&
|
isInDecisionDiscount &&
|
||||||
decisionXConditions.isAtrLowerUnderVale &&
|
decisionXConditions.isAtrLowerUnderVale &&
|
||||||
decisionXConditions.isAtrLowerSlopeBullish &&
|
decisionXConditions.isAtrLowerSlopeBullish
|
||||||
//
|
|
||||||
true
|
|
||||||
//
|
//
|
||||||
;
|
;
|
||||||
|
|
||||||
//
|
//
|
||||||
bool isPriceZoneBearish =
|
bool isPriceZoneBearish =
|
||||||
|
//
|
||||||
|
hasPivot &&
|
||||||
//
|
//
|
||||||
hasVerificationBearishTrend &&
|
hasVerificationBearishTrend &&
|
||||||
hasAnalyseBearishTrend &&
|
hasAnalyseBearishTrend &&
|
||||||
@@ -708,9 +1023,7 @@ bool DetectX121SMCXPZSiganlSetup(
|
|||||||
isInDecisionPremium &&
|
isInDecisionPremium &&
|
||||||
isCBarBearishFormed &&
|
isCBarBearishFormed &&
|
||||||
decisionXConditions.isAtrUpperOverPeak &&
|
decisionXConditions.isAtrUpperOverPeak &&
|
||||||
decisionXConditions.isAtrUpperSlopeBearish &&
|
decisionXConditions.isAtrUpperSlopeBearish
|
||||||
//
|
|
||||||
true
|
|
||||||
//
|
//
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|||||||
@@ -214,9 +214,6 @@ struct X121SMCStrategyXRSPVISignalConditions
|
|||||||
X121SMCStrategyXRSPVISignalConditions mXRSPVIConditions;
|
X121SMCStrategyXRSPVISignalConditions mXRSPVIConditions;
|
||||||
X121SMCStrategyXRSPVISignalConditions mXRSPVIConditionsCollection[];
|
X121SMCStrategyXRSPVISignalConditions mXRSPVIConditionsCollection[];
|
||||||
|
|
||||||
//
|
|
||||||
// Extension Functions ...
|
|
||||||
|
|
||||||
//
|
//
|
||||||
double X121SMCXRSPVIPivotPeak;
|
double X121SMCXRSPVIPivotPeak;
|
||||||
double X121SMCXRSPVIPivotVale;
|
double X121SMCXRSPVIPivotVale;
|
||||||
@@ -224,6 +221,9 @@ datetime X121SMCXRSPVIPivotEnd;
|
|||||||
datetime X121SMCXRSPVIPivotStart;
|
datetime X121SMCXRSPVIPivotStart;
|
||||||
ENUM_XPV_PIVOTS X121SMCXRSPVIPivotType = XPV_NONE;
|
ENUM_XPV_PIVOTS X121SMCXRSPVIPivotType = XPV_NONE;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Extension Functions ...
|
||||||
|
|
||||||
//
|
//
|
||||||
// Detect Setup Conditions ...
|
// Detect Setup Conditions ...
|
||||||
bool DetectX121SMCXRSPVISiganlSetup(
|
bool DetectX121SMCXRSPVISiganlSetup(
|
||||||
|
|||||||
@@ -56,6 +56,9 @@ struct X121SMCStrategyXSTRPVSignalConditions
|
|||||||
bool isPriceZoneValidForPeak;
|
bool isPriceZoneValidForPeak;
|
||||||
bool isPriceZoneValidForVale;
|
bool isPriceZoneValidForVale;
|
||||||
|
|
||||||
|
//
|
||||||
|
XPVPivot pivotZone;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Constructor ...
|
// Constructor ...
|
||||||
X121SMCStrategyXSTRPVSignalConditions()
|
X121SMCStrategyXSTRPVSignalConditions()
|
||||||
@@ -176,6 +179,7 @@ struct X121SMCStrategyXSTRPVSignalConditions
|
|||||||
|
|
||||||
//
|
//
|
||||||
priceZone.Clean();
|
priceZone.Clean();
|
||||||
|
pivotZone.Clean();
|
||||||
isPriceZoneValidForPeak = false;
|
isPriceZoneValidForPeak = false;
|
||||||
isPriceZoneValidForVale = false;
|
isPriceZoneValidForVale = false;
|
||||||
}
|
}
|
||||||
@@ -188,6 +192,13 @@ struct X121SMCStrategyXSTRPVSignalConditions
|
|||||||
X121SMCStrategyXSTRPVSignalConditions mXSTRPVConditions;
|
X121SMCStrategyXSTRPVSignalConditions mXSTRPVConditions;
|
||||||
X121SMCStrategyXSTRPVSignalConditions mXSTRPVConditionsCollection[];
|
X121SMCStrategyXSTRPVSignalConditions mXSTRPVConditionsCollection[];
|
||||||
|
|
||||||
|
//
|
||||||
|
double X121SMCXSTRPVPivotPeak;
|
||||||
|
double X121SMCXSTRPVPivotVale;
|
||||||
|
datetime X121SMCXSTRPVPivotEnd;
|
||||||
|
datetime X121SMCXSTRPVPivotStart;
|
||||||
|
ENUM_XPV_PIVOTS X121SMCXSTRPVPivotType = XPV_NONE;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Extension Functions ...
|
// Extension Functions ...
|
||||||
|
|
||||||
@@ -528,6 +539,314 @@ bool DetectX121SMCXSTRPVSiganlSetup(
|
|||||||
//
|
//
|
||||||
;
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
// 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(X121SMCXSTRPVPivotStart);
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
X121SMCXSTRPVPivotStart = cTime;
|
||||||
|
X121SMCXSTRPVPivotType =
|
||||||
|
isPeakStart
|
||||||
|
? XPV_PEAK
|
||||||
|
: XPV_VALE;
|
||||||
|
|
||||||
|
//
|
||||||
|
X121SMCXSTRPVPivotPeak = decisionXConditions.peaksBuffer[1];
|
||||||
|
X121SMCXSTRPVPivotVale = decisionXConditions.valesBuffer[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
hasPivot = IsValid(X121SMCXSTRPVPivotStart);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Create XPVPivot instance ...
|
||||||
|
if (hasPivot)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
conditions.pivotZone.symbol = symbol;
|
||||||
|
conditions.pivotZone.period = period;
|
||||||
|
|
||||||
|
//
|
||||||
|
conditions.pivotZone.to = cTime;
|
||||||
|
conditions.pivotZone.repetition = 3;
|
||||||
|
|
||||||
|
//
|
||||||
|
conditions.pivotZone.upper = X121SMCXSTRPVPivotPeak;
|
||||||
|
conditions.pivotZone.lower = X121SMCXSTRPVPivotVale;
|
||||||
|
|
||||||
|
//
|
||||||
|
conditions.pivotZone.type = X121SMCXSTRPVPivotType;
|
||||||
|
conditions.pivotZone.from = X121SMCXSTRPVPivotStart;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (hasPivot)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool isBreaked = X121SMCXSTRPVPivotType == XPV_PEAK
|
||||||
|
? decisionXConditions.isBreakedUpPrevPeak
|
||||||
|
: decisionXConditions.isBreakedDownPrevVale;
|
||||||
|
|
||||||
|
//
|
||||||
|
if (!isBreaked)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
X121SMCXSTRPVPivotPeak = decisionXConditions.peaksBuffer[1];
|
||||||
|
X121SMCXSTRPVPivotVale = decisionXConditions.valesBuffer[1];
|
||||||
|
|
||||||
|
//
|
||||||
|
conditions.pivotZone.to = cTime;
|
||||||
|
conditions.pivotZone.repetition++;
|
||||||
|
conditions.pivotZone.upper = X121SMCXSTRPVPivotPeak;
|
||||||
|
conditions.pivotZone.lower = X121SMCXSTRPVPivotVale;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//
|
||||||
|
X121SMCXSTRPVPivotEnd = 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(X121SMCXSTRPVPivotEnd);
|
||||||
|
if (isPivotEnded)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
X121SMCXSTRPVPivotPeak = 0;
|
||||||
|
X121SMCXSTRPVPivotVale = 0;
|
||||||
|
X121SMCXSTRPVPivotEnd = NULL;
|
||||||
|
X121SMCXSTRPVPivotStart = NULL;
|
||||||
|
X121SMCXSTRPVPivotType = XPV_NONE;
|
||||||
|
|
||||||
|
//
|
||||||
|
conditions.pivotZone.Clean();
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Detect Price Zone ...
|
// Detect Price Zone ...
|
||||||
|
|
||||||
@@ -615,6 +934,8 @@ bool DetectX121SMCXSTRPVSiganlSetup(
|
|||||||
|
|
||||||
//
|
//
|
||||||
bool isDecisionBullish =
|
bool isDecisionBullish =
|
||||||
|
//
|
||||||
|
hasPivot &&
|
||||||
//
|
//
|
||||||
hasAnalysePriceZone &&
|
hasAnalysePriceZone &&
|
||||||
analysePriceZone.IsBullish() &&
|
analysePriceZone.IsBullish() &&
|
||||||
@@ -646,6 +967,8 @@ bool DetectX121SMCXSTRPVSiganlSetup(
|
|||||||
|
|
||||||
//
|
//
|
||||||
bool isDecisionBearish =
|
bool isDecisionBearish =
|
||||||
|
//
|
||||||
|
hasPivot &&
|
||||||
//
|
//
|
||||||
hasAnalysePriceZone &&
|
hasAnalysePriceZone &&
|
||||||
analysePriceZone.IsBearish() &&
|
analysePriceZone.IsBearish() &&
|
||||||
@@ -719,6 +1042,8 @@ bool DetectX121SMCXSTRPVSiganlSetup(
|
|||||||
|
|
||||||
//
|
//
|
||||||
bool isAnalyseBullish =
|
bool isAnalyseBullish =
|
||||||
|
//
|
||||||
|
hasPivot &&
|
||||||
//
|
//
|
||||||
!hasDecisionCondition &&
|
!hasDecisionCondition &&
|
||||||
//
|
//
|
||||||
@@ -752,6 +1077,8 @@ bool DetectX121SMCXSTRPVSiganlSetup(
|
|||||||
|
|
||||||
//
|
//
|
||||||
bool isAnalyseBearish =
|
bool isAnalyseBearish =
|
||||||
|
//
|
||||||
|
hasPivot &&
|
||||||
//
|
//
|
||||||
!hasDecisionCondition &&
|
!hasDecisionCondition &&
|
||||||
//
|
//
|
||||||
|
|||||||
Reference in New Issue
Block a user