Last Works on Validating Order Blocks ...
This commit is contained in:
@@ -48,23 +48,6 @@ struct X121SMCStrategyXTWPVSignalConditions
|
||||
datetime setupTime;
|
||||
datetime triggerTime;
|
||||
|
||||
//
|
||||
XMarketStructure consolidationMarketStructure;
|
||||
XMarketStructure analyseMarketStructure;
|
||||
|
||||
//
|
||||
datetime newPeakAboveAtrUpperAt;
|
||||
datetime newValeBelowAtrLowerAt;
|
||||
datetime sarSiwtchedToBullishAt;
|
||||
datetime sarSiwtchedToBearishAt;
|
||||
datetime rsiCrossedOverOverSoldAt;
|
||||
datetime rsiCrossedUnderOverBoughtAt;
|
||||
|
||||
//
|
||||
XPriceZones decisionZone;
|
||||
XPriceZones peakPriceZone;
|
||||
XPriceZones valePriceZone;
|
||||
|
||||
//
|
||||
// Constructor ...
|
||||
X121SMCStrategyXTWPVSignalConditions()
|
||||
@@ -180,127 +163,6 @@ struct X121SMCStrategyXTWPVSignalConditions
|
||||
void ExtensionClean()
|
||||
{
|
||||
//
|
||||
decisionZone.Clean();
|
||||
peakPriceZone.Clean();
|
||||
valePriceZone.Clean();
|
||||
|
||||
//
|
||||
analyseMarketStructure.Clean();
|
||||
consolidationMarketStructure.Clean();
|
||||
|
||||
//
|
||||
newPeakAboveAtrUpperAt = NULL;
|
||||
newValeBelowAtrLowerAt = NULL;
|
||||
sarSiwtchedToBullishAt = NULL;
|
||||
sarSiwtchedToBearishAt = NULL;
|
||||
rsiCrossedOverOverSoldAt = NULL;
|
||||
rsiCrossedUnderOverBoughtAt = NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check Required Market Strucutre Exists or not ...
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool HasMarketStrucutre()
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result =
|
||||
//
|
||||
analyseMarketStructure.IsValid() &&
|
||||
consolidationMarketStructure.IsValid()
|
||||
//
|
||||
&&
|
||||
//
|
||||
analyseMarketStructure.HasTrend() &&
|
||||
consolidationMarketStructure.HasTrend()
|
||||
//
|
||||
&&
|
||||
//
|
||||
analyseMarketStructure.bias == consolidationMarketStructure.bias
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if Conditions Filled ...
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool IsFilled()
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result = HasMarketStrucutre();
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
bool isBullish = IsBullish(analyseMarketStructure.bias);
|
||||
|
||||
//
|
||||
result =
|
||||
isBullish
|
||||
? IsValid(newValeBelowAtrLowerAt) &&
|
||||
IsValid(sarSiwtchedToBullishAt) &&
|
||||
IsValid(rsiCrossedOverOverSoldAt)
|
||||
: IsValid(newPeakAboveAtrUpperAt) &&
|
||||
IsValid(sarSiwtchedToBearishAt) &&
|
||||
IsValid(rsiCrossedUnderOverBoughtAt);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if Has Price Zones ...
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool HasPriceZone()
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result = HasMarketStrucutre();
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
bool isBullish = IsBullish(analyseMarketStructure.bias);
|
||||
|
||||
//
|
||||
result =
|
||||
isBullish
|
||||
? valePriceZone.IsValid()
|
||||
: peakPriceZone.IsValid();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if Has Decision Zones ...
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool HasDecisionZone()
|
||||
{
|
||||
return HasPriceZone() &&
|
||||
decisionZone.IsValid();
|
||||
}
|
||||
|
||||
//
|
||||
@@ -322,7 +184,9 @@ bool DetectX121SMCXTWPVSiganlSetup(
|
||||
XC121SMCCycleHelper *analyseCycleHelper,
|
||||
XC121SMCCycleHelper *verificationCycleHelper,
|
||||
XC121SMCCycleHelper *consolidationCycleHelper,
|
||||
XC121SMCCycleHelper *visionCycleHelper
|
||||
XC121SMCCycleHelper *visionCycleHelper,
|
||||
//
|
||||
XCPOIDrawer *drawer //
|
||||
//
|
||||
)
|
||||
{
|
||||
@@ -517,348 +381,13 @@ bool DetectX121SMCXTWPVSiganlSetup(
|
||||
// Setup Conditions ...
|
||||
|
||||
//
|
||||
bool hasMarketStructure = conditions.HasMarketStrucutre();
|
||||
if (!hasMarketStructure)
|
||||
{
|
||||
//
|
||||
bool hasConsolidationMarketStructure =
|
||||
consolidationCycleHelper
|
||||
.DetectMarketStructure(conditions.consolidationMarketStructure);
|
||||
|
||||
//
|
||||
bool hasAnalyseMarketStructure =
|
||||
analyseCycleHelper
|
||||
.DetectMarketStructure(conditions.analyseMarketStructure);
|
||||
|
||||
//
|
||||
hasMarketStructure = conditions.HasMarketStrucutre();
|
||||
result = hasMarketStructure;
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// We Are Sure we Have Direct Structure Bias ...
|
||||
isBullish = IsBullish(conditions.analyseMarketStructure.bias);
|
||||
isBearish = IsBearish(conditions.analyseMarketStructure.bias);
|
||||
|
||||
//
|
||||
// RSI ...
|
||||
double rsi = triggerConditions.x121Conditions.rsiBuffer[1];
|
||||
|
||||
//
|
||||
bool isRSICrossedOverOverBought = triggerConditions.x121Conditions.isRSICrossedOverOverBought;
|
||||
bool isRSICrossedUnderOverBought = triggerConditions.x121Conditions.isRSICrossedUnderOverBought;
|
||||
|
||||
//
|
||||
bool isRSICrossedOverOverSold = triggerConditions.x121Conditions.isRSICrossedOverOverSold;
|
||||
bool isRSICrossedUnderOverSold = triggerConditions.x121Conditions.isRSICrossedUnderOverSold;
|
||||
|
||||
//
|
||||
// PV ...
|
||||
double peak = triggerConditions.x121Conditions.peaksBuffer[1];
|
||||
double vale = triggerConditions.x121Conditions.valesBuffer[1];
|
||||
|
||||
//
|
||||
bool isNewPeak = triggerConditions.x121Conditions.isNewPeak;
|
||||
bool isNewVale = triggerConditions.x121Conditions.isNewVale;
|
||||
|
||||
//
|
||||
// ATR ...
|
||||
double atr = triggerConditions.x121Conditions.atrBuffer[1];
|
||||
double atrUpper = triggerConditions.x121Conditions.atrUpperBuffer[1];
|
||||
double atrLower = triggerConditions.x121Conditions.atrLowerBuffer[1];
|
||||
|
||||
//
|
||||
// SAR ...
|
||||
double sar = triggerConditions.x121Conditions.sarBuffer[1];
|
||||
|
||||
//
|
||||
bool isSarSwitchedToBullish = triggerConditions.x121Conditions.isSarSwitchedToBullish;
|
||||
bool isSarSwitchedToBearish = triggerConditions.x121Conditions.isSarSwitchedToBearish;
|
||||
|
||||
//
|
||||
// Complex Conditions ...
|
||||
|
||||
//
|
||||
bool isNewPeakAboveAtrUpper =
|
||||
isNewPeak &&
|
||||
peak > atrUpper;
|
||||
|
||||
//
|
||||
bool isNewValeBelowAtrLower =
|
||||
isNewVale &&
|
||||
vale < atrLower;
|
||||
|
||||
//
|
||||
// Fill Conditions ...
|
||||
bool isConditionsFilled = conditions.IsFilled();
|
||||
if (!isConditionsFilled)
|
||||
{
|
||||
//
|
||||
// Cleanup ...
|
||||
|
||||
//
|
||||
// Sar ...
|
||||
|
||||
//
|
||||
// Bullish ...
|
||||
if (isBullish &&
|
||||
isSarSwitchedToBearish &&
|
||||
IsValid(conditions.sarSiwtchedToBullishAt))
|
||||
{
|
||||
conditions.sarSiwtchedToBullishAt = NULL;
|
||||
}
|
||||
|
||||
//
|
||||
// Bearish ...
|
||||
if (isBearish &&
|
||||
isSarSwitchedToBullish &&
|
||||
IsValid(conditions.sarSiwtchedToBearishAt))
|
||||
{
|
||||
conditions.sarSiwtchedToBearishAt = NULL;
|
||||
}
|
||||
|
||||
//
|
||||
// Rsi ...
|
||||
|
||||
//
|
||||
// Bullish ...
|
||||
if (isBullish &&
|
||||
isRSICrossedUnderOverSold &&
|
||||
IsValid(conditions.rsiCrossedOverOverSoldAt))
|
||||
{
|
||||
conditions.rsiCrossedOverOverSoldAt = NULL;
|
||||
}
|
||||
|
||||
//
|
||||
// Bearish ...
|
||||
if (isBearish &&
|
||||
isRSICrossedOverOverBought &&
|
||||
IsValid(conditions.rsiCrossedUnderOverBoughtAt))
|
||||
{
|
||||
conditions.rsiCrossedUnderOverBoughtAt = NULL;
|
||||
}
|
||||
|
||||
//
|
||||
// Atr Change ...
|
||||
|
||||
//
|
||||
// Bullish ...
|
||||
if (isBullish &&
|
||||
isNewPeak &&
|
||||
IsValid(conditions.newValeBelowAtrLowerAt))
|
||||
{
|
||||
conditions.newValeBelowAtrLowerAt = NULL;
|
||||
}
|
||||
|
||||
//
|
||||
// Bearish ...
|
||||
if (isBearish &&
|
||||
isNewVale &&
|
||||
IsValid(conditions.newPeakAboveAtrUpperAt))
|
||||
{
|
||||
conditions.newPeakAboveAtrUpperAt = NULL;
|
||||
}
|
||||
|
||||
//
|
||||
// Filling Up ...
|
||||
|
||||
//
|
||||
// Sar Change ...
|
||||
|
||||
//
|
||||
// Bullish ...
|
||||
if (isBullish &&
|
||||
isSarSwitchedToBullish &&
|
||||
!IsValid(conditions.sarSiwtchedToBullishAt))
|
||||
{
|
||||
conditions.sarSiwtchedToBullishAt = cTime;
|
||||
}
|
||||
|
||||
//
|
||||
// Bearish ...
|
||||
if (isBearish &&
|
||||
isSarSwitchedToBearish &&
|
||||
!IsValid(conditions.sarSiwtchedToBearishAt))
|
||||
{
|
||||
conditions.sarSiwtchedToBearishAt = cTime;
|
||||
}
|
||||
|
||||
//
|
||||
// Rsi Change ...
|
||||
|
||||
//
|
||||
// Bullish ...
|
||||
if (isBullish &&
|
||||
isRSICrossedOverOverSold &&
|
||||
!IsValid(conditions.rsiCrossedOverOverSoldAt))
|
||||
{
|
||||
conditions.rsiCrossedOverOverSoldAt = cTime;
|
||||
}
|
||||
|
||||
//
|
||||
// Bearish ...
|
||||
if (isBearish &&
|
||||
isRSICrossedUnderOverBought &&
|
||||
!IsValid(conditions.rsiCrossedUnderOverBoughtAt))
|
||||
{
|
||||
conditions.rsiCrossedUnderOverBoughtAt = cTime;
|
||||
}
|
||||
|
||||
//
|
||||
// Atr Change ...
|
||||
// New Peaks and Vale ...
|
||||
|
||||
//
|
||||
// Bullish ...
|
||||
if (isBullish &&
|
||||
isNewValeBelowAtrLower &&
|
||||
!IsValid(conditions.newValeBelowAtrLowerAt))
|
||||
{
|
||||
conditions.newValeBelowAtrLowerAt = cTime;
|
||||
}
|
||||
|
||||
//
|
||||
// Bearish ...
|
||||
if (isBearish &&
|
||||
isNewPeakAboveAtrUpper &&
|
||||
!IsValid(conditions.newPeakAboveAtrUpperAt))
|
||||
{
|
||||
conditions.newPeakAboveAtrUpperAt = cTime;
|
||||
}
|
||||
|
||||
//
|
||||
isConditionsFilled = conditions.IsFilled();
|
||||
result = isConditionsFilled;
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Fill Price Zones ...
|
||||
bool hasPriceZone = conditions.HasPriceZone();
|
||||
if (!hasPriceZone)
|
||||
{
|
||||
//
|
||||
if (isBullish)
|
||||
{
|
||||
//
|
||||
XPriceZones vPZone;
|
||||
bool hasValeInsideZone = CalculatePriceInsideZones(
|
||||
vPZone,
|
||||
analyseState,
|
||||
vale //
|
||||
);
|
||||
|
||||
//
|
||||
XPriceZones cbPZone;
|
||||
bool hasPriceInsideZone = CalculatePriceInsideZones(
|
||||
cbPZone,
|
||||
analyseState,
|
||||
cBar //
|
||||
);
|
||||
|
||||
//
|
||||
if (hasValeInsideZone &&
|
||||
hasPriceInsideZone &&
|
||||
vPZone.IsBullish() &&
|
||||
cbPZone.IsBullish())
|
||||
{
|
||||
conditions.valePriceZone = cbPZone;
|
||||
}
|
||||
}
|
||||
else if (isBearish)
|
||||
{
|
||||
//
|
||||
XPriceZones pPZone;
|
||||
bool hasPeakInsideZone = CalculatePriceInsideZones(
|
||||
pPZone,
|
||||
analyseState,
|
||||
peak //
|
||||
);
|
||||
|
||||
//
|
||||
XPriceZones cbPZone;
|
||||
bool hasPriceInsideZone = CalculatePriceInsideZones(
|
||||
cbPZone,
|
||||
analyseState,
|
||||
cBar //
|
||||
);
|
||||
|
||||
//
|
||||
if (
|
||||
hasPeakInsideZone &&
|
||||
hasPriceInsideZone &&
|
||||
pPZone.IsBearish() &&
|
||||
cbPZone.IsBearish())
|
||||
{
|
||||
conditions.peakPriceZone = cbPZone;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
hasPriceZone = conditions.HasPriceZone();
|
||||
result = hasPriceZone;
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Check for Decision ...
|
||||
bool hasDecision = conditions.HasDecisionZone();
|
||||
if (!hasDecision)
|
||||
{
|
||||
//
|
||||
if (isBullish)
|
||||
{
|
||||
//
|
||||
XPriceZones pZone;
|
||||
bool hasPZone = CalculatePriceInsideZones(
|
||||
pZone,
|
||||
decisionState,
|
||||
vale //
|
||||
);
|
||||
|
||||
//
|
||||
if (hasPZone &&
|
||||
pZone.IsBullish())
|
||||
{
|
||||
conditions.decisionZone = pZone;
|
||||
}
|
||||
}
|
||||
else if (isBearish)
|
||||
{
|
||||
//
|
||||
XPriceZones pZone;
|
||||
bool hasPZone = CalculatePriceInsideZones(
|
||||
pZone,
|
||||
decisionState,
|
||||
peak //
|
||||
);
|
||||
|
||||
//
|
||||
if (hasPZone &&
|
||||
pZone.IsBearish())
|
||||
{
|
||||
conditions.decisionZone = pZone;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
hasDecision = conditions.HasDecisionZone();
|
||||
result = hasDecision;
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
}
|
||||
bool isBullishTested = TestPOIState(
|
||||
drawer,
|
||||
X_DIRECTION_BULLISH,
|
||||
consolidationState,
|
||||
analyseState,
|
||||
decisionState //
|
||||
);
|
||||
|
||||
//
|
||||
result = isBullish ||
|
||||
@@ -1284,79 +813,6 @@ int DrawX121SMCXTWPVSiganl(
|
||||
//
|
||||
bool isBullish = IsBullish(conditions.dir);
|
||||
|
||||
//
|
||||
XCBaseObject *priceZoneObjs[];
|
||||
XCBaseObject *decisionZoneObjs[];
|
||||
XCBaseObject *marketStructureObjs[];
|
||||
|
||||
//
|
||||
bool hasMarketStructure = conditions.HasMarketStrucutre();
|
||||
if (hasMarketStructure)
|
||||
{
|
||||
// //
|
||||
// drawer.DrawMarketStructure(
|
||||
// conditions.analyseMarketStructure,
|
||||
// marketStructureObjs //
|
||||
// );
|
||||
}
|
||||
|
||||
//
|
||||
bool hasPriceZone = conditions.HasPriceZone();
|
||||
if (hasPriceZone)
|
||||
{
|
||||
//
|
||||
XPriceZones pZone;
|
||||
if (isBullish)
|
||||
{
|
||||
pZone = conditions.valePriceZone;
|
||||
}
|
||||
else
|
||||
{
|
||||
pZone = conditions.peakPriceZone;
|
||||
}
|
||||
|
||||
//
|
||||
drawer.DrawPriceZone(
|
||||
pZone,
|
||||
priceZoneObjs,
|
||||
conditions.dir //
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
bool hasDecisionZone = conditions.HasDecisionZone();
|
||||
if (hasDecisionZone)
|
||||
{
|
||||
//
|
||||
drawer.DrawPriceZone(
|
||||
conditions.decisionZone,
|
||||
decisionZoneObjs
|
||||
// ,
|
||||
// conditions.dir //
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
Copy(
|
||||
priceZoneObjs,
|
||||
drawnObjects,
|
||||
false //
|
||||
);
|
||||
|
||||
//
|
||||
Copy(
|
||||
decisionZoneObjs,
|
||||
drawnObjects,
|
||||
false //
|
||||
);
|
||||
|
||||
//
|
||||
Copy(
|
||||
marketStructureObjs,
|
||||
drawnObjects,
|
||||
false //
|
||||
);
|
||||
|
||||
//
|
||||
result = ArraySize(drawnObjects);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user