This commit is contained in:
2025-03-01 04:52:23 +03:30
parent c3bc38befb
commit 1d554ec21d
5 changed files with 882 additions and 429 deletions
+19 -27
View File
@@ -1851,52 +1851,44 @@ class XCBarAnalyser : public XCBase
*/ */
bool HasFiboPressure( bool HasFiboPressure(
XOHCL &bar, XOHCL &bar,
ENUM_X_DIRECTION &dir // ENUM_X_DIRECTION forDir,
ENUM_X_FIBO_LEVELS level //
) )
{ {
// //
bool result = false; bool result = false;
// //
dir = X_DIRECTION_NONE; result = bar.IsValid() &&
HasDirection(forDir);
//
result = bar.IsValid();
if (!result) if (!result)
{ {
return result; return result;
} }
// //
double bearishFib382 = GetFibonacciLevel( bool isBullish = IsBullish(forDir);
bool isBearish = IsBearish(forDir);
//
double fiboLevelValue = GetFibonacciLevel(
bar.high, bar.high,
bar.low, bar.low,
0.382, level,
1 // forDir //
);
double bullishFib382 = GetFibonacciLevel(
bar.high,
bar.low,
0.382,
-1 //
); );
// //
bool isBullish = bar.GetDown() > bearishFib382; bool isBullishPressured =
bool isBearish = bar.GetUp() < bullishFib382; isBullish &&
bar.GetDown() > fiboLevelValue;
bool isBearishPressured =
isBearish &&
bar.GetUp() < fiboLevelValue;
// //
result = isBullish || result = isBullishPressured ||
isBearish; isBearishPressured;
if (!result)
{
return result;
}
//
dir = isBullish
? X_DIRECTION_BULLISH
: X_DIRECTION_BEARISH;
// //
return result; return result;
+15 -4
View File
@@ -3185,6 +3185,7 @@ class XCPOIDrawer : public XCBase
*/ */
bool CreateBox( bool CreateBox(
XCBoxObject *&object, XCBoxObject *&object,
string name,
double upper, double upper,
double lower, double lower,
datetime from, datetime from,
@@ -3207,10 +3208,14 @@ class XCPOIDrawer : public XCBase
// //
string dateStr = ToFormatString(from) + "|" + ToFormatString(to); string dateStr = ToFormatString(from) + "|" + ToFormatString(to);
string dateMD5 = ToMD5(dateStr); string dateMD5 = ToMD5(dateStr);
string name = "XBox_" + if (!IsValid(name))
ToString(upper) + "_" + {
ToString(lower) + "_" + //
dateMD5; name = "XBox_" +
ToString(upper) + "_" +
ToString(lower) + "_" +
dateMD5;
}
// //
result = result =
@@ -3297,10 +3302,12 @@ class XCPOIDrawer : public XCBase
? BullishFVGColor() ? BullishFVGColor()
: BearishFVGColor(); : BearishFVGColor();
ENUM_LINE_STYLE style = STYLE_DASHDOTDOT; ENUM_LINE_STYLE style = STYLE_DASHDOTDOT;
string name = box.GetTag();
// //
result = CreateBox( result = CreateBox(
object, object,
name,
box.upper, box.upper,
box.lower, box.lower,
box.from, box.from,
@@ -3348,9 +3355,13 @@ class XCPOIDrawer : public XCBase
return result; return result;
} }
//
string name = box.GetTag();
// //
result = CreateBox( result = CreateBox(
object, object,
name,
box.upper, box.upper,
box.lower, box.lower,
box.from, box.from,
+23
View File
@@ -5327,6 +5327,29 @@ struct XBoxZone
// //
return result; return result;
} }
/**
* Retrieve Unique Identifier ...
*
* @return ( string )
*/
string GetTag()
{
//
string result =
//
"XBOX" + "_" +
ToString(dir) + "_" +
symbol + "_" +
ToString(period) + "_" +
ToString(upper) + "_" +
ToString(lower)
//
;
//
return result;
}
}; };
// //
+365 -34
View File
@@ -302,6 +302,7 @@ class XCX121SMCXWZSignalDetector : public XCBase
X121Conditions visionXConditions = visionConditions.x121Conditions; X121Conditions visionXConditions = visionConditions.x121Conditions;
// //
// Select Drawer Class ...
XCPOIDrawer *drawer = visionCycleHelper.mPOIDrawer; XCPOIDrawer *drawer = visionCycleHelper.mPOIDrawer;
// //
@@ -311,11 +312,14 @@ class XCX121SMCXWZSignalDetector : public XCBase
double point = 0; double point = 0;
double targets[]; double targets[];
double reward = 0; double reward = 0;
XBoxZone signalBox;
XOBFVG selectedZone; XOBFVG selectedZone;
double amountPercent = 0; double amountPercent = 0;
bool hasPriority = false; bool hasPriority = false;
bool hasSignalBox = false;
bool hasRewardAmount = false; bool hasRewardAmount = false;
bool hasSelectedZone = false; bool hasSelectedZone = false;
bool isSignalBoxReversal = false;
bool isSelectedZoneReversal = false; bool isSelectedZoneReversal = false;
bool hasSelectedConsolidationZone = false; bool hasSelectedConsolidationZone = false;
XConsolidationZone selectedConsolidationZone; XConsolidationZone selectedConsolidationZone;
@@ -369,6 +373,10 @@ class XCX121SMCXWZSignalDetector : public XCBase
bool hasWaitingZones = hasWorkingZone && bool hasWaitingZones = hasWorkingZone &&
workingZone.HasWaitingZones(); workingZone.HasWaitingZones();
//
//
//
// //
// Check Conditions if Has Inside Zones ... // Check Conditions if Has Inside Zones ...
bool hasInsideZones = hasWorkingZone && bool hasInsideZones = hasWorkingZone &&
@@ -422,7 +430,7 @@ class XCX121SMCXWZSignalDetector : public XCBase
workingZone.HasBreakedZones(); workingZone.HasBreakedZones();
if (hasBreakedZones) if (hasBreakedZones)
{ {
//
if (!hasSelectedZone) if (!hasSelectedZone)
{ {
// //
@@ -467,12 +475,189 @@ class XCX121SMCXWZSignalDetector : public XCBase
} }
} }
//
//
//
// //
bool hasInsideBoxes = hasWorkingZone && bool hasInsideBoxes = hasWorkingZone &&
workingZone.HasInsideBoxes(); workingZone.HasInsideBoxes();
if (hasInsideBoxes) if (hasInsideBoxes)
{ {
Print("Inside Boxes ..."); //
XOHCL zBar;
XOHCL cBar;
int count = 0;
bool has = false;
XBoxZone tmpSelectedBox;
int tmpSelectedBoxIDX = -1;
//
has = zBar.Init(
symbol,
period,
zIndex //
);
has = has &&
zBar.GetPreviousBar(cBar);
if (has)
{
//
count = workingZone.CountInsideBoxes();
for (int i = 0; i < count; i++)
{
//
tmpSelectedBox = workingZone.insideBoxes[i];
//
bool isBullish = tmpSelectedBox.IsBullish();
bool isBearish = tmpSelectedBox.IsBearish();
//
bool hasFiboPressure =
visionCycleHelper
.mBarAnalyser
.HasFiboPressure(
cBar,
tmpSelectedBox.dir,
X_FIBO_LEVEL_382 //
);
//
bool isBullishRejectedUpper =
cBar.low < tmpSelectedBox.upper &&
cBar.GetDown() > tmpSelectedBox.upper;
//
bool isBullishRejectedLower =
cBar.low < tmpSelectedBox.lower &&
cBar.GetDown() > tmpSelectedBox.lower;
//
bool isBearishRejectedUpper =
cBar.high > tmpSelectedBox.upper &&
cBar.GetUp() < tmpSelectedBox.upper;
//
bool isBearishRejectedLower =
cBar.high > tmpSelectedBox.lower &&
cBar.GetUp() < tmpSelectedBox.lower;
//
bool isBullishRejected =
// isBullishRejectedUpper ||
isBullishRejectedLower;
//
bool isBearishRejected =
isBearishRejectedUpper
// || isBearishRejectedLower
;
//
bool isMaWapBullish =
//
(decisionXConditions.isX3MaBullishState &&
decisionXConditions.isX3MaBullishOrdered)
//
&&
//
(decisionXConditions.isVWapBullishState &&
decisionXConditions.isVWapBullishOrdered)
//
;
//
bool isMaWapBearish =
//
(decisionXConditions.isX3MaBearishState &&
decisionXConditions.isX3MaBearishOrdered)
//
&&
//
(decisionXConditions.isVWapBearishState &&
decisionXConditions.isVWapBearishOrdered)
//
;
//
bool isX2MaWapInside =
//
(decisionXConditions.x3maFastBuffer[cIndex] < tmpSelectedBox.upper &&
decisionXConditions.x3maMidBuffer[cIndex] < tmpSelectedBox.upper &&
decisionXConditions.x3maFastBuffer[cIndex] > tmpSelectedBox.lower &&
decisionXConditions.x3maMidBuffer[cIndex] > tmpSelectedBox.lower)
//
&&
//
(decisionXConditions.vwapFastBuffer[cIndex] < tmpSelectedBox.upper &&
decisionXConditions.vwapMidBuffer[cIndex] < tmpSelectedBox.upper &&
decisionXConditions.vwapFastBuffer[cIndex] > tmpSelectedBox.lower &&
decisionXConditions.vwapMidBuffer[cIndex] > tmpSelectedBox.lower)
//
;
//
bool isBullishConditions =
//
isBullish &&
isMaWapBearish &&
isX2MaWapInside &&
hasFiboPressure &&
isBullishRejected &&
cBar.low < cBar.GetDown()
//
;
//
bool isBearishConditions =
//
isBearish &&
isMaWapBullish &&
isX2MaWapInside &&
hasFiboPressure &&
isBearishRejected &&
cBar.high > cBar.GetUp()
//
;
//
has = isBullishConditions ||
isBearishConditions;
if (!has)
{
//
tmpSelectedBox.Clean();
continue;
}
//
tmpSelectedBoxIDX = i;
signalBox = tmpSelectedBox;
//
tmpSelectedBox.Clean();
break;
}
}
//
isSignalBoxReversal = false;
hasSignalBox = signalBox.IsValid();
if (hasSignalBox)
{
//
ArrayRemove(
workingZone.insideBoxes,
tmpSelectedBoxIDX,
1 //
);
}
//
zBar.Clean();
cBar.Clean();
tmpSelectedBox.Clean();
} }
// //
@@ -480,35 +665,17 @@ class XCX121SMCXWZSignalDetector : public XCBase
workingZone.HasBreakedBoxes(); workingZone.HasBreakedBoxes();
if (hasBreakedBoxes) if (hasBreakedBoxes)
{ {
Print("Breaked Boxes ...");
} }
// //
// Checking Other Senario for Signals ... //
// if (!hasWaitingZones && //
// !hasSelectedZone)
// {
// //
// bool has = false;
// ENUM_X_DIRECTION dir;
// //
// has = DetectX121Conditions(
// pivot,
// point,
// sls,
// targets,
// dir,
// analyseState,
// decisionState,
// decisionXConditions,
// drawer //
// );
// }
// //
// Double Check and Prepare Signal Conditions ... // Double Check and Prepare Signal Conditions ...
// including Targets and SLs ... // including Targets and SLs ...
//
if (hasSelectedZone) if (hasSelectedZone)
{ {
// //
@@ -640,7 +807,7 @@ class XCX121SMCXWZSignalDetector : public XCBase
mConditions.priority = priority; mConditions.priority = priority;
mConditions.provider = provider; mConditions.provider = provider;
mConditions.dir = selectedZoneDir; mConditions.dir = selectedZoneDir;
mConditions.signalZone = selectedZone; mConditions.signalBox = signalBox;
mConditions.amountPercent = amountPercent; mConditions.amountPercent = amountPercent;
} }
@@ -654,6 +821,137 @@ class XCX121SMCXWZSignalDetector : public XCBase
selectedConsolidationZone.Clean(); selectedConsolidationZone.Clean();
} }
//
if (hasSignalBox)
{
//
workingZone.mInsideZoneObjects.Clear();
workingZone.mBreakedZoneObjects.Clear();
workingZone.mWaitingZoneObjects.Clear();
workingZone.mWorkingZoneObjects.Clear();
//
XCBoxObject *iObj;
signalBox.to = cTime;
bool isCreated = drawer.CreateBox(
signalBox,
iObj //
);
//
if (isCreated)
{
//
iObj.BoxWidth(2);
iObj.BoxColor(clrYellow);
iObj.BoxStyle(STYLE_SOLID);
}
//
bool isSignalBoxBullishDir = signalBox.IsBullish();
//
// Calculate Priority ...
hasPriority =
hasWorkingZone &&
workingZone
.DetectPriority(
priority,
signalBox.dir,
zIndex,
period //
);
//
// Calculate Risk Reward Ration based on Priority ...
hasRewardAmount = CalculateRiskReward(
priority,
reward,
amountPercent //
);
//
// Calculate Pivot and Point ...
//
pivot =
isSignalBoxBullishDir
? signalBox.lower
: signalBox.upper;
//
point =
isSignalBoxBullishDir
? signalBox.upper
: signalBox.lower;
//
double defaultTarget =
isSignalBoxBullishDir
? signalBox.upper
: signalBox.lower;
Add(
defaultTarget,
targets //
);
//
// Detect SLs ...
double iAtr = decisionXConditions.atrBuffer[0];
iAtr *= 1.5;
//
double defaultSL =
isSignalBoxBullishDir
? decisionXConditions.valesBuffer[0] - iAtr
: decisionXConditions.peaksBuffer[0] + iAtr;
//
Add(
defaultSL,
sls //
);
//
// Summaries Conditions ...
result =
pivot > 0 &&
point > 0 &&
hasPriority &&
hasRewardAmount;
if (result)
{
//
isBullish = signalBox.IsBullish();
isBearish = signalBox.IsBearish();
//
Copy(
sls,
mConditions.sls //
);
Copy(
targets,
mConditions.targets //
);
//
mConditions.pivot = pivot;
mConditions.point = point;
mConditions.reward = reward;
mConditions.setupTime = cTime;
mConditions.priority = priority;
mConditions.provider = provider;
mConditions.dir = signalBox.dir;
mConditions.signalBox = signalBox;
mConditions.amountPercent = amountPercent;
}
//
signalBox.Clean();
hasSignalBox = false;
}
// //
UpdateTo(cTime); UpdateTo(cTime);
@@ -664,15 +962,15 @@ class XCX121SMCXWZSignalDetector : public XCBase
// //
workingZone.Draw( workingZone.Draw(
drawer, drawer,
true, // Draw Waiting Zones .. true, // Draw Waiting Zones ...
true, // Draw Inside Zones .. true, // Draw Inside Zones ...
false, // Draw Breaked Zones .. true, // Draw Breaked Zones ...
false, // Draw Supply Zone .. true, // Draw Supply Zone ...
false, // Draw Demand Zone .. true, // Draw Demand Zone ...
false, // Draw Supply Zones .. true, // Draw Supply Zones ...
false, // Draw Demand Zones .. true, // Draw Demand Zones ...
false, // Draw Support Zones .. false, // Draw Support Zones ...
false // Draw Resistance Zones .. false // Draw Resistance Zones ...
); );
// //
@@ -698,6 +996,39 @@ class XCX121SMCXWZSignalDetector : public XCBase
// true, // Ignore BullishConsolidationZones ... // true, // Ignore BullishConsolidationZones ...
// true // Ignore BearishConsolidationZones ... // true // Ignore BearishConsolidationZones ...
// ); // );
// //
// int count = 0;
// bool has = false;
// //
// has = workingZone.HasSupplyZones();
// if (has)
// {
// }
// //
// has = workingZone.HasDemandZones();
// if (has)
// {
// //
// count = workingZone.CountDemandZones();
// for (int i = 0; i < count; i++)
// {
// //
// XCDemandZone *iZone = workingZone.demandZones[i];
// //
// XCDemandZoneObject *iObj;
// bool isCreated = drawer.CreateDemandZone(
// iZone,
// iObj //
// );
// }
// }
// //
// Print("");
} }
// //
+460 -364
View File
@@ -630,6 +630,16 @@ struct X121SMCStrategyXWZWorkingZone
continue; continue;
} }
//
// Checking Price Validation ...
has = cBar.high < tmpSupplies[i].Lower();
if (!has)
{
//
iBox.Clean();
continue;
}
// //
Add( Add(
tmpSupplies[i], tmpSupplies[i],
@@ -718,6 +728,16 @@ struct X121SMCStrategyXWZWorkingZone
continue; continue;
} }
//
// Checking Price Validation ...
has = cBar.low > tmpDemands[i].Upper();
if (!has)
{
//
iBox.Clean();
continue;
}
// //
Add( Add(
tmpDemands[i], tmpDemands[i],
@@ -728,7 +748,7 @@ struct X121SMCStrategyXWZWorkingZone
iBox.Clean(); iBox.Clean();
} }
} }
Clean(demandZones); Clean(tmpDemands);
// //
// Support Zones ... // Support Zones ...
@@ -806,6 +826,16 @@ struct X121SMCStrategyXWZWorkingZone
continue; continue;
} }
//
// Checking Price Validation ...
has = cBar.low > tmpSupports[i].Upper();
if (!has)
{
//
iBox.Clean();
continue;
}
// //
Add( Add(
tmpSupports[i], tmpSupports[i],
@@ -894,6 +924,16 @@ struct X121SMCStrategyXWZWorkingZone
continue; continue;
} }
//
// Checking Price Validation ...
has = cBar.high < tmpResistances[i].Lower();
if (!has)
{
//
iBox.Clean();
continue;
}
// //
Add( Add(
tmpResistances[i], tmpResistances[i],
@@ -909,353 +949,397 @@ struct X121SMCStrategyXWZWorkingZone
// //
// STF TTF ... // STF TTF ...
// // //
// Supply Zones ... // // Supply Zones ...
count = stfState.FilterSupplyZones( // count = stfState.FilterSupplyZones(
tmpSupplies, // tmpSupplies,
NULL, // NULL,
XZONE_STATE_PASSED, // XZONE_STATE_PASSED,
false, // false,
XZONE_STATE_FAILED, // XZONE_STATE_FAILED,
false, // false,
XZONE_STATE_FAILED, // XZONE_STATE_FAILED,
false, // false,
XZONE_STATE_IGNORED, // XZONE_STATE_IGNORED,
false // // false //
); // );
has = IsValidSize(count); // has = IsValidSize(count);
if (has) // if (has)
{ // {
// // //
for (int i = 0; i < count; i++) // for (int i = 0; i < count; i++)
{ // {
// // //
XBoxZone iBox; // XBoxZone iBox;
has = ToBox( // has = ToBox(
iBox, // iBox,
tmpSupplies[i] // // tmpSupplies[i] //
); // );
if (!has) // if (!has)
{ // {
// // //
iBox.Clean(); // iBox.Clean();
continue; // continue;
} // }
// // //
// Find Index ... // // Find Index ...
// // //
idx = FindIndex( // idx = FindIndex(
iBox, // iBox,
insideBoxes // // insideBoxes //
); // );
has = !IsValidIndex(idx); // has = !IsValidIndex(idx);
if (!has) // if (!has)
{ // {
// // //
iBox.Clean(); // iBox.Clean();
continue; // continue;
} // }
// // //
idx = FindIndex( // idx = FindIndex(
iBox, // iBox,
breakedBoxes // // breakedBoxes //
); // );
has = !IsValidIndex(idx); // has = !IsValidIndex(idx);
if (!has) // if (!has)
{ // {
// // //
iBox.Clean(); // iBox.Clean();
continue; // continue;
} // }
// // //
idx = FindIndex( // idx = FindIndex(
tmpSupplies[i], // tmpSupplies[i],
supplyZones // // supplyZones //
); // );
has = !IsValidIndex(idx); // has = !IsValidIndex(idx);
if (!has) // if (!has)
{ // {
// // //
iBox.Clean(); // iBox.Clean();
continue; // continue;
} // }
// // //
Add( // // Checking Price Validation ...
tmpSupplies[i], // has = cBar.high < tmpSupplies[i].Lower();
supplyZones // // if (!has)
); // {
// //
// iBox.Clean();
// continue;
// }
// // //
iBox.Clean(); // Add(
} // tmpSupplies[i],
} // supplyZones //
Clean(tmpSupplies); // );
// //
// iBox.Clean();
// }
// }
// Clean(tmpSupplies);
// //
// // Demand Zones ...
// count = stfState.FilterDemandZones(
// tmpDemands,
// NULL,
// XZONE_STATE_PASSED,
// false,
// XZONE_STATE_FAILED,
// false,
// XZONE_STATE_FAILED,
// false,
// XZONE_STATE_IGNORED,
// false //
// );
// has = IsValidSize(count);
// if (has)
// {
// //
// for (int i = 0; i < count; i++)
// {
// //
// XBoxZone iBox;
// has = ToBox(
// iBox,
// tmpDemands[i] //
// );
// if (!has)
// {
// //
// iBox.Clean();
// continue;
// }
// //
// // Find Index ...
// //
// idx = FindIndex(
// iBox,
// insideBoxes //
// );
// has = !IsValidIndex(idx);
// if (!has)
// {
// //
// iBox.Clean();
// continue;
// }
// //
// idx = FindIndex(
// iBox,
// breakedBoxes //
// );
// has = !IsValidIndex(idx);
// if (!has)
// {
// //
// iBox.Clean();
// continue;
// }
// //
// idx = FindIndex(
// tmpDemands[i],
// demandZones //
// );
// has = !IsValidIndex(idx);
// if (!has)
// {
// //
// iBox.Clean();
// continue;
// }
// //
// // Checking Price Validation ...
// has = cBar.low > tmpDemands[i].Upper();
// if (!has)
// {
// //
// iBox.Clean();
// continue;
// }
// //
// Add(
// tmpDemands[i],
// demandZones //
// );
// //
// iBox.Clean();
// }
// }
// Clean(tmpDemands);
// //
// // Support Zones ...
// count = ttfState.FilterSupportZones(
// tmpSupports,
// period,
// XZONE_STATE_PASSED,
// false,
// XZONE_STATE_FAILED,
// false,
// XZONE_STATE_FAILED,
// false,
// XZONE_STATE_IGNORED,
// false //
// );
// has = IsValidSize(count);
// if (has)
// {
// //
// for (int i = 0; i < count; i++)
// {
// //
// XBoxZone iBox;
// has = ToBox(
// iBox,
// tmpSupports[i] //
// );
// if (!has)
// {
// //
// iBox.Clean();
// continue;
// }
// //
// // Find Index ...
// //
// idx = FindIndex(
// iBox,
// insideBoxes //
// );
// has = !IsValidIndex(idx);
// if (!has)
// {
// //
// iBox.Clean();
// continue;
// }
// //
// idx = FindIndex(
// iBox,
// breakedBoxes //
// );
// has = !IsValidIndex(idx);
// if (!has)
// {
// //
// iBox.Clean();
// continue;
// }
// //
// idx = FindIndex(
// tmpSupports[i],
// supportZones //
// );
// has = !IsValidIndex(idx);
// if (!has)
// {
// //
// iBox.Clean();
// continue;
// }
// //
// // Checking Price Validation ...
// has = cBar.low > tmpSupports[i].Upper();
// if (!has)
// {
// //
// iBox.Clean();
// continue;
// }
// //
// Add(
// tmpSupports[i],
// supportZones //
// );
// //
// iBox.Clean();
// }
// }
// Clean(tmpSupports);
// //
// // Resistance Zones ..
// count = ttfState.FilterResistanceZones(
// tmpResistances,
// period,
// XZONE_STATE_PASSED,
// false,
// XZONE_STATE_FAILED,
// false,
// XZONE_STATE_FAILED,
// false,
// XZONE_STATE_IGNORED,
// false //
// );
// has = IsValidSize(count);
// if (has)
// {
// //
// for (int i = 0; i < count; i++)
// {
// //
// XBoxZone iBox;
// has = ToBox(
// iBox,
// tmpResistances[i] //
// );
// if (!has)
// {
// //
// iBox.Clean();
// continue;
// }
// //
// // Find Index ...
// //
// idx = FindIndex(
// iBox,
// insideBoxes //
// );
// has = !IsValidIndex(idx);
// if (!has)
// {
// //
// iBox.Clean();
// continue;
// }
// //
// idx = FindIndex(
// iBox,
// breakedBoxes //
// );
// has = !IsValidIndex(idx);
// if (!has)
// {
// //
// iBox.Clean();
// continue;
// }
// //
// idx = FindIndex(
// tmpResistances[i],
// resistanceZones //
// );
// has = !IsValidIndex(idx);
// if (!has)
// {
// //
// iBox.Clean();
// continue;
// }
// //
// // Checking Price Validation ...
// has = cBar.high < tmpResistances[i].Lower();
// if (!has)
// {
// //
// iBox.Clean();
// continue;
// }
// //
// Add(
// tmpResistances[i],
// resistanceZones //
// );
// //
// iBox.Clean();
// }
// }
// Clean(tmpResistances);
// //
// Demand Zones ...
count = stfState.FilterDemandZones(
tmpDemands,
NULL,
XZONE_STATE_PASSED,
false,
XZONE_STATE_FAILED,
false,
XZONE_STATE_FAILED,
false,
XZONE_STATE_IGNORED,
false //
);
has = IsValidSize(count);
if (has)
{
//
for (int i = 0; i < count; i++)
{
//
XBoxZone iBox;
has = ToBox(
iBox,
tmpDemands[i] //
);
if (!has)
{
//
iBox.Clean();
continue;
}
//
// Find Index ...
//
idx = FindIndex(
iBox,
insideBoxes //
);
has = !IsValidIndex(idx);
if (!has)
{
//
iBox.Clean();
continue;
}
//
idx = FindIndex(
iBox,
breakedBoxes //
);
has = !IsValidIndex(idx);
if (!has)
{
//
iBox.Clean();
continue;
}
//
idx = FindIndex(
tmpDemands[i],
demandZones //
);
has = !IsValidIndex(idx);
if (!has)
{
//
iBox.Clean();
continue;
}
//
Add(
tmpDemands[i],
demandZones //
);
//
iBox.Clean();
}
}
Clean(demandZones);
// //
// Support Zones ...
count = ttfState.FilterSupportZones(
tmpSupports,
period,
XZONE_STATE_PASSED,
false,
XZONE_STATE_FAILED,
false,
XZONE_STATE_FAILED,
false,
XZONE_STATE_IGNORED,
false //
);
has = IsValidSize(count);
if (has)
{
//
for (int i = 0; i < count; i++)
{
//
XBoxZone iBox;
has = ToBox(
iBox,
tmpSupports[i] //
);
if (!has)
{
//
iBox.Clean();
continue;
}
//
// Find Index ...
//
idx = FindIndex(
iBox,
insideBoxes //
);
has = !IsValidIndex(idx);
if (!has)
{
//
iBox.Clean();
continue;
}
//
idx = FindIndex(
iBox,
breakedBoxes //
);
has = !IsValidIndex(idx);
if (!has)
{
//
iBox.Clean();
continue;
}
//
idx = FindIndex(
tmpSupports[i],
supportZones //
);
has = !IsValidIndex(idx);
if (!has)
{
//
iBox.Clean();
continue;
}
//
Add(
tmpSupports[i],
supportZones //
);
//
iBox.Clean();
}
}
Clean(tmpSupports);
// //
// Resistance Zones ..
count = ttfState.FilterResistanceZones(
tmpResistances,
period,
XZONE_STATE_PASSED,
false,
XZONE_STATE_FAILED,
false,
XZONE_STATE_FAILED,
false,
XZONE_STATE_IGNORED,
false //
);
has = IsValidSize(count);
if (has)
{
//
for (int i = 0; i < count; i++)
{
//
XBoxZone iBox;
has = ToBox(
iBox,
tmpResistances[i] //
);
if (!has)
{
//
iBox.Clean();
continue;
}
//
// Find Index ...
//
idx = FindIndex(
iBox,
insideBoxes //
);
has = !IsValidIndex(idx);
if (!has)
{
//
iBox.Clean();
continue;
}
//
idx = FindIndex(
iBox,
breakedBoxes //
);
has = !IsValidIndex(idx);
if (!has)
{
//
iBox.Clean();
continue;
}
//
idx = FindIndex(
tmpResistances[i],
resistanceZones //
);
has = !IsValidIndex(idx);
if (!has)
{
//
iBox.Clean();
continue;
}
//
Add(
tmpResistances[i],
resistanceZones //
);
//
iBox.Clean();
}
}
Clean(tmpResistances);
// //
// Consolidation Zones ... // Consolidation Zones ...
@@ -2222,6 +2306,33 @@ struct X121SMCStrategyXWZWorkingZone
} }
} }
//
// Demand Zone ...
if (drawDemandZone)
{
//
has = HasDemandZone();
if (has)
{
//
XCDemandZoneObject *iObj;
isCreated = drawer.CreateDemandZone(
demandZone,
iObj //
);
//
if (isCreated)
{
mWorkingZoneObjects.Add(iObj);
}
}
}
//
//
//
// //
// Supply Zones ... // Supply Zones ...
if (drawSupplyZones) if (drawSupplyZones)
@@ -2250,29 +2361,6 @@ struct X121SMCStrategyXWZWorkingZone
} }
} }
//
// Demand Zone ...
if (drawDemandZone)
{
//
has = HasDemandZone();
if (has)
{
//
XCDemandZoneObject *iObj;
isCreated = drawer.CreateDemandZone(
demandZone,
iObj //
);
//
if (isCreated)
{
mWorkingZoneObjects.Add(iObj);
}
}
}
// //
// Demand Zones ... // Demand Zones ...
if (drawDemandZones) if (drawDemandZones)
@@ -2357,6 +2445,10 @@ struct X121SMCStrategyXWZWorkingZone
} }
} }
//
//
//
// //
// Waiting Zones ... // Waiting Zones ...
if (drawWaitingZones) if (drawWaitingZones)
@@ -2503,6 +2595,10 @@ struct X121SMCStrategyXWZWorkingZone
} }
} }
//
//
//
// //
// Quarters ... // Quarters ...
has = IsValid(); has = IsValid();
@@ -2692,7 +2788,7 @@ struct X121SMCStrategyXWZSignalConditions
double targets[]; double targets[];
// //
XOBFVG signalZone; XBoxZone signalBox;
// //
ENUM_X121SMC_XWZ_PRIORITY priority; ENUM_X121SMC_XWZ_PRIORITY priority;
@@ -2825,7 +2921,7 @@ struct X121SMCStrategyXWZSignalConditions
// //
Clean(sls); Clean(sls);
Clean(targets); Clean(targets);
signalZone.Clean(); signalBox.Clean();
// //
provider = X121SMC_XWZ_PROVIDER_NONE; provider = X121SMC_XWZ_PROVIDER_NONE;
@@ -3107,7 +3203,7 @@ bool DetectSelectedZoneConditions(
* *
* @return ( bool ) * @return ( bool )
*/ */
bool DetectSelectedZoneConditions( bool DetectSelectedBoxConditions(
bool &isReversal, bool &isReversal,
XBoxZone &zone, XBoxZone &zone,
XPOIState &state, XPOIState &state,