This commit is contained in:
2025-03-01 19:56:34 +03:30
parent 1d554ec21d
commit 4602169b1d
2 changed files with 737 additions and 700 deletions
+158 -151
View File
@@ -430,49 +430,49 @@ class XCX121SMCXWZSignalDetector : public XCBase
workingZone.HasBreakedZones(); workingZone.HasBreakedZones();
if (hasBreakedZones) if (hasBreakedZones)
{ {
// //
// if (!hasSelectedZone)
// {
// //
// int selectedIDX = -1;
// int count = workingZone.CountBreakedZones();
// for (int i = 0; i < count; i++)
// {
// //
// bool has = DetectSelectedZoneConditions(
// isSelectedZoneReversal,
// workingZone.breakedZones[i],
// decisionState,
// decisionXConditions //
// );
if (!hasSelectedZone) // //
{ // if (has)
// // {
int selectedIDX = -1; // //
int count = workingZone.CountBreakedZones(); // selectedIDX = i;
for (int i = 0; i < count; i++) // selectedZone = workingZone.breakedZones[i];
{
//
bool has = DetectSelectedZoneConditions(
isSelectedZoneReversal,
workingZone.breakedZones[i],
decisionState,
decisionXConditions //
);
// // //
if (has) // break;
{ // }
// // }
selectedIDX = i;
selectedZone = workingZone.breakedZones[i];
// // //
break; // if (IsValidIndex(selectedIDX))
} // {
} // //
// ArrayRemove(
// workingZone.breakedZones,
// selectedIDX,
// 1 //
// );
// // //
if (IsValidIndex(selectedIDX)) // hasSelectedZone = selectedZone.IsValid();
{ // provider = X121SMC_XWZ_PROVIDER_ACTIVATED_ZONE;
// // }
ArrayRemove( // }
workingZone.breakedZones,
selectedIDX,
1 //
);
//
hasSelectedZone = selectedZone.IsValid();
provider = X121SMC_XWZ_PROVIDER_ACTIVATED_ZONE;
}
}
} }
// //
@@ -667,6 +667,11 @@ class XCX121SMCXWZSignalDetector : public XCBase
{ {
} }
//
if (!hasSignalBox)
{
}
// //
// //
// //
@@ -771,6 +776,7 @@ class XCX121SMCXWZSignalDetector : public XCBase
selectedZone, selectedZone,
selectedZoneDir, selectedZoneDir,
workingZone, workingZone,
decisionXConditions,
zIndex, zIndex,
maxAllowedSLDistanceInPoint // maxAllowedSLDistanceInPoint //
); );
@@ -824,132 +830,132 @@ class XCX121SMCXWZSignalDetector : public XCBase
// //
if (hasSignalBox) if (hasSignalBox)
{ {
// // //
workingZone.mInsideZoneObjects.Clear(); // workingZone.mInsideZoneObjects.Clear();
workingZone.mBreakedZoneObjects.Clear(); // workingZone.mBreakedZoneObjects.Clear();
workingZone.mWaitingZoneObjects.Clear(); // workingZone.mWaitingZoneObjects.Clear();
workingZone.mWorkingZoneObjects.Clear(); // workingZone.mWorkingZoneObjects.Clear();
// // //
XCBoxObject *iObj; // XCBoxObject *iObj;
signalBox.to = cTime; // signalBox.to = cTime;
bool isCreated = drawer.CreateBox( // bool isCreated = drawer.CreateBox(
signalBox, // signalBox,
iObj // // iObj //
); // );
// // //
if (isCreated) // if (isCreated)
{ // {
// // //
iObj.BoxWidth(2); // iObj.BoxWidth(2);
iObj.BoxColor(clrYellow); // iObj.BoxColor(clrYellow);
iObj.BoxStyle(STYLE_SOLID); // iObj.BoxStyle(STYLE_SOLID);
} // }
// // //
bool isSignalBoxBullishDir = signalBox.IsBullish(); // bool isSignalBoxBullishDir = signalBox.IsBullish();
// // //
// Calculate Priority ... // // Calculate Priority ...
hasPriority = // hasPriority =
hasWorkingZone && // hasWorkingZone &&
workingZone // workingZone
.DetectPriority( // .DetectPriority(
priority, // priority,
signalBox.dir, // signalBox.dir,
zIndex, // zIndex,
period // // period //
); // );
// // //
// Calculate Risk Reward Ration based on Priority ... // // Calculate Risk Reward Ration based on Priority ...
hasRewardAmount = CalculateRiskReward( // hasRewardAmount = CalculateRiskReward(
priority, // priority,
reward, // reward,
amountPercent // // amountPercent //
); // );
// // //
// Calculate Pivot and Point ... // // Calculate Pivot and Point ...
// // //
pivot = // pivot =
isSignalBoxBullishDir // isSignalBoxBullishDir
? signalBox.lower // ? signalBox.lower
: signalBox.upper; // : signalBox.upper;
// // //
point = // point =
isSignalBoxBullishDir // isSignalBoxBullishDir
? signalBox.upper // ? signalBox.upper
: signalBox.lower; // : signalBox.lower;
// // //
double defaultTarget = // double defaultTarget =
isSignalBoxBullishDir // isSignalBoxBullishDir
? signalBox.upper // ? signalBox.upper
: signalBox.lower; // : signalBox.lower;
Add( // Add(
defaultTarget, // defaultTarget,
targets // // targets //
); // );
// // //
// Detect SLs ... // // Detect SLs ...
double iAtr = decisionXConditions.atrBuffer[0]; // double iAtr = decisionXConditions.atrBuffer[0];
iAtr *= 1.5; // iAtr *= 1.5;
// // //
double defaultSL = // double defaultSL =
isSignalBoxBullishDir // isSignalBoxBullishDir
? decisionXConditions.valesBuffer[0] - iAtr // ? decisionXConditions.valesBuffer[0] - iAtr
: decisionXConditions.peaksBuffer[0] + iAtr; // : decisionXConditions.peaksBuffer[0] + iAtr;
// // //
Add( // Add(
defaultSL, // defaultSL,
sls // // sls //
); // );
// // //
// Summaries Conditions ... // // Summaries Conditions ...
result = // result =
pivot > 0 && // pivot > 0 &&
point > 0 && // point > 0 &&
hasPriority && // hasPriority &&
hasRewardAmount; // hasRewardAmount;
if (result) // if (result)
{ // {
// // //
isBullish = signalBox.IsBullish(); // isBullish = signalBox.IsBullish();
isBearish = signalBox.IsBearish(); // isBearish = signalBox.IsBearish();
// // //
Copy( // Copy(
sls, // sls,
mConditions.sls // // mConditions.sls //
); // );
Copy( // Copy(
targets, // targets,
mConditions.targets // // mConditions.targets //
); // );
// // //
mConditions.pivot = pivot; // mConditions.pivot = pivot;
mConditions.point = point; // mConditions.point = point;
mConditions.reward = reward; // mConditions.reward = reward;
mConditions.setupTime = cTime; // mConditions.setupTime = cTime;
mConditions.priority = priority; // mConditions.priority = priority;
mConditions.provider = provider; // mConditions.provider = provider;
mConditions.dir = signalBox.dir; // mConditions.dir = signalBox.dir;
mConditions.signalBox = signalBox; // mConditions.signalBox = signalBox;
mConditions.amountPercent = amountPercent; // mConditions.amountPercent = amountPercent;
} // }
// // //
signalBox.Clean(); // signalBox.Clean();
hasSignalBox = false; // hasSignalBox = false;
} }
// //
@@ -967,8 +973,8 @@ class XCX121SMCXWZSignalDetector : public XCBase
true, // Draw Breaked Zones ... true, // Draw Breaked Zones ...
true, // Draw Supply Zone ... true, // Draw Supply Zone ...
true, // Draw Demand Zone ... true, // Draw Demand Zone ...
true, // Draw Supply Zones ... false, // Draw Supply Zones ...
true, // Draw Demand Zones ... false, // Draw Demand Zones ...
false, // Draw Support Zones ... false, // Draw Support Zones ...
false // Draw Resistance Zones ... false // Draw Resistance Zones ...
); );
@@ -1294,6 +1300,7 @@ class XCX121SMCXWZSignalDetector : public XCBase
{ {
// //
bool result = false; bool result = false;
return false;
// //
Clean(guards); Clean(guards);
File diff suppressed because it is too large Load Diff