last ...
This commit is contained in:
@@ -54,10 +54,6 @@ struct X121SMCStrategyXSignalConditions
|
||||
double pivot;
|
||||
double point;
|
||||
|
||||
//
|
||||
XCOrderBlock *bullishOBs[];
|
||||
XCOrderBlock *bearishOBs[];
|
||||
|
||||
//
|
||||
// Constructor ...
|
||||
X121SMCStrategyXSignalConditions()
|
||||
@@ -180,34 +176,6 @@ struct X121SMCStrategyXSignalConditions
|
||||
point = 0;
|
||||
|
||||
//
|
||||
Clean(bullishOBs);
|
||||
Clean(bearishOBs);
|
||||
|
||||
//
|
||||
}
|
||||
|
||||
//
|
||||
int CountBullishOBs()
|
||||
{
|
||||
return ArraySize(bullishOBs);
|
||||
}
|
||||
|
||||
//
|
||||
bool HasBullishOBs()
|
||||
{
|
||||
return IsValidSize(CountBullishOBs());
|
||||
}
|
||||
|
||||
//
|
||||
int CountBearishOBs()
|
||||
{
|
||||
return ArraySize(bearishOBs);
|
||||
}
|
||||
|
||||
//
|
||||
bool HasBearishOBs()
|
||||
{
|
||||
return IsValidSize(CountBearishOBs());
|
||||
}
|
||||
|
||||
//
|
||||
@@ -434,69 +402,6 @@ bool DetectX121SMCXSignalSetup(
|
||||
//
|
||||
// Setup Conditions ...
|
||||
|
||||
//
|
||||
// Detect Trend ...
|
||||
|
||||
//
|
||||
// Consolidation ...
|
||||
ENUM_X_DIRECTION consolidationTrendDir;
|
||||
bool hasConsolidationTrend =
|
||||
consolidationCycleHelper
|
||||
.DetectMarketStructure(
|
||||
consolidationTrendDir //
|
||||
);
|
||||
bool hasConsolidationBullishTrend =
|
||||
hasConsolidationTrend &&
|
||||
IsBullish(consolidationTrendDir);
|
||||
bool hasConsolidationBearishTrend =
|
||||
hasConsolidationTrend &&
|
||||
IsBearish(consolidationTrendDir);
|
||||
|
||||
//
|
||||
// Verification ...
|
||||
ENUM_X_DIRECTION verificationTrendDir;
|
||||
bool hasVerificationTrend =
|
||||
verificationCycleHelper
|
||||
.DetectMarketStructure(
|
||||
verificationTrendDir //
|
||||
);
|
||||
bool hasVerificationBullishTrend =
|
||||
hasVerificationTrend &&
|
||||
IsBullish(verificationTrendDir);
|
||||
bool hasVerificationBearishTrend =
|
||||
hasVerificationTrend &&
|
||||
IsBearish(verificationTrendDir);
|
||||
|
||||
//
|
||||
// Analyse ...
|
||||
ENUM_X_DIRECTION analyseTrendDir;
|
||||
bool hasAnalyseTrend =
|
||||
analyseCycleHelper
|
||||
.DetectMarketStructure(
|
||||
analyseTrendDir //
|
||||
);
|
||||
bool hasAnalyseBullishTrend =
|
||||
hasAnalyseTrend &&
|
||||
IsBullish(analyseTrendDir);
|
||||
bool hasAnalyseBearishTrend =
|
||||
hasAnalyseTrend &&
|
||||
IsBearish(analyseTrendDir);
|
||||
|
||||
//
|
||||
// Decision ...
|
||||
ENUM_X_DIRECTION decisionTrendDir;
|
||||
bool hasDecisionTrend =
|
||||
decisionCycleHelper
|
||||
.DetectMarketStructure(
|
||||
decisionTrendDir //
|
||||
);
|
||||
bool hasDecisionBullishTrend =
|
||||
hasDecisionTrend &&
|
||||
IsBullish(decisionTrendDir);
|
||||
bool hasDecisionBearishTrend =
|
||||
hasDecisionTrend &&
|
||||
IsBearish(decisionTrendDir);
|
||||
|
||||
//
|
||||
// Detect Bar State ...
|
||||
|
||||
@@ -714,457 +619,6 @@ bool DetectX121SMCXSignalSetup(
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
// Detect Order Block ...
|
||||
|
||||
//
|
||||
bool hasBullishOrderBlocks = conditions.HasBullishOBs();
|
||||
int bullishOrderBlocksCount = conditions.CountBullishOBs();
|
||||
|
||||
//
|
||||
bool hasBearishOrderBlocks = conditions.HasBearishOBs();
|
||||
int bearishOrderBlocksCount = conditions.CountBearishOBs();
|
||||
|
||||
//
|
||||
bool hasOrderBlocks = hasBullishOrderBlocks &&
|
||||
hasBearishOrderBlocks;
|
||||
if (!hasOrderBlocks)
|
||||
{
|
||||
//
|
||||
XCOrderBlock *bullishOBs[];
|
||||
XCOrderBlock *bearishOBs[];
|
||||
bool hasOrderBlocks = visionCycleHelper.DetectOrderBlocks(
|
||||
bullishOBs,
|
||||
bearishOBs //
|
||||
);
|
||||
|
||||
//
|
||||
if (!hasBullishOrderBlocks)
|
||||
{
|
||||
//
|
||||
Copy(
|
||||
bullishOBs,
|
||||
conditions.bullishOBs //
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
if (!hasBearishOrderBlocks)
|
||||
{
|
||||
//
|
||||
Copy(
|
||||
bearishOBs,
|
||||
conditions.bearishOBs //
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
hasBullishOrderBlocks = conditions.HasBullishOBs();
|
||||
bullishOrderBlocksCount = conditions.CountBullishOBs();
|
||||
|
||||
//
|
||||
hasBearishOrderBlocks = conditions.HasBearishOBs();
|
||||
bearishOrderBlocksCount = conditions.CountBearishOBs();
|
||||
}
|
||||
|
||||
//
|
||||
bool hasOldestBullishOB = false;
|
||||
bool hasYoungestBullishOB = false;
|
||||
XCOrderBlock *oldestBullishOB = NULL;
|
||||
XCOrderBlock *youngestBullishOB = NULL;
|
||||
if (hasBullishOrderBlocks)
|
||||
{
|
||||
//
|
||||
XCZone *zones[];
|
||||
bool isConverted = ToZone(
|
||||
conditions.bullishOBs,
|
||||
zones //
|
||||
);
|
||||
|
||||
//
|
||||
int oldestIDX = GetOldest(zones);
|
||||
hasOldestBullishOB = IsValidIndex(oldestIDX);
|
||||
if (hasOldestBullishOB)
|
||||
{
|
||||
oldestBullishOB = conditions.bullishOBs[oldestIDX];
|
||||
}
|
||||
|
||||
//
|
||||
int youngestIDX = GetYoungest(zones);
|
||||
hasYoungestBullishOB = IsValidIndex(youngestIDX);
|
||||
if (hasYoungestBullishOB)
|
||||
{
|
||||
youngestBullishOB = conditions.bullishOBs[youngestIDX];
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
bool hasOldestBearishOB = false;
|
||||
bool hasYoungestBearishOB = false;
|
||||
XCOrderBlock *oldestBearishOB = NULL;
|
||||
XCOrderBlock *youngestBearishOB = NULL;
|
||||
if (hasBearishOrderBlocks)
|
||||
{
|
||||
//
|
||||
XCZone *zones[];
|
||||
bool isConverted = ToZone(
|
||||
conditions.bearishOBs,
|
||||
zones //
|
||||
);
|
||||
|
||||
//
|
||||
int oldestIDX = GetOldest(zones);
|
||||
hasOldestBearishOB = IsValidIndex(oldestIDX);
|
||||
if (hasOldestBearishOB)
|
||||
{
|
||||
oldestBearishOB = conditions.bearishOBs[oldestIDX];
|
||||
}
|
||||
|
||||
//
|
||||
int youngestIDX = GetYoungest(zones);
|
||||
hasYoungestBearishOB = IsValidIndex(youngestIDX);
|
||||
if (hasYoungestBearishOB)
|
||||
{
|
||||
youngestBearishOB = conditions.bearishOBs[youngestIDX];
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
bool hasPriceInsideOB = false;
|
||||
XCOrderBlock *priceInsideOB = NULL;
|
||||
|
||||
//
|
||||
if (!hasPriceInsideOB &&
|
||||
hasBullishOrderBlocks)
|
||||
{
|
||||
//
|
||||
for (int i = 0; i < bullishOrderBlocksCount; i++)
|
||||
{
|
||||
//
|
||||
XCOrderBlock *iOb = conditions.bullishOBs[i];
|
||||
|
||||
//
|
||||
bool isInside = IsPriceInsideZone(
|
||||
decisionXConditions.valesBuffer[1],
|
||||
(XCZone *)iOb //
|
||||
);
|
||||
if (isInside)
|
||||
{
|
||||
//
|
||||
hasPriceInsideOB = true;
|
||||
priceInsideOB = iOb;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
if (!hasPriceInsideOB &&
|
||||
hasBearishOrderBlocks)
|
||||
{
|
||||
//
|
||||
for (int i = 0; i < bearishOrderBlocksCount; i++)
|
||||
{
|
||||
//
|
||||
XCOrderBlock *iOb = conditions.bearishOBs[i];
|
||||
|
||||
//
|
||||
bool isInside = IsPriceInsideZone(
|
||||
decisionXConditions.peaksBuffer[1],
|
||||
(XCZone *)iOb //
|
||||
);
|
||||
if (isInside)
|
||||
{
|
||||
//
|
||||
hasPriceInsideOB = true;
|
||||
priceInsideOB = iOb;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
XStateZones obState;
|
||||
bool hasOBState = false;
|
||||
XOHCL priceInsideOBBreakerBar;
|
||||
if (hasPriceInsideOB)
|
||||
{
|
||||
//
|
||||
XOHCL toBar;
|
||||
XOHCL fromBar;
|
||||
ENUM_X_DIRECTION forDir =
|
||||
priceInsideOB.IsBullish()
|
||||
? X_DIRECTION_BULLISH
|
||||
: X_DIRECTION_BEARISH;
|
||||
bool hasBreakerBar = HasBreakerBar(
|
||||
toBar,
|
||||
fromBar,
|
||||
priceInsideOBBreakerBar,
|
||||
forDir,
|
||||
priceInsideOB.GetSymbol(),
|
||||
priceInsideOB.GetPeriod(),
|
||||
priceInsideOB.Upper(),
|
||||
priceInsideOB.Lower(),
|
||||
priceInsideOB.From(),
|
||||
priceInsideOB.To() //
|
||||
);
|
||||
if (hasBreakerBar)
|
||||
{
|
||||
//
|
||||
CalculateStateZones(
|
||||
obState,
|
||||
consolidationState,
|
||||
priceInsideOB.Upper(),
|
||||
priceInsideOB.Lower(),
|
||||
priceInsideOBBreakerBar.time //
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
hasOBState = obState.IsValid();
|
||||
}
|
||||
|
||||
//
|
||||
bool isSameCyclesPeak =
|
||||
//
|
||||
triggerXConditions.peaksBuffer[1] == decisionXConditions.peaksBuffer[1] &&
|
||||
decisionXConditions.peaksBuffer[1] == analyseXConditions.peaksBuffer[1] &&
|
||||
analyseXConditions.peaksBuffer[1] == verificationXConditions.peaksBuffer[1] &&
|
||||
verificationXConditions.peaksBuffer[1] == consolidationXConditions.peaksBuffer[1]
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
bool isSameCyclesVale =
|
||||
//
|
||||
triggerXConditions.valesBuffer[1] == decisionXConditions.valesBuffer[1] &&
|
||||
decisionXConditions.valesBuffer[1] == analyseXConditions.valesBuffer[1] &&
|
||||
analyseXConditions.valesBuffer[1] == verificationXConditions.valesBuffer[1] &&
|
||||
verificationXConditions.valesBuffer[1] == consolidationXConditions.valesBuffer[1]
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
bool hasSameCyclesPV =
|
||||
hasOBState &&
|
||||
hasPriceInsideOB &&
|
||||
(isSameCyclesPeak ||
|
||||
isSameCyclesVale);
|
||||
|
||||
//
|
||||
// DRAW ...
|
||||
//
|
||||
|
||||
//
|
||||
XCBaseObject *drawnObjects[];
|
||||
|
||||
//
|
||||
if (hasBullishOrderBlocks)
|
||||
{
|
||||
//
|
||||
for (int i = 0; i < bullishOrderBlocksCount; i++)
|
||||
{
|
||||
//
|
||||
XCOrderBlock *iOb = conditions.bullishOBs[i];
|
||||
|
||||
//
|
||||
XCBullishOrderBlockObject *iObObj;
|
||||
bool isCreated = visionCycleHelper
|
||||
.mPOIDrawer
|
||||
.CreateBullishOrderBlock(
|
||||
iOb,
|
||||
iObObj //
|
||||
);
|
||||
if (isCreated)
|
||||
{
|
||||
//
|
||||
Add(
|
||||
(XCBaseObject *)iObObj,
|
||||
drawnObjects //
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
if (hasBearishOrderBlocks)
|
||||
{
|
||||
//
|
||||
for (int i = 0; i < bearishOrderBlocksCount; i++)
|
||||
{
|
||||
//
|
||||
XCOrderBlock *iOb = conditions.bearishOBs[i];
|
||||
|
||||
//
|
||||
XCBearishOrderBlockObject *iObObj;
|
||||
bool isCreated = visionCycleHelper
|
||||
.mPOIDrawer
|
||||
.CreateBearishOrderBlock(
|
||||
iOb,
|
||||
iObObj //
|
||||
);
|
||||
if (isCreated)
|
||||
{
|
||||
//
|
||||
Add(
|
||||
(XCBaseObject *)iObObj,
|
||||
drawnObjects //
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// if (hasOldestBullishOB)
|
||||
// {
|
||||
// //
|
||||
// XCBullishOrderBlockObject *iObj;
|
||||
// bool isCreated = visionCycleHelper
|
||||
// .mPOIDrawer
|
||||
// .CreateBullishOrderBlock(
|
||||
// oldestBullishOB,
|
||||
// iObj //
|
||||
// );
|
||||
// if (isCreated)
|
||||
// {
|
||||
// }
|
||||
// }
|
||||
|
||||
// //
|
||||
// if (hasYoungestBullishOB)
|
||||
// {
|
||||
// //
|
||||
// XCBullishOrderBlockObject *iObj;
|
||||
// bool isCreated = visionCycleHelper
|
||||
// .mPOIDrawer
|
||||
// .CreateBullishOrderBlock(
|
||||
// youngestBullishOB,
|
||||
// iObj //
|
||||
// );
|
||||
// if (isCreated)
|
||||
// {
|
||||
// }
|
||||
// }
|
||||
|
||||
// //
|
||||
// if (hasOldestBearishOB)
|
||||
// {
|
||||
// //
|
||||
// XCBearishOrderBlockObject *iObj;
|
||||
// bool isCreated = visionCycleHelper
|
||||
// .mPOIDrawer
|
||||
// .CreateBearishOrderBlock(
|
||||
// oldestBearishOB,
|
||||
// iObj //
|
||||
// );
|
||||
// if (isCreated)
|
||||
// {
|
||||
// }
|
||||
// }
|
||||
|
||||
// //
|
||||
// if (hasYoungestBearishOB)
|
||||
// {
|
||||
// //
|
||||
// XCBearishOrderBlockObject *iObj;
|
||||
// bool isCreated = visionCycleHelper
|
||||
// .mPOIDrawer
|
||||
// .CreateBearishOrderBlock(
|
||||
// youngestBearishOB,
|
||||
// iObj //
|
||||
// );
|
||||
// if (isCreated)
|
||||
// {
|
||||
// }
|
||||
// }
|
||||
|
||||
//
|
||||
if (hasPriceInsideOB)
|
||||
{
|
||||
//
|
||||
bool isBullish = priceInsideOB.IsBullish();
|
||||
|
||||
//
|
||||
bool isCreated = false;
|
||||
XCBaseObject *iObObj = NULL;
|
||||
if (isBullish)
|
||||
{
|
||||
//
|
||||
XCBullishOrderBlockObject *iObj;
|
||||
isCreated = visionCycleHelper
|
||||
.mPOIDrawer
|
||||
.CreateBullishOrderBlock(
|
||||
priceInsideOB,
|
||||
iObj //
|
||||
);
|
||||
|
||||
//
|
||||
if (isCreated)
|
||||
{
|
||||
//
|
||||
iObj.ZoneColor(clrYellow);
|
||||
iObObj = (XCBaseObject *)iObj;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//
|
||||
XCBearishOrderBlockObject *iObj;
|
||||
isCreated = visionCycleHelper
|
||||
.mPOIDrawer
|
||||
.CreateBearishOrderBlock(
|
||||
priceInsideOB,
|
||||
iObj //
|
||||
);
|
||||
|
||||
//
|
||||
if (isCreated)
|
||||
{
|
||||
//
|
||||
iObj.ZoneColor(clrOrangeRed);
|
||||
iObObj = (XCBaseObject *)iObj;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
if (isCreated)
|
||||
{
|
||||
//
|
||||
Add(
|
||||
iObObj,
|
||||
drawnObjects //
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
if (hasOBState)
|
||||
{
|
||||
//
|
||||
XCBaseObject *stateObjects[];
|
||||
int stateObjectsCount = consolidationCycleHelper
|
||||
.mPOIDrawer
|
||||
.DrawStateZones(
|
||||
obState,
|
||||
stateObjects //
|
||||
);
|
||||
if (IsValidSize(stateObjectsCount))
|
||||
{
|
||||
//
|
||||
Copy(
|
||||
stateObjects,
|
||||
drawnObjects,
|
||||
false //
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
int drawnCount = ArraySize(drawnObjects);
|
||||
if (IsValidSize(drawnCount))
|
||||
{
|
||||
}
|
||||
|
||||
//
|
||||
//
|
||||
//
|
||||
@@ -1175,42 +629,14 @@ bool DetectX121SMCXSignalSetup(
|
||||
//
|
||||
bool isCondition1Bullish =
|
||||
//
|
||||
hasSameCyclesPV &&
|
||||
isCBarBullishFormed &&
|
||||
priceInsideOB.IsBullish() &&
|
||||
//
|
||||
(decisionXConditions.isBreakedUpPrevSar ||
|
||||
decisionXConditions.isBreakedUpPrevStr ||
|
||||
decisionXConditions.isVWapMaxBreakedUp ||
|
||||
decisionXConditions.isBreakedUpPrevCheMax ||
|
||||
decisionXConditions.isBreakedUpPrevAtrLower) &&
|
||||
//
|
||||
(decisionXConditions.isSarSwitchedToBullish ||
|
||||
decisionXConditions.isStrSwitchedToBullish ||
|
||||
decisionXConditions.isCheSwitchedToBullish ||
|
||||
decisionXConditions.isVWapSwitchedToBullishState ||
|
||||
decisionXConditions.isVWapSwitchedToBullishOrdered)
|
||||
false
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
bool isCondition1Bearish =
|
||||
//
|
||||
hasSameCyclesPV &&
|
||||
isCBarBearishFormed &&
|
||||
priceInsideOB.IsBearish() &&
|
||||
//
|
||||
(decisionXConditions.isBreakedDownPrevSar ||
|
||||
decisionXConditions.isBreakedDownPrevStr ||
|
||||
decisionXConditions.isVWapMinBreakedDown ||
|
||||
decisionXConditions.isBreakedDownPrevCheMin ||
|
||||
decisionXConditions.isBreakedDownPrevAtrUpper) &&
|
||||
//
|
||||
(decisionXConditions.isSarSwitchedToBearish ||
|
||||
decisionXConditions.isStrSwitchedToBearish ||
|
||||
decisionXConditions.isCheSwitchedToBearish ||
|
||||
decisionXConditions.isVWapSwitchedToBearishState ||
|
||||
decisionXConditions.isVWapSwitchedToBearishOrdered)
|
||||
false
|
||||
//
|
||||
;
|
||||
|
||||
@@ -1243,8 +669,8 @@ bool DetectX121SMCXSignalSetup(
|
||||
//
|
||||
conditions.pivot =
|
||||
isCondition1Bullish
|
||||
? priceInsideOB.Upper()
|
||||
: priceInsideOB.Lower();
|
||||
? 0 // priceInsideOB.Upper()
|
||||
: 0; // priceInsideOB.Lower();
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user